Skip to content
This repository was archived by the owner on Aug 19, 2022. It is now read-only.

Removal nox-poetry #308

Merged
merged 2 commits into from
Jun 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pip==20.3.3
nox==2020.12.31
poetry==1.1.4
nox-poetry==0.7.1
virtualenv==20.4.0
pip==21.1.2
nox==2021.6.12
nox-poetry==0.8.6
poetry==1.1.6
virtualenv==20.4.7
35 changes: 22 additions & 13 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,21 @@
from textwrap import dedent

import nox
import nox_poetry.patch
from nox.sessions import Session

try:
from nox_poetry import Session
from nox_poetry import session
except ImportError:
message = f"""\
Nox failed to import the 'nox-poetry' package.
Please install it using the following command:
{sys.executable} -m pip install nox-poetry"""
raise SystemExit(dedent(message))


package = "django_sorting_bootstrap"
python_versions = ["3.9", "3.8", "3.7"]
nox.needs_version = ">= 2021.6.6"
nox.options.sessions = (
"pre-commit",
"safety",
Expand Down Expand Up @@ -72,7 +81,7 @@ def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
hook.write_text("\n".join(lines))


@nox.session(name="pre-commit", python="3.9")
@session(name="pre-commit", python="3.9")
def precommit(session: Session) -> None:
"""Lint using pre-commit."""
args = session.posargs or ["run", "--all-files", "--show-diff-on-failure"]
Expand All @@ -94,15 +103,15 @@ def precommit(session: Session) -> None:
activate_virtualenv_in_precommit_hooks(session)


@nox.session(python="3.9")
@session(python="3.9")
def safety(session: Session) -> None:
"""Scan dependencies for insecure packages."""
requirements = nox_poetry.export_requirements(session)
requirements = session.poetry.export_requirements()
session.install("safety")
session.run("safety", "check", f"--file={requirements}", "--bare")
session.run("safety", "check", "--full-report", f"--file={requirements}")


@nox.session(python=python_versions)
@session(python=python_versions)
def mypy(session: Session) -> None:
"""Type-check using mypy."""
args = session.posargs or ["src", "tests", "docs/conf.py"]
Expand All @@ -113,7 +122,7 @@ def mypy(session: Session) -> None:
session.run("mypy", f"--python-executable={sys.executable}", "noxfile.py")


@nox.session(python=python_versions)
@session(python=python_versions)
def tests(session: Session) -> None:
"""Run the test suite."""
session.install(".")
Expand All @@ -125,7 +134,7 @@ def tests(session: Session) -> None:
session.notify("coverage")


@nox.session
@session
def coverage(session: Session) -> None:
"""Produce the coverage report."""
# Do not use session.posargs unless this is the only session.
Expand All @@ -140,15 +149,15 @@ def coverage(session: Session) -> None:
session.run("coverage", *args)


@nox.session(python=python_versions)
@session(python=python_versions)
def typeguard(session: Session) -> None:
"""Runtime type checking using Typeguard."""
session.install(".")
session.install("pytest", "pytest-django", "typeguard", "pygments")
session.run("pytest", f"--typeguard-packages={package}", *session.posargs)


@nox.session(python=python_versions)
@session(python=python_versions)
def xdoctest(session: Session) -> None:
"""Run examples with xdoctest."""
args = session.posargs or ["all"]
Expand All @@ -157,7 +166,7 @@ def xdoctest(session: Session) -> None:
session.run("python", "-m", "xdoctest", package, *args)


@nox.session(name="docs-build", python="3.9")
@session(name="docs-build", python="3.9")
def docs_build(session: Session) -> None:
"""Build the documentation."""
args = session.posargs or ["docs", "docs/_build"]
Expand All @@ -171,7 +180,7 @@ def docs_build(session: Session) -> None:
session.run("sphinx-build", *args)


@nox.session(python="3.9")
@session(python="3.9")
def docs(session: Session) -> None:
"""Build and serve the documentation with live reloading on file changes."""
args = session.posargs or ["--open-browser", "docs", "docs/_build"]
Expand Down
Loading