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

Conversation

gauthamnair
Copy link
Contributor

@gauthamnair gauthamnair commented Oct 27, 2023

I struggled for a while to debug the error messages I was getting from pants (via pex), but it was ultimately because I had not added <ASDF> to the search-path.

["<PYENV>", "<PATH>"] only puts the asdf shims on the path, and they are powerless without the .tool-versions. It took me a long while to understand what was happening because even in the sandbox it looked like the asdf pythons should be findable.

In the spirit of making pants "just work" more often, and given the fair popularity of asdf, should we support asdf by default?

@gauthamnair
Copy link
Contributor Author

gauthamnair commented Oct 28, 2023

Looking into why CI is failing. Its clearly due to the change, but also difficult to repro locally.

relieved, it is reproducible locally by moving my .asdf directory elsewhere. Digging in.

@@ -89,7 +89,9 @@ 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>'

@gauthamnair
Copy link
Contributor Author

Current failures look to be #20103

@kaos kaos merged commit e43dcfe into pantsbuild:main Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants