Skip to content

Conversation

saucoide
Copy link
Contributor

@saucoide saucoide commented Jul 7, 2025

Adding a --download-python / NOX_DOWNLOAD_PYTHON option to control the behavior of uv installing python, and introducing nox-installed pythons via pbs-installer for venv/virtualenv backends

The options are "auto" (default), "always" and "never".

  • "auto" will first check for a pre-existing installation, and fall back to installing with pbs-installer (or uv in uv venv_backends)
  • "always" will ignore system pythons and always try to install
  • "never" will only use pre-existing python installs

this was discussed here #842 (comment) but i didnt have time until now, also this issue #944

I am not super confident this is a good idea in the end or not, the default "auto" behavior might be surprising if you use venv/virtualenv backend (could be considered breaking in some cases) like it happened when uv started installing python if missing and people did not expect it

and there is still an issue with windows that this would not fix but might help having the opt out #986

still todo:

  • script-mode test breaks - locally, works on ci?
  • coverage
  • documentation
  • a bunch more broken tests on ci
  • windows install paths are not handled correctly

Adding a --download-python / NOX_DOWNLOAD_PYTHON option to control the
behavior of uv installing python, and introducing nox-installed pythons
via pbs-installer for venv/virtualenv backends

The options are "auto" (default), "always" and "never".

- "auto" will first check for a pre-existing installation, and fall
  back to installing with pbs-installer (or uv in uv venv_backends)
- "always" will ignore system pythons and always try to install
- "never" will only use pre-existing python installs
@saucoide
Copy link
Contributor Author

saucoide commented Jul 7, 2025

@ dependencies, i'm not sure if to add the pbs-installer as an optional and have the whole behavior also depend on that, or if to add it by default

@saucoide
Copy link
Contributor Author

saucoide commented Jul 7, 2025

I'm also unsure about what to do with conda environments, right now they behave like if it was set to "always" and probably doesn't make sense to change it, but it'd be weird the option doesn't apply to them

@saucoide
Copy link
Contributor Author

saucoide commented Jul 9, 2025

no idea why this is producing an ungodly amount of logs, I haven't been able to reproduce the CI errors both on ubuntu & macos, pbs_installer fails in ubuntu when trying to install python 3.7, but it does not look anything like in ci :/

@henryiii
Copy link
Collaborator

I was just mentioning this here at SciPy, thanks! :)

We have an issue with logs where it dumps logging closed messages. It's test specific, I think, possibly due to nox running nox. We've never managed to hunt down the root cause.

@saucoide
Copy link
Contributor Author

@henryiii do you think we should skip conda for this completely or try to have this toggle also control it? looks like it has always had its own separate behavior so i'm not sure

@saucoide saucoide force-pushed the nox-download-python branch from 5398308 to f6686c8 Compare July 22, 2025 08:41
@henryiii
Copy link
Collaborator

I think conda already always installs Python, and it is isolated, so I think it makes sense to only have this affect PyPI.

@saucoide saucoide changed the title draft: Add --download-python python option Add --download-python python option Aug 7, 2025
@saucoide
Copy link
Contributor Author

@henryiii i think this is ready to review now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants