Skip to content

Commit

Permalink
Update noxfile.py
Browse files Browse the repository at this point in the history
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
  • Loading branch information
oraNod and webknjaz authored Feb 28, 2024
1 parent 8f86a68 commit da352c2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ def pip_compile(session: nox.Session):
session.install("pip-tools >= 7")

# Use --upgrade by default unless a user passes -P.
args = list(session.posargs)
if not any(
arg.startswith(("-P", "--upgrade-package", "--no-upgrade")) for arg in args
):
args.append("--upgrade")
upgrade_related_cli_flags = "-P", "--upgrade-package", "--no-upgrade"
has_upgrade_related_cli_flags = any(
arg.startswith(upgrade_related_cli_flags)
for arg in session.posargs
)
injected_extra_cli_args = () if has_upgrade_related_cli_flags else ("--upgrade",)

session.run(
"pip-compile",
"--output-file",
f"requirements.txt",
*args,
*session.posargs,
*injected_extra_cli_args,
f"requirements.in",
)

Expand Down

0 comments on commit da352c2

Please sign in to comment.