Skip to content

Switch from tox to nox #1436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 10, 2025
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
89 changes: 44 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,55 +11,54 @@ jobs:
matrix:
PYTHON:
# Base builds
- {VERSION: "3.7", TOXENV: "py37"}
- {VERSION: "3.8", TOXENV: "py38"}
- {VERSION: "3.9", TOXENV: "py39"}
- {VERSION: "3.10", TOXENV: "py310"}
- {VERSION: "3.11", TOXENV: "py311"}
- {VERSION: "3.12", TOXENV: "py312"}
- {VERSION: "3.13-dev", TOXENV: "py313"}
- {VERSION: "pypy-3.9", TOXENV: "pypy3"}
- {VERSION: "pypy-3.10", TOXENV: "pypy3"}
- {VERSION: "3.11", TOXENV: "py311-useWheel", OS: "windows-2022" }
# -cryptographyMain
- {VERSION: "3.8", TOXENV: "py38-cryptographyMain"}
- {VERSION: "3.9", TOXENV: "py39-cryptographyMain"}
- {VERSION: "3.10", TOXENV: "py310-cryptographyMain"}
- {VERSION: "3.11", TOXENV: "py311-cryptographyMain"}
- {VERSION: "3.12", TOXENV: "py312-cryptographyMain"}
- {VERSION: "3.13-dev", TOXENV: "py313-cryptographyMain"}
- {VERSION: "pypy-3.9", TOXENV: "pypy3-cryptographyMain"}
- {VERSION: "pypy-3.10", TOXENV: "pypy3-cryptographyMain"}
# -cryptographyMinimum
- {VERSION: "3.7", TOXENV: "py37-cryptographyMinimum"}
- {VERSION: "3.8", TOXENV: "py38-cryptographyMinimum"}
- {VERSION: "3.9", TOXENV: "py39-cryptographyMinimum"}
- {VERSION: "3.10", TOXENV: "py310-cryptographyMinimum"}
- {VERSION: "3.11", TOXENV: "py311-cryptographyMinimum"}
- {VERSION: "3.12", TOXENV: "py312-cryptographyMinimum"}
- {VERSION: "3.13-dev", TOXENV: "py313-cryptographyMinimum"}
- {VERSION: "pypy-3.10", TOXENV: "pypy3-cryptographyMinimum"}
- {VERSION: "3.7", NOXSESSION: "tests"}
- {VERSION: "3.8", NOXSESSION: "tests"}
- {VERSION: "3.9", NOXSESSION: "tests"}
- {VERSION: "3.10", NOXSESSION: "tests"}
- {VERSION: "3.11", NOXSESSION: "tests"}
- {VERSION: "3.12", NOXSESSION: "tests"}
- {VERSION: "3.13-dev", NOXSESSION: "tests"}
- {VERSION: "pypy-3.9", NOXSESSION: "tests"}
- {VERSION: "pypy-3.10", NOXSESSION: "tests"}
- {VERSION: "3.11", NOXSESSION: "tests-wheel", OS: "windows-2022"}
# -cryptography-main
- {VERSION: "3.8", NOXSESSION: "tests-cryptography-main"}
- {VERSION: "3.9", NOXSESSION: "tests-cryptography-main"}
- {VERSION: "3.10", NOXSESSION: "tests-cryptography-main"}
- {VERSION: "3.11", NOXSESSION: "tests-cryptography-main"}
- {VERSION: "3.12", NOXSESSION: "tests-cryptography-main"}
- {VERSION: "3.13-dev", NOXSESSION: "tests-cryptography-main"}
- {VERSION: "pypy-3.9", NOXSESSION: "tests-cryptography-main"}
- {VERSION: "pypy-3.10", NOXSESSION: "tests-cryptography-main"}
# -cryptography-minimum
- {VERSION: "3.7", NOXSESSION: "tests-cryptography-minimum"}
- {VERSION: "3.8", NOXSESSION: "tests-cryptography-minimum"}
- {VERSION: "3.9", NOXSESSION: "tests-cryptography-minimum"}
- {VERSION: "3.10", NOXSESSION: "tests-cryptography-minimum"}
- {VERSION: "3.11", NOXSESSION: "tests-cryptography-minimum"}
- {VERSION: "3.12", NOXSESSION: "tests-cryptography-minimum"}
- {VERSION: "3.13-dev", NOXSESSION: "tests-cryptography-minimum"}
- {VERSION: "pypy-3.10", NOXSESSION: "tests-cryptography-minimum"}
# Cryptography wheels
- {VERSION: "3.9", TOXENV: "py39-cryptographyMinimum-useWheel"}
- {VERSION: "3.9", TOXENV: "py39-useWheel"}
- {VERSION: "3.9", NOXSESSION: "tests-cryptography-minimum-wheel"}
- {VERSION: "3.9", NOXSESSION: "tests-wheel"}
# Random order
- {VERSION: "3.9", TOXENV: "py39-randomorder"}
- {VERSION: "3.9", NOXSESSION: "tests-random-order"}
# Meta
- {VERSION: "3.9", TOXENV: "check-manifest"}
- {VERSION: "3.11", TOXENV: "lint"}
- {VERSION: "3.13", TOXENV: "py313-mypy"}
- {VERSION: "3.9", TOXENV: "docs"}
name: "${{ matrix.PYTHON.TOXENV }}${{ matrix.PYTHON.OS && format(' on {0}', matrix.PYTHON.OS) || '' }}"
- {VERSION: "3.9", NOXSESSION: "check-manifest"}
- {VERSION: "3.11", NOXSESSION: "lint"}
- {VERSION: "3.13", NOXSESSION: "mypy"}
- {VERSION: "3.9", NOXSESSION: "docs"}
steps:
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.PYTHON.VERSION }}
- run: python -m pip install tox
- run: tox -v
- run: python -m pip install nox
- run: nox
env:
TOXENV: ${{ matrix.PYTHON.TOXENV }}
NOXSESSION: ${{ matrix.PYTHON.NOXSESSION }}
- uses: ./.github/actions/upload-coverage

linux-docker:
Expand All @@ -69,16 +68,16 @@ jobs:
fail-fast: false
matrix:
TEST:
# cryptographyMain used since there's no wheel
- {CONTAINER: "ubuntu-rolling", TOXENV: "py313-cryptographyMain"}
name: "${{ matrix.TEST.TOXENV }} on ${{ matrix.TEST.CONTAINER }}"
# cryptography-main used since there's no wheel
- {CONTAINER: "ubuntu-rolling", NOXSESSION: "tests-cryptography-main"}
name: "${{ matrix.TEST.NOXSESSION }} on ${{ matrix.TEST.CONTAINER }}"
steps:
- uses: actions/checkout@v4
- run: /venv/bin/pip install tox
- run: /venv/bin/tox -v
- run: /venv/bin/pip install nox
- run: /venv/bin/nox
env:
TOXENV: ${{ matrix.TEST.TOXENV }}
RUSTUP_HOME: /root/.rustup
NOXSESSION: ${{ matrix.TEST.NOXSESSION }}
- uses: ./.github/actions/upload-coverage

linux-downstream:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dist
*.pyc
*.pyo
__pycache__
.tox
.nox
doc/_build/
.coverage*
.eggs
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include LICENSE MANIFEST.in *.rst tox.ini .coveragerc src/OpenSSL/py.typed
include LICENSE MANIFEST.in *.rst noxfile.py .coveragerc src/OpenSSL/py.typed
exclude .readthedocs.yml mypy.ini
recursive-include tests *.py
recursive-include doc *
Expand Down
88 changes: 88 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import nox

nox.options.reuse_existing_virtualenvs = True
nox.options.default_venv_backend = "uv|virtualenv"

MINIMUM_CRYPTOGRAPHY_VERSION = "41.0.5"


@nox.session
@nox.session(name="tests-cryptography-main")
@nox.session(name="tests-cryptography-minimum")
@nox.session(name="tests-wheel")
@nox.session(name="tests-cryptography-minimum-wheel")
@nox.session(name="tests-random-order")
def tests(session: nox.Session) -> None:
cryptography_version = None
use_wheel = False
random_order = False

if "cryptography-main" in session.name:
cryptography_version = "main"
elif "cryptography-minimum" in session.name:
cryptography_version = "minimum"

if "wheel" in session.name:
use_wheel = True

if "random-order" in session.name:
random_order = True

session.env.update(
{
"PIP_NO_BINARY": "" if use_wheel else "cryptography",
}
)

deps = ["coverage>=4.2"]

if cryptography_version == "minimum":
deps.append(f"cryptography=={MINIMUM_CRYPTOGRAPHY_VERSION}")

if random_order:
deps.append("pytest-randomly")

session.install(*deps)
session.install("-e", ".[test]")
if cryptography_version == "main":
session.install("git+https://github.com/pyca/cryptography.git")

session.run("openssl", "version", external=True)
session.run("coverage", "run", "--parallel", "-m", "OpenSSL.debug")
session.run(
"coverage", "run", "--parallel", "-m", "pytest", "-v", *session.posargs
)


@nox.session
def lint(session: nox.Session) -> None:
session.install("ruff")
session.run("ruff", "check", ".")
session.run("ruff", "format", "--check", ".")


@nox.session
def mypy(session: nox.Session) -> None:
session.install("-e", ".[test]")
session.install("mypy")
session.run("mypy", "src/", "tests/")


@nox.session(name="check-manifest")
def check_manifest(session: nox.Session) -> None:
session.install("check-manifest")
session.run("check-manifest")


@nox.session
def docs(session: nox.Session) -> None:
session.install("-e", ".[docs]")
session.run(
"sphinx-build",
"-W",
"-b",
"html",
"doc",
"doc/_build/html",
*session.posargs,
)
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ source = ["OpenSSL", "tests/"]
[tool.coverage.paths]
source = [
"src/OpenSSL",
"*.tox/*/lib/python*/site-packages/OpenSSL",
"*.tox/*/lib/pypy*/site-packages/OpenSSL",
"*.tox/pypy/site-packages/OpenSSL",
"*.tox\\*\\Lib\\site-packages\\OpenSSL",
"*.nox/*/lib/python*/site-packages/OpenSSL",
"*.nox/*/lib/pypy*/site-packages/OpenSSL",
"*.nox/pypy/site-packages/OpenSSL",
"*.nox\\*\\Lib\\site-packages\\OpenSSL",
]

[tool.coverage.report]
Expand Down
70 changes: 0 additions & 70 deletions tox.ini

This file was deleted.