diff --git a/README.md b/README.md index f4e6ace797e..0364ea347c2 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,12 @@ Use the following `nox` session to update the dependency lock files in `tests/`. nox -e pip-compile ``` +To synchronize dependency lock files with base requirements files without changing transitive dependencies, use the `--no-upgrade` flag: + + ``` bash + nox -e pip-compile -- --no-upgrade + ``` + > This session requires Python 3.10. If you do not have Python 3.10 installed, you can use root-less podman with a Python 3.10 image as follows: diff --git a/noxfile.py b/noxfile.py index bc673dfff13..850045dbb9a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -96,7 +96,7 @@ def pip_compile(session: nox.Session, req: str): # Use --upgrade by default unless a user passes -P. args = list(session.posargs) if not any( - arg.startswith("-P") or arg.startswith("--upgrade-package") for arg in args + arg.startswith(("-P", "--upgrade-package", "--no-upgrade")) for arg in args ): args.append("--upgrade")