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

Improve interactions between .python-version files and project requires-python #6372

Closed

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Aug 21, 2024

Closes #5228
Required for #6370

This ensures that we

  1. Ignore.python-version files outside of projects if they specify a version that's incompatible with the requires-python
  2. Warn when .python-version files inside a project are incompatible with the requires-python

Unfortunately, this totally falls apart if the .python-version file isn't a version specifier, e.g., if it's an interpreter path.

This begins to create a unified place to determine the PythonRequest to use — it's getting really complicated.

@zanieb zanieb force-pushed the zb/version-file-discover branch from 916db9c to df3693e Compare August 21, 2024 21:08
@zanieb zanieb force-pushed the zb/version-file-discover-project branch from 62dd871 to 5b48cf1 Compare August 21, 2024 21:08
@zanieb zanieb force-pushed the zb/version-file-discover branch 2 times, most recently from 1e02b28 to 2ca5bb4 Compare August 23, 2024 13:52
@zanieb zanieb force-pushed the zb/version-file-discover-project branch 4 times, most recently from ff3d300 to 584401d Compare August 23, 2024 16:07
@zanieb zanieb force-pushed the zb/version-file-discover branch from 2ca5bb4 to 6f07881 Compare September 16, 2024 22:29
@aspeddro
Copy link

aspeddro commented Sep 26, 2024

With this PR a project with a .python-version different from requires-python, requires-python is used and .python-version is ignored?

I think it makes sense that uv run example.py ignores .python-version
image

@zanieb
Copy link
Member Author

zanieb commented Sep 26, 2024

With this PR a project with a .python-version different from requires-python, requires-python is used and .python-version is ignored?

Basically, yes. We will do our best to respect .python-version but if it's not compatible with the project or script we will warn and ignore it.

@zanieb zanieb force-pushed the zb/version-file-discover branch from 6f07881 to 3564e75 Compare October 1, 2024 22:45
@zanieb zanieb force-pushed the zb/version-file-discover-project branch from 584401d to fdde4bf Compare October 2, 2024 16:06
@zanieb zanieb force-pushed the zb/version-file-discover branch 6 times, most recently from 0c31b66 to 932048f Compare October 4, 2024 16:07
@zanieb zanieb closed this Oct 4, 2024
zanieb added a commit that referenced this pull request Nov 4, 2024
…6370)

Uses #6369 for test coverage.

Updates version file discovery to search up into parent directories.
Also refactors Python request determination to avoid duplicating the
user request / version file / workspace lookup logic in every command
(this supersedes the work started in
#6372).

There is a bit of remaining work here, mostly around documentation.
There are some edge-cases where we don't use the refactored request
utility, like `uv build` — I'm not sure how I'm going to handle that yet
as it needs a separate root directory.
zanieb added a commit that referenced this pull request Nov 4, 2024
…6370)

Uses #6369 for test coverage.

Updates version file discovery to search up into parent directories.
Also refactors Python request determination to avoid duplicating the
user request / version file / workspace lookup logic in every command
(this supersedes the work started in
#6372).

There is a bit of remaining work here, mostly around documentation.
There are some edge-cases where we don't use the refactored request
utility, like `uv build` — I'm not sure how I'm going to handle that yet
as it needs a separate root directory.
zanieb added a commit that referenced this pull request Nov 5, 2024
…6370)

Uses #6369 for test coverage.

Updates version file discovery to search up into parent directories.
Also refactors Python request determination to avoid duplicating the
user request / version file / workspace lookup logic in every command
(this supersedes the work started in
#6372).

There is a bit of remaining work here, mostly around documentation.
There are some edge-cases where we don't use the refactored request
utility, like `uv build` — I'm not sure how I'm going to handle that yet
as it needs a separate root directory.
charliermarsh pushed a commit that referenced this pull request Nov 6, 2024
…6370)

Uses #6369 for test coverage.

Updates version file discovery to search up into parent directories.
Also refactors Python request determination to avoid duplicating the
user request / version file / workspace lookup logic in every command
(this supersedes the work started in
#6372).

There is a bit of remaining work here, mostly around documentation.
There are some edge-cases where we don't use the refactored request
utility, like `uv build` — I'm not sure how I'm going to handle that yet
as it needs a separate root directory.
charliermarsh pushed a commit that referenced this pull request Nov 6, 2024
…6370)

Uses #6369 for test coverage.

Updates version file discovery to search up into parent directories.
Also refactors Python request determination to avoid duplicating the
user request / version file / workspace lookup logic in every command
(this supersedes the work started in
#6372).

There is a bit of remaining work here, mostly around documentation.
There are some edge-cases where we don't use the refactored request
utility, like `uv build` — I'm not sure how I'm going to handle that yet
as it needs a separate root directory.
charliermarsh pushed a commit that referenced this pull request Nov 6, 2024
…6370)

Uses #6369 for test coverage.

Updates version file discovery to search up into parent directories.
Also refactors Python request determination to avoid duplicating the
user request / version file / workspace lookup logic in every command
(this supersedes the work started in
#6372).

There is a bit of remaining work here, mostly around documentation.
There are some edge-cases where we don't use the refactored request
utility, like `uv build` — I'm not sure how I'm going to handle that yet
as it needs a separate root directory.
zanieb added a commit that referenced this pull request Nov 7, 2024
…6370)

Uses #6369 for test coverage.

Updates version file discovery to search up into parent directories.
Also refactors Python request determination to avoid duplicating the
user request / version file / workspace lookup logic in every command
(this supersedes the work started in
#6372).

There is a bit of remaining work here, mostly around documentation.
There are some edge-cases where we don't use the refactored request
utility, like `uv build` — I'm not sure how I'm going to handle that yet
as it needs a separate root directory.
zanieb added a commit that referenced this pull request Nov 7, 2024
…6370)

Uses #6369 for test coverage.

Updates version file discovery to search up into parent directories.
Also refactors Python request determination to avoid duplicating the
user request / version file / workspace lookup logic in every command
(this supersedes the work started in
#6372).

There is a bit of remaining work here, mostly around documentation.
There are some edge-cases where we don't use the refactored request
utility, like `uv build` — I'm not sure how I'm going to handle that yet
as it needs a separate root directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants