Pin MAIN_PYTHON in the "init-project" session
Otherwise, `uv` creates ".venv" with the newest installed Python.
This commit is contained in:
parent
67917ae3f6
commit
df53ce7bc4
1 changed files with 12 additions and 3 deletions
15
noxfile.py
15
noxfile.py
|
|
@ -17,7 +17,7 @@ Further sessions run on demand with `uv run nox -s <session>`:
|
||||||
- "deps-lock": Lock dependencies after manual changes in pyproject.toml
|
- "deps-lock": Lock dependencies after manual changes in pyproject.toml
|
||||||
- "deps-upgrade": Upgrade dependencies within their allowed ranges
|
- "deps-upgrade": Upgrade dependencies within their allowed ranges
|
||||||
- "deps-upgrade-check": Show newer versions and the age of all pinned releases
|
- "deps-upgrade-check": Show newer versions and the age of all pinned releases
|
||||||
- "init-project": Install the `pre-commit` hooks and configure `git blame`
|
- "init-project": Set up a freshly cloned project
|
||||||
- "clean-cwd": Run approx. `git clean -X` with minor exceptions
|
- "clean-cwd": Run approx. `git clean -X` with minor exceptions
|
||||||
- "verify-db-objects": Compare a live database with the ORM models
|
- "verify-db-objects": Compare a live database with the ORM models
|
||||||
|
|
||||||
|
|
@ -540,7 +540,16 @@ def check_dependency_upgrades(session: nox.Session) -> None:
|
||||||
|
|
||||||
@nox.session(name="init-project", python=MAIN_PYTHON, venv_backend="none")
|
@nox.session(name="init-project", python=MAIN_PYTHON, venv_backend="none")
|
||||||
def initialize_project(session: nox.Session) -> None:
|
def initialize_project(session: nox.Session) -> None:
|
||||||
"""Install the `pre-commit` hooks and configure `git blame`."""
|
"""Set up a freshly cloned project.
|
||||||
|
|
||||||
|
This does the following:
|
||||||
|
- Pin the `MAIN_PYTHON` for `uv`
|
||||||
|
- Install the `pre-commit` hooks
|
||||||
|
- Configure `git blame`
|
||||||
|
"""
|
||||||
|
# Without a ".python-version" file, `uv` picks the newest installed Python
|
||||||
|
session.run("uv", "python", "pin", MAIN_PYTHON)
|
||||||
|
|
||||||
# .pre-commit-config.yaml sets the hook types via "default_install_hook_types"
|
# .pre-commit-config.yaml sets the hook types via "default_install_hook_types"
|
||||||
session.run("uv", "run", "pre-commit", "install")
|
session.run("uv", "run", "pre-commit", "install")
|
||||||
|
|
||||||
|
|
@ -559,7 +568,7 @@ def clean_cwd(session: nox.Session) -> None:
|
||||||
"""Remove (almost) all glob patterns listed in git's ignore file.
|
"""Remove (almost) all glob patterns listed in git's ignore file.
|
||||||
|
|
||||||
Compared to `git clean -X`, never remove local environment variables
|
Compared to `git clean -X`, never remove local environment variables
|
||||||
in the ".env" and ".envrc" files, pyenv's ".python-version" file,
|
in the ".env" and ".envrc" files, the ".python-version" file,
|
||||||
and the local develop environment in ".venv".
|
and the local develop environment in ".venv".
|
||||||
|
|
||||||
An existing ".cache/" folder is always deleted first.
|
An existing ".cache/" folder is always deleted first.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue