Repository navigation
Refactor project interpreter request for requires-python specifiers - #4216
Merged
Merged
Conversation
zanieb
force-pushed
the
zb/version-request-range
branch
from
June 10, 2024 20:11
fc7e190 to
1321ccf
Compare
zanieb
force-pushed
the
zb/fix-project-requires-python
branch
from
June 10, 2024 20:11
2c1499b to
8e63d1d
Compare
zanieb
force-pushed
the
zb/version-request-range
branch
from
June 10, 2024 20:35
1321ccf to
d19f861
Compare
zanieb
marked this pull request as draft
June 10, 2024 20:39
zanieb
force-pushed
the
zb/version-request-range
branch
from
June 10, 2024 22:40
1a449ca to
662a4c2
Compare
zanieb
force-pushed
the
zb/fix-project-requires-python
branch
from
June 10, 2024 23:20
8e63d1d to
f444f3c
Compare
zanieb
marked this pull request as ready for review
June 10, 2024 23:21
requires-python specifiersrequires-python specifiers
zanieb
commented
Jun 10, 2024
| ) | ||
| } else { | ||
| Toolchain::find( | ||
| None, |
Member
Author
There was a problem hiding this comment.
Guess I might want to make find take a Option<ToolchainRequest> as well.
Member
There was a problem hiding this comment.
Personally find it a little easier to read as:
let interpreter = python
.map(ToolchainRequest::parse)
.or(requires_python
.map(|specifiers| ToolchainRequest::Version(VersionRequest::Range(specifiers.clone()))))
.map_or_else(
|| {
Toolchain::find(
None,
// Otherwise we'll try to use the venv we just deleted.
SystemPython::Required,
preview,
cache,
)
},
|request| {
Toolchain::find_requested(
&request,
// Otherwise we'll try to use the venv we just deleted.
SystemPython::Required,
preview,
cache,
)
},
)?
.into_interpreter();But totally subjective.
Member
Author
There was a problem hiding this comment.
Oooh that's really nice haha but... I think I still want to refactor Toolchain::find to just not take strings anymore so I'll probably just merge and change it later.
Member
Author
There was a problem hiding this comment.
I want it in the release and it's after work hours! hehe
Member
Author
There was a problem hiding this comment.
I do really like it actually <3
charliermarsh
approved these changes
Jun 11, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor following #4214 to avoid parsing the specifiers again