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

Commit 54d52c9

Browse files
author
Thiago
authored
Merge pull request #308 from staticdev/removal-nox-poetry
Removal nox-poetry
2 parents cfdedd2 + 2fcb2be commit 54d52c9

File tree

4 files changed

+398
-448
lines changed

4 files changed

+398
-448
lines changed

.github/workflows/constraints.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
pip==20.3.3
2-
nox==2020.12.31
3-
poetry==1.1.4
4-
nox-poetry==0.7.1
5-
virtualenv==20.4.0
1+
pip==21.1.2
2+
nox==2021.6.12
3+
nox-poetry==0.8.6
4+
poetry==1.1.6
5+
virtualenv==20.4.7

noxfile.py

+22-13
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,21 @@
55
from textwrap import dedent
66

77
import nox
8-
import nox_poetry.patch
9-
from nox.sessions import Session
8+
9+
try:
10+
from nox_poetry import Session
11+
from nox_poetry import session
12+
except ImportError:
13+
message = f"""\
14+
Nox failed to import the 'nox-poetry' package.
15+
Please install it using the following command:
16+
{sys.executable} -m pip install nox-poetry"""
17+
raise SystemExit(dedent(message))
1018

1119

1220
package = "django_sorting_bootstrap"
1321
python_versions = ["3.9", "3.8", "3.7"]
22+
nox.needs_version = ">= 2021.6.6"
1423
nox.options.sessions = (
1524
"pre-commit",
1625
"safety",
@@ -72,7 +81,7 @@ def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
7281
hook.write_text("\n".join(lines))
7382

7483

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

96105

97-
@nox.session(python="3.9")
106+
@session(python="3.9")
98107
def safety(session: Session) -> None:
99108
"""Scan dependencies for insecure packages."""
100-
requirements = nox_poetry.export_requirements(session)
109+
requirements = session.poetry.export_requirements()
101110
session.install("safety")
102-
session.run("safety", "check", f"--file={requirements}", "--bare")
111+
session.run("safety", "check", "--full-report", f"--file={requirements}")
103112

104113

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

115124

116-
@nox.session(python=python_versions)
125+
@session(python=python_versions)
117126
def tests(session: Session) -> None:
118127
"""Run the test suite."""
119128
session.install(".")
@@ -125,7 +134,7 @@ def tests(session: Session) -> None:
125134
session.notify("coverage")
126135

127136

128-
@nox.session
137+
@session
129138
def coverage(session: Session) -> None:
130139
"""Produce the coverage report."""
131140
# Do not use session.posargs unless this is the only session.
@@ -140,15 +149,15 @@ def coverage(session: Session) -> None:
140149
session.run("coverage", *args)
141150

142151

143-
@nox.session(python=python_versions)
152+
@session(python=python_versions)
144153
def typeguard(session: Session) -> None:
145154
"""Runtime type checking using Typeguard."""
146155
session.install(".")
147156
session.install("pytest", "pytest-django", "typeguard", "pygments")
148157
session.run("pytest", f"--typeguard-packages={package}", *session.posargs)
149158

150159

151-
@nox.session(python=python_versions)
160+
@session(python=python_versions)
152161
def xdoctest(session: Session) -> None:
153162
"""Run examples with xdoctest."""
154163
args = session.posargs or ["all"]
@@ -157,7 +166,7 @@ def xdoctest(session: Session) -> None:
157166
session.run("python", "-m", "xdoctest", package, *args)
158167

159168

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

173182

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

0 commit comments

Comments
 (0)