Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discover ASDF interpreters by default #20105

Merged
merged 5 commits into from
Oct 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/python/pants/core/subsystems/python_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class PythonBootstrapSubsystem(Subsystem):

class EnvironmentAware(Subsystem.EnvironmentAware):
search_path = StrListOption(
default=["<PYENV>", "<PATH>"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was gruesome to debug but this ends up broken if we refer to AsdfPathString.STANDARD directly. You end up with:

--python-bootstrap-search-path="[<binary-paths>, <binary-paths>, ...]"
PANTS_PYTHON_BOOTSTRAP_SEARCH_PATH
search_path
    default: [
        "<PYENV>",
        "<ASDF>",
        "<PATH>"
    ]
    current value: [
        "<PYENV>",
        "AsdfPathString.STANDARD",
        "<PATH>"
    ]

For these str-Enum compositions, the str returns the fully qualified name:

str(AsdfPathString.STANDARD) == 'AsdfPathString.STANDARD'

but the __format__() method used in f-strings returns the intended '<ASDF>'

default=["<PYENV>", AsdfPathString.STANDARD.value, "<PATH>"],
help=softwrap(
f"""
A list of paths to search for Python interpreters.
Expand Down