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

Have noxfile.py install dependencies for itself #414

Open
mikeholler opened this issue Apr 9, 2021 · 2 comments · May be fixed by #881
Open

Have noxfile.py install dependencies for itself #414

mikeholler opened this issue Apr 9, 2021 · 2 comments · May be fixed by #881

Comments

@mikeholler
Copy link

How would this feature be useful?

Nox has sessions that create virtualenvs, but nox itself executes using the environment available to the system. It would be nice if we could have as predictable an environment for the nox buildscript as we have for each session.

Describe the solution you'd like

Have a second file, noxfile-settings.py that nox executes if present to create an environment for noxfile.py to run in. The contents of the file might look something like this:

from nox.settings import noxfile_session

noxfile_settings.install("GitPython==3.1.14")

Then, in noxfile.py, a user can have a script that calls from git import Repo and feel confident that they are using the same version of GitPython as other developers.

Note: The settings.gradle files and buildscript { ... } blocks from Gradle are examples of another build system doing this kind of thing.

Describe alternatives you've considered

As far as I know there are no workarounds or allowances for this.

@henryiii
Copy link
Collaborator

I'd probably put something like this in a non-Python file, say pyproject.toml under [tool.nox] requires=["GitPython==3.1.14"], etc. Sounds like it would be a rather large change, though, since nox would need to run nox in an venv. You'd probably want to control/customize that venv, etc...

@crwilcox
Copy link
Collaborator

crwilcox commented Jun 8, 2022

Is there a scenario where requirements-dev.txt would be different from the version of GitPython you would need for nox?

As a pattern, I tend to have a venv per project I work on, so nox already is in a venv, but just shared with the project I work on.

I think there may be a more particular corner case worth describing here?

@henryiii henryiii linked a pull request Oct 31, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants