← All notes

Define and parametrize Nox sessions in a noxfile

Answer: By default, Nox looks for configuration in noxfile.py. Pass --noxfile when running nox if you want a different file. Nox sessions use standard Python functions, each decorated with @nox.session. In the example, tests calls session.run('pytest').

Defaults and descriptions

By default, all sessions will be run if no sessions are specified. Pass default=False in the @nox.session(...) decorator to drop a session from that list. The nox.options.sessions option can also name the default list. You can add a description to your session using a docstring. The first line will be shown when listing the sessions. The nox --list command will show available sessions. You can also configure sessions to run against multiple Python versions and parametrize sessions.

| noxfile.py | session | |---|---| | @nox.session | session.run | | nox.options.sessions | default=False | | docstring | nox --list | | parametrize | Python versions |

virtualenv

In the implementation, session.virtualenv is the virtualenv that all commands are run in. If a virtualenv has not been created for this session, that property raises. Session names used on disk are normalized to be a "safe" filesystem path for a virtualenv. A name that is too long may be hashed.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Nox docs, Configuration & API; Nox source, sessions.py. Apache-2.0; Apache-2.0. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Nox docs, Configuration & API; Nox source, sessions.py. Apache-2.0; Apache-2.0.

Cite this

Permanent ID: iil:note:ybm6pq8w

iinventedlight. 2026. "Define and parametrize Nox sessions in a noxfile." iinventedlight Library, iil:note:ybm6pq8w, version of 2026-11-19. https://iinventedlight.com/library/notes/nox-sessions/. License: CC-BY-4.0.

@misc{iil_note_ybm6pq8w,
  author = {{iinventedlight}},
  title = {{Define and parametrize Nox sessions in a noxfile}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-19},
  url = {https://iinventedlight.com/library/notes/nox-sessions/},
  note = {Permanent ID iil:note:ybm6pq8w. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/nox-sessions.md.