In the worst case, you publish a buggy release because you forgot to commit some changes.
In the best case, any mistakes will still be caught during Continuous Integration. your local copy of the code, instead of the installed wheel your users see.
Checks run against an editable installation of your package,. Unfortunately, this approach comes with its own set of problems: run_always ( "poetry", "install", external = True ) session. session def tests ( session : Session ) -> None : """Run the test suite.""" session. You can solve these issues by declaring pytest as a development dependency,Īnd installing your package and its dependencies using poetry install. Which can lead to surprises in Continuous Integration and when collaborating with others. Unpinned dependencies mean that your checks are not reproducible and deterministic, Poetry would be installed as a build backend every time.The pytest dependency would not be constrained at all.In other words, their versions would not be pinned. Package dependencies would only be constrained by the wheel metadata, not by the lock file.If we had imported from nox instead of nox_poetry: Invoke pytest to run the test suite against the installation.Ĭonsider what would happen in this session.
#Nox installer language install#
Install the wheel as well as the pytest package. This session performs the following steps: Let’s look at an example: from nox_poetry import session ( python = ) def tests ( session ): session. Please read the next section for the tradeoffs of each method. Use n_always("poetry", "install", external=True) to install your package with all development dependencies. Use session.install(".") (or ()) to install your own package. Use session.install(.) to install specific development dependencies, e.g. Here is a comparison of the different installation methods: Note that distribution_format is a keyword-only parameter. This works because session functions are passed instances of nox_poetry.Session,Ī proxy for nox.Session adding Poetry-related functionality.īehind the scenes, nox-poetry uses Poetry to export a constraints file and build the package.įor more fine-grained control, additional utilities are available under the session.poetry attribute: This allows you to manage packages used in Nox sessions as development dependencies in Poetry. The session.install method automatically honors the Poetry lock file when installing dependencies. Import the decorator from nox_poetry instead of nox.