Skip to content

Commit

Permalink
nox pip-compile: allow passing --no-upgrade flag (#883)
Browse files Browse the repository at this point in the history
* nox pip-compile: allow passing --no-upgrade flag

This allows running `nox -e pip-compile -- --no-upgrade` to make sure
that the requirements.txt files are in sync with the .in files but not
updating any other transitive dependency.

* README: make "## Updating dependencies" more concise

Co-authored-by: Don Naro <dnaro@redhat.com>

---------

(cherry picked from commit e952dd4)

Co-authored-by: Don Naro <dnaro@redhat.com>
  • Loading branch information
gotmax23 and oraNod committed Dec 4, 2023
1 parent 471ce0b commit 2c1cd93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 2c1cd93

Please sign in to comment.