question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
laydaycommented, Oct 5, 2020

You could also use nox-poetry which exports a requirements file with Poetry and defers to pip for installing packages.

2reactions
aidan-melencommented, Nov 19, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

cjolowicz/nox-poetry: Use Poetry inside Nox sessions - GitHub
This package provides a drop-in replacement for the nox.session decorator, and for the nox.Session object passed to user-defined session functions. This enables ...
Read more >
How to use nox with poetry? - python - Stack Overflow
I wanted to use nox session without poetry, so I used poetry to generate arguments for session.install() like this:
Read more >
Claudio Jolowicz - nox-poetry
This allows you to manage packages used in Nox sessions as development dependencies in Poetry. This works because session functions are passed ...
Read more >
Nox is a part of your global developer environment, like Poetry ...
Installing Nox with Poetry creates a complex and confusing situation because Nox also needs to invoke Poetry, and may end up installing itself ......
Read more >
nox-poetry | Read the Docs
nox -poetry · Versions · Repository · Project Slug · Last Built · Maintainers · Badge · Tags · Short URLs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found