Registry / testing / nox-poetry

nox-poetry

JSON →
library1.2.0pypypiunverified

nox-poetry is a plugin for Nox, a flexible test automation tool, that simplifies testing and building Python projects managed with Poetry. It integrates Poetry's dependency management and build processes directly into Nox sessions, providing features like installing project dependencies, building packages, and exporting requirements. The current version is 1.2.0, with regular updates that often include support for newer Python and Poetry versions, alongside bug fixes and minor feature enhancements.

pip install nox-poetry
INSTALL
IMPORT
SIG · NOX-POETRY
N
nox-poetry
testingpythonv1.2.0
Install
3.1s avg
Import
Disk
32MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 33.2MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 3.1s · import 0.000s · 34MB
32MB installed
● package 32MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

session.poetry
# noxfile.py import nox @nox.session def tests(session): session.poetry.install(groups=["dev"]) session.run("pytest")
from nox_poetry.core import build_package
Global functions and modules (e.g., `build_package`, `export_requirements`, `core` module) were deprecated in v0.8.0 and removed in v1.0.0. Use `session.poetry.*` methods instead.

This `noxfile.py` demonstrates how to use `nox-poetry` to manage dependencies and run tests for a Poetry-managed project across multiple Python versions, and how to build the project.

# noxfile.py import nox @nox.session(python=["3.9", "3.10", "3.11", "3.12"]) def tests(session): # Install project dependencies, including dev dependencies. # This respects the poetry.lock file. session.poetry.install(extras=["all"], groups=["dev"]) # Run tests session.run("pytest", *session.posargs) @nox.session(python="3.12") def build(session): # Build the package (sdist and wheel) session.poetry.build() # You can then use the built package, e.g., check its contents session.run("ls", "dist", external=True)
Debug
Known issues
breakingBreaking API change in v1.0.0: Global helper functions like `export_requirements`, `build_package`, `patch`, `install`, `installroot` and modules like `core`, `patch` were removed. All functionality is now accessed through the `session.poetry` object.
fix
Migrate calls from global functions (e.g., `build_package()`) to `session.poetry` methods (e.g., `session.poetry.build()`). Refer to the official documentation for updated usage patterns.
affects: >=1.0.0
breakingDropped support for Python 3.8 in v1.2.0. Projects using `nox-poetry` 1.2.0 or newer must use Python 3.9 or higher for their Nox environments.
fix
Ensure your Nox sessions are configured to use Python >=3.9. Update your `noxfile.py`'s `python` parameter in `@nox.session` decorators accordingly. For example, `python=['3.9', '3.10']`.
affects: >=1.2.0
breakingDropped support for Python 3.7 in v1.1.0. Projects using `nox-poetry` 1.1.0 or newer must use Python 3.8 or higher for their Nox environments.
fix
Ensure your Nox sessions are configured to use Python >=3.8. Update your `noxfile.py`'s `python` parameter in `@nox.session` decorators.
affects: >=1.1.0
gotcha`nox-poetry` requires `poetry` to be installed and available in the session's PATH. If `poetry` is not found, `session.poetry` commands will fail with an error like 'nox-poetry requires poetry to be installed'.
fix
Ensure `poetry` is installed in the environment where Nox is run, or if preferred, install `poetry` within the Nox session itself using `session.install('poetry')` *before* calling `session.poetry.*` methods.
affects: all
gotcha`nox-poetry` expects a `pyproject.toml` file at the root of your project with a valid `[tool.poetry]` section for package metadata and dependency management. Incorrect or missing configuration will lead to errors like 'ValueError: The project root directory could not be determined'.
fix
Verify your `pyproject.toml` correctly defines your project using Poetry's specification. Ensure it's in the project root where Nox is executed.
affects: all
Upgrade
Version history
1.2.0latest on PyPI · released Feb 25, 2025
Audit
Dependencies
noxrequirednox-poetry is a plugin for Nox and requires Nox to function.
Agent activity
15 hits · last 30 days
node
14
Resources
nox-poetry — pip install nox-poetry · libregistry