Skip to content

environmentPath should always return the path to the executable #1804

Description

PythonEnvironmentInfo.environmentPath is a read-only property of type Uri, inherited by the public PythonEnvironment interface. The concrete implementation, PythonEnvironmentImpl, copies this value from the information supplied by the environment manager.

Currently, the API documentation explicitly allows this property to refer to either the Python executable or the environment directory. Consequently, consumers cannot determine which kind of path they have from the property’s contract alone.

Current behavior

The meaning of environmentPath depends on the environment manager:

It can identify the Python executable, such as "/project/.venv/bin/python".
It can identify the environment directory, such as "/project/.venv".
These paths are not interchangeable. Consumers expecting an interpreter path must account for manager-specific behavior or perform additional resolution.

Expected behavior

PythonEnvironmentInfo.environmentPath, and therefore PythonEnvironment.environmentPath, should consistently identify the Python executable, regardless of the environment manager.

The property should remain a Uri; this change concerns what it points to, not its type.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions