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

Update the interface for declaring Python download preferences #5936

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Aug 8, 2024

The loose consensus is that "fetch" doesn't have much meaning and that a boolean flag makes more sense from the command line.

  1. Adds --allow-python-downloads (hidden, default) and --no-python-downloads to the CLI to quickly enable or disable downloads
  2. Deprecates --python-fetch in favor of the options from (1)
  3. Removes python-fetch in favor of a python-downloads setting
  4. Adds a never variant to the enum, allowing even explicit installs to be disabled via the configuration file

Test plan

I tested this with various pyproject.toml-level settings and uv venv --preview --python 3.12.2 and uv python install 3.12.2 with and without the new CLI flags.

@zanieb zanieb added configuration Settings and such preview Experimental behavior labels Aug 8, 2024
@zanieb
Copy link
Member Author

zanieb commented Aug 8, 2024

Notably I did not deprecate the python-fetch setting, just removed it. I'm not sure what the pattern is to deprecate a setting yet, nor am I sure it's worth the extra effort.

@zanieb
Copy link
Member Author

zanieb commented Aug 8, 2024

I'm a little uncertain of the "never" value, but I do think it has some utility to require explicit opt-in from the CLI to install versions.

@zanieb zanieb force-pushed the zb/python-downloads branch 2 times, most recently from 810f94f to f27202b Compare August 8, 2024 21:59
@zanieb zanieb marked this pull request as ready for review August 8, 2024 22:00
@zanieb
Copy link
Member Author

zanieb commented Aug 8, 2024

Whoops I checked in my pyproject.toml change, and look, it works https://github.com/astral-sh/uv/actions/runs/10310109626/job/28541254932?pr=5936

@charliermarsh
Copy link
Member

Thanks. Am I right that --python-downloads isn't exposed on the command line? So those settings are only available in a configuration file?

I'm wondering it it should be --download-python and --no-download-python to match settings like --compile-bytecode. Are we consistent with that pattern?

@zanieb
Copy link
Member Author

zanieb commented Aug 9, 2024

I leaned away from --download-python because it won't force Python to be downloaded, it just allows it if it would be, e.g. --python-preference only-system --download-python would still never download Python.

@zanieb
Copy link
Member Author

zanieb commented Aug 9, 2024

Am I right that --python-downloads isn't exposed on the command line? So those settings are only available in a configuration file?

Yes, only a boolean option is available from the command line and the "manual" value is only accessible via the configuration file. I find that a little peculiar, but don't think it'll be problematic in practice.

@zanieb zanieb merged commit 4df0fe9 into main Aug 9, 2024
57 checks passed
@zanieb zanieb deleted the zb/python-downloads branch August 9, 2024 18:10
zanieb added a commit that referenced this pull request Aug 9, 2024
The loose consensus is that "fetch" doesn't have much meaning and that a
boolean flag makes more sense from the command line.

1. Adds `--allow-python-downloads` (hidden, default) and
`--no-python-downloads` to the CLI to quickly enable or disable
downloads
2. Deprecates `--python-fetch` in favor of the options from (1)
3. Removes  `python-fetch` in favor of a `python-downloads` setting
5. Adds a `never` variant to the enum, allowing even explicit installs
to be disabled via the configuration file

I tested this with various `pyproject.toml`-level settings and `uv venv
--preview --python 3.12.2` and `uv python install 3.12.2` with and
without the new CLI flags.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Settings and such preview Experimental behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants