Nox

2026.2.9 · active · verified Thu Apr 09

Nox is a command-line tool that automates development tasks like testing and linting across multiple Python environments. It utilizes a standard Python file (`noxfile.py`) for configuration, creating isolated virtual environments for each defined session. This approach provides programmatic control and reproducibility, installing specified dependencies and running commands within each isolated environment. As of version 2026.2.9, Nox is actively maintained with a regular release cadence, often following a calendar versioning scheme.

Warnings

Install

Imports

Quickstart

Create a `noxfile.py` in your project root to define test, lint, and format sessions. Nox will automatically create isolated virtual environments for each session, install dependencies, and execute commands. Run `nox` to execute all defined sessions, or `nox -s <session_name>` to run a specific one.

# noxfile.py
import nox

@nox.session(python=["3.9", "3.10", "3.11"])
def tests(session):
    """Run the test suite with pytest."""
    session.install("pytest")
    session.run("pytest", "tests/")

@nox.session
def lint(session):
    """Lint source code with Flake8 and Black."""
    session.install("flake8", "black")
    session.run("flake8", "src/", "tests/", "noxfile.py")
    session.run("black", "--check", "src/", "tests/", "noxfile.py")

# To run these sessions, save the above as noxfile.py in your project root
# and execute 'nox' in your terminal. For specific sessions, use 'nox -s tests' or 'nox -s lint'.
# To run multiple Python versions, nox will create virtualenvs for each specified version.
# Make sure you have python3.9, python3.10, python3.11 interpreters available on your PATH.

view raw JSON →