Skip to content

Commit

Permalink
add pip compile session
Browse files Browse the repository at this point in the history
  • Loading branch information
oraNod committed Feb 28, 2024
1 parent 549e3a1 commit 8f86a68
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
import nox


@nox.session(name="pip-compile", python=["3.11"])
def pip_compile(session: nox.Session):
# .pip-tools.toml was introduced in v7
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")

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


@nox.session
def build(session: nox.Session):
session.install(
"-r", "requirements.in",
"-c", "requirements.txt",
"-r",
"requirements.in",
"-c",
"requirements.txt",
)
session.run("python", "-I", "build.py", *session.posargs)

0 comments on commit 8f86a68

Please sign in to comment.