Skip to content

Commit d1914d8

Browse files
committed
Tidy pyproject.toml
1 parent 4725b59 commit d1914d8

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

.github/workflows/python-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
4848
- name: "Run tests and coverage via nox"
4949
run: |
50-
nox --session tests_with_coverage-${{ matrix.python-version }}
50+
nox --session version_coverage-${{ matrix.python-version }}
5151
5252
- name: "Save coverage artifact"
5353
uses: "actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b"
@@ -82,7 +82,7 @@ jobs:
8282

8383
- name: "Compile coverage data, print report"
8484
run: |
85-
nox --session coverage_combine_and_report
85+
nox --session coverage_combine
8686
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
8787
echo "TOTAL=$TOTAL" >> $GITHUB_ENV
8888
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY
@@ -105,4 +105,4 @@ jobs:
105105
106106
- name: "Enforce strict type annotations with mypy"
107107
run: |
108-
nox --session mypy_check
108+
nox --session mypy

noxfile.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
COVERAGE_FAIL_UNDER = 50
1414
DEFAULT_PYTHON_VERSION = "3.12"
1515
PYTHON_MATRIX = ["3.9", "3.10", "3.11", "3.12", "3.13"]
16-
VENV_PATH = "venv"
16+
VENV_BACKEND = "venv"
17+
VENV_PATH = ".venv"
1718
REQUIREMENT_IN_FILES = [
1819
pathlib.Path("requirements/requirements.in"),
1920
]
@@ -36,23 +37,23 @@
3637

3738
# Define the default sessions run when `nox` is called on the CLI
3839
nox.options.sessions = [
39-
"tests_with_coverage",
40-
"coverage_combine_and_report",
41-
"mypy_check",
40+
"version_coverage",
41+
"coverage_combine",
42+
"mypy",
4243
]
4344

4445

45-
@nox.session(python=PYTHON_MATRIX)
46-
def tests_with_coverage(session: nox.Session) -> None:
46+
@nox.session(python=PYTHON_MATRIX, venv_backend=VENV_BACKEND)
47+
def version_coverage(session: nox.Session) -> None:
4748
"""Run unit tests with coverage saved to partial file."""
4849
print_standard_logs(session)
4950

5051
session.install(".[test]")
5152
session.run("coverage", "run", "-p", "-m", "pytest", TESTS_PATH)
5253

5354

54-
@nox.session(python=DEFAULT_PYTHON_VERSION)
55-
def coverage_combine_and_report(session: nox.Session) -> None:
55+
@nox.session(python=DEFAULT_PYTHON_VERSION, venv_backend=VENV_BACKEND)
56+
def coverage_combine(session: nox.Session) -> None:
5657
"""Combine all coverage partial files and generate JSON report."""
5758
print_standard_logs(session)
5859

@@ -64,8 +65,8 @@ def coverage_combine_and_report(session: nox.Session) -> None:
6465
session.run("python", "-m", "coverage", "json")
6566

6667

67-
@nox.session(python=DEFAULT_PYTHON_VERSION)
68-
def mypy_check(session: nox.Session) -> None:
68+
@nox.session(python=DEFAULT_PYTHON_VERSION, venv_backend=VENV_BACKEND)
69+
def mypy(session: nox.Session) -> None:
6970
"""Run mypy against package and all required dependencies."""
7071
print_standard_logs(session)
7172

@@ -74,15 +75,15 @@ def mypy_check(session: nox.Session) -> None:
7475
session.run("mypy", "-p", MODULE_NAME, "--no-incremental")
7576

7677

77-
@nox.session(python=False)
78+
@nox.session(python=False, venv_backend=VENV_BACKEND)
7879
def coverage(session: nox.Session) -> None:
7980
"""Generate a coverage report. Does not use a venv."""
8081
session.run("coverage", "erase")
8182
session.run("coverage", "run", "-m", "pytest", TESTS_PATH)
8283
session.run("coverage", "report", "-m")
8384

8485

85-
@nox.session(python=DEFAULT_PYTHON_VERSION)
86+
@nox.session(python=DEFAULT_PYTHON_VERSION, venv_backend=VENV_BACKEND)
8687
def build(session: nox.Session) -> None:
8788
"""Build distribution files."""
8889
print_standard_logs(session)
@@ -91,7 +92,7 @@ def build(session: nox.Session) -> None:
9192
session.run("python", "-m", "build")
9293

9394

94-
@nox.session(python=False)
95+
@nox.session(python=False, venv_backend=VENV_BACKEND)
9596
def install(session: nox.Session) -> None:
9697
"""Setup a development environment. Uses active venv if available, builds one if not."""
9798
# Use the active environement if it exists, otherwise create a new one
@@ -116,7 +117,7 @@ def install(session: nox.Session) -> None:
116117
session.log(f"\n\nRun '{activate_command}' to enter the virtual environment.\n")
117118

118119

119-
@nox.session(python=DEFAULT_PYTHON_VERSION)
120+
@nox.session(python=DEFAULT_PYTHON_VERSION, venv_backend=VENV_BACKEND)
120121
def update(session: nox.Session) -> None:
121122
"""Process requirement*.in files, updating only additions/removals."""
122123
print_standard_logs(session)
@@ -126,7 +127,7 @@ def update(session: nox.Session) -> None:
126127
session.run("pip-compile", "--no-emit-index-url", str(filename))
127128

128129

129-
@nox.session(python=DEFAULT_PYTHON_VERSION)
130+
@nox.session(python=DEFAULT_PYTHON_VERSION, venv_backend=VENV_BACKEND)
130131
def upgrade(session: nox.Session) -> None:
131132
"""Process requirement*.in files and upgrade all libraries as possible."""
132133
print_standard_logs(session)
@@ -136,7 +137,7 @@ def upgrade(session: nox.Session) -> None:
136137
session.run("pip-compile", "--no-emit-index-url", "--upgrade", str(filename))
137138

138139

139-
@nox.session(python=False)
140+
@nox.session(python=False, venv_backend=VENV_BACKEND)
140141
def clean(_: nox.Session) -> None:
141142
"""Clean cache, .pyc, .pyo, and test/build artifact files from project."""
142143
count = 0

0 commit comments

Comments
 (0)