Using Poetry with Nox
See original GitHub issue- I have searched the issues of this repo and believe that this is not a duplicate.
Issue
I’ve been trying to migrate an existing project to Poetry. It is using Tox
to test a matrix of different package versions. The difficulties of trying to get Poetry and Tox to play nicely together for matrices of package versions is fairly well-documented (see https://stackoverflow.com/questions/59377071/how-can-i-get-tox-and-poetry-to-work-together-to-support-testing-multiple-versio)
I’m playing around with Nox as an alternative, and it’s looking very promising for being easier to integrate with Poetry, but there are still a few caveats.
I have the following Nox script for testing against a couple of different python interpreters, and a couple of different versions of sphinx-
import nox
@nox.session(python = ["3.5", "3.6"]
@nox.parametrize("sphinx", ["^2.4", "^3.0"])
def tests(session, sphinx)
session.run('poetry', 'add', f'sphinx@{sphinx}', external=True)
session.run('poetry', 'install', external=True)
session.run('pytest')
this works perfectly, except that it modifies the pyproject.toml
file in my project’s root. Is there a better way for me to arrange this?
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (7 by maintainers)
You could also use nox-poetry which exports a requirements file with Poetry and defers to pip for installing packages.
We should all thank @cjolowicz for this cookiecutter template taht implements nox-poetry: https://cookiecutter-hypermodern-python.readthedocs.io/en/2020.10.15.1/
He also wrote nox-poetry plugin