Skip to content

Commit 765a385

Browse files
authored
Switch to nox (#954)
1 parent df983f9 commit 765a385

File tree

5 files changed

+82
-80
lines changed

5 files changed

+82
-80
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
PYTHON:
17-
- {VERSION: "3.8", TOXENV: "py38"}
18-
- {VERSION: "3.13", TOXENV: "py313"}
19-
- {VERSION: "3.13t", TOXENV: "py313"}
17+
- {VERSION: "3.8", NOXSESSION: "tests"}
18+
- {VERSION: "3.13", NOXSESSION: "tests"}
19+
- {VERSION: "3.13t", NOXSESSION: "tests"}
2020
MACOS:
2121
- macos-13
2222
- macos-latest
@@ -38,10 +38,10 @@ jobs:
3838
~/.cargo/git/db/
3939
src/_bcrypt/target/
4040
key: ${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
41-
- run: pip install tox
42-
- run: tox
41+
- run: pip install nox
42+
- run: nox -v
4343
env:
44-
TOXENV: ${{ matrix.PYTHON.TOXENV }}
44+
NOXSESSION: ${{ matrix.PYTHON.NOXSESSION }}
4545
CARGO_TARGET_DIR: ${{ format('{0}/src/_bcrypt/target/', github.workspace) }}
4646

4747
windows:
@@ -52,9 +52,9 @@ jobs:
5252
- {ARCH: 'x86', WINDOWS: 'win32', RUST_TRIPLE: 'i686-pc-windows-msvc'}
5353
- {ARCH: 'x64', WINDOWS: 'win64', RUST_TRIPLE: 'x86_64-pc-windows-msvc'}
5454
PYTHON:
55-
- {VERSION: "3.8", TOXENV: "py38"}
56-
- {VERSION: "3.13", TOXENV: "py313"}
57-
- {VERSION: "3.13t", TOXENV: "py313"}
55+
- {VERSION: "3.8", NOXSESSION: "tests"}
56+
- {VERSION: "3.13", NOXSESSION: "tests"}
57+
- {VERSION: "3.13t", NOXSESSION: "tests"}
5858
name: "Python ${{ matrix.PYTHON.VERSION }} on ${{ matrix.WINDOWS.WINDOWS }}"
5959
steps:
6060
- uses: actions/[email protected]
@@ -76,32 +76,32 @@ jobs:
7676
src/_bcrypt/target/
7777
key: ${{ runner.os }}-${{ matrix.WINDOWS.ARCH }}-${{ steps.setup-python.outputs.python-version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
7878

79-
- run: pip install tox
80-
- run: tox
79+
- run: pip install nox
80+
- run: nox -v
8181
env:
82-
TOXENV: ${{ matrix.PYTHON.TOXENV }}
82+
NOXSESSION: ${{ matrix.PYTHON.NOXSESSION }}
8383
CARGO_TARGET_DIR: ${{ format('{0}/src/_bcrypt/target/', github.workspace) }}
8484
linux:
8585
runs-on: ubuntu-22.04
8686
strategy:
8787
matrix:
8888
PYTHON:
89-
- {VERSION: "3.13", TOXENV: "pep8,packaging"}
90-
- {VERSION: "3.13", TOXENV: "mypy"}
91-
- {VERSION: "3.8", TOXENV: "py38"}
92-
- {VERSION: "3.9", TOXENV: "py39"}
93-
- {VERSION: "3.10", TOXENV: "py310"}
94-
- {VERSION: "3.11", TOXENV: "py311"}
95-
- {VERSION: "3.12", TOXENV: "py312"}
96-
- {VERSION: "3.13", TOXENV: "py313"}
97-
- {VERSION: "3.13t", TOXENV: "py313"}
98-
- {VERSION: "pypy-3.9", TOXENV: "pypy3"}
99-
- {VERSION: "pypy-3.10", TOXENV: "pypy3"}
89+
- {VERSION: "3.13", NOXSESSION: "pep8,packaging"}
90+
- {VERSION: "3.13", NOXSESSION: "mypy"}
91+
- {VERSION: "3.8", NOXSESSION: "tests"}
92+
- {VERSION: "3.9", NOXSESSION: "tests"}
93+
- {VERSION: "3.10", NOXSESSION: "tests"}
94+
- {VERSION: "3.11", NOXSESSION: "tests"}
95+
- {VERSION: "3.12", NOXSESSION: "tests"}
96+
- {VERSION: "3.13", NOXSESSION: "tests"}
97+
- {VERSION: "3.13t", NOXSESSION: "tests"}
98+
- {VERSION: "pypy-3.9", NOXSESSION: "tests"}
99+
- {VERSION: "pypy-3.10", NOXSESSION: "tests"}
100100

101101
# MSRV
102-
- {VERSION: "3.13", TOXENV: "py313", RUST_VERSION: "1.64.0"}
103-
- {VERSION: "3.13", TOXENV: "py313", RUST_VERSION: "beta"}
104-
- {VERSION: "3.13", TOXENV: "py313", RUST_VERSION: "nightly"}
102+
- {VERSION: "3.13", NOXSESSION: "tests", RUST_VERSION: "1.64.0"}
103+
- {VERSION: "3.13", NOXSESSION: "tests", RUST_VERSION: "beta"}
104+
- {VERSION: "3.13", NOXSESSION: "tests", RUST_VERSION: "nightly"}
105105
name: "${{ matrix.PYTHON.VERSION }} on linux, Rust ${{ matrix.PYTHON.RUST_VERSION || 'stable' }}"
106106
steps:
107107
- uses: actions/[email protected]
@@ -125,10 +125,10 @@ jobs:
125125
with:
126126
toolchain: ${{ matrix.PYTHON.RUST_VERSION || 'stable' }}
127127

128-
- run: pip install tox
129-
- run: tox
128+
- run: pip install nox
129+
- run: nox -v
130130
env:
131-
TOXENV: ${{ matrix.PYTHON.TOXENV }}
131+
NOXSESSION: ${{ matrix.PYTHON.NOXSESSION }}
132132
CARGO_TARGET_DIR: ${{ format('{0}/src/_bcrypt/target/', github.workspace) }}
133133

134134
linux-distros:
@@ -137,10 +137,10 @@ jobs:
137137
strategy:
138138
matrix:
139139
IMAGE:
140-
- {IMAGE: "alpine", TOXENV: "py312", RUNNER: "ubuntu-latest"}
141-
- {IMAGE: "alpine:aarch64", TOXENV: "py312", RUNNER: [self-hosted, Linux, ARM64]}
142-
- {IMAGE: "ubuntu-rolling:aarch64", TOXENV: "py312", RUNNER: [self-hosted, Linux, ARM64]}
143-
name: "${{ matrix.IMAGE.TOXENV }} on ${{ matrix.IMAGE.IMAGE }}"
140+
- {IMAGE: "alpine", NOXSESSION: "tests", RUNNER: "ubuntu-latest"}
141+
- {IMAGE: "alpine:aarch64", NOXSESSION: "tests", RUNNER: [self-hosted, Linux, ARM64]}
142+
- {IMAGE: "ubuntu-rolling:aarch64", NOXSESSION: "tests", RUNNER: [self-hosted, Linux, ARM64]}
143+
name: "${{ matrix.IMAGE.NOXSESSION }} on ${{ matrix.IMAGE.IMAGE }}"
144144
steps:
145145
- name: Ridiculous alpine workaround for actions support on arm64
146146
run: |
@@ -153,10 +153,10 @@ jobs:
153153
- uses: actions/[email protected]
154154
with:
155155
persist-credentials: false
156-
- run: /venv/bin/pip install tox
157-
- run: '/venv/bin/tox'
156+
- run: /venv/bin/pip install nox
157+
- run: /venv/bin/nox -v
158158
env:
159-
TOXENV: ${{ matrix.IMAGE.TOXENV }}
159+
NOXSESSION: ${{ matrix.IMAGE.NOXSESSION }}
160160
RUSTUP_HOME: /root/.rustup
161161
CARGO_TARGET_DIR: ${{ format('{0}/src/_bcrypt/target/', github.workspace) }}
162162

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ include LICENSE README.rst
22

33
include pyproject.toml
44

5-
include tox.ini .coveragerc
5+
include noxfile.py .coveragerc
66

77
recursive-include src py.typed *.pyi
88
recursive-include src/_bcrypt Cargo.toml Cargo.lock *.rs

noxfile.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import nox
2+
3+
nox.options.reuse_existing_virtualenvs = True
4+
nox.options.default_venv_backend = "uv|virtualenv"
5+
6+
7+
@nox.session
8+
def tests(session: nox.Session) -> None:
9+
session.install("coverage")
10+
session.install(".[tests]")
11+
12+
session.run(
13+
"coverage", "run", "-m", "pytest", "--strict-markers", *session.posargs
14+
)
15+
session.run("coverage", "combine")
16+
session.run("coverage", "report", "-m", "--fail-under", "100")
17+
18+
19+
@nox.session
20+
def pep8(session: nox.Session) -> None:
21+
session.install("ruff")
22+
23+
session.run("ruff", "check", ".")
24+
session.run("ruff", "format", "--check", ".")
25+
26+
27+
@nox.session
28+
def mypy(session: nox.Session) -> None:
29+
session.install("mypy")
30+
session.install(".[tests]")
31+
32+
session.run("mypy", "tests/")
33+
34+
35+
@nox.session
36+
def packaging(session: nox.Session) -> None:
37+
session.install("setuptools-rust", "check-manifest", "readme_renderer")
38+
39+
session.run("check-manifest")
40+
session.run(
41+
"python3", "-m", "readme_renderer", "README.rst", "-o", "/dev/null"
42+
)

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ warn_redundant_casts = true
7272
warn_unused_ignores = true
7373
warn_unused_configs = true
7474
strict_equality = true
75+
76+
[tool.check-manifest]
77+
ignore = ["tests/reference/*"]

tox.ini

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)