Poetry: "Pipenv mode": a virtual environment manager that does not package

Created on 28 May 2019  路  3Comments  路  Source: python-poetry/poetry

  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x] I have searched the documentation and believe that my question is not covered.

I'd like to be able to use Poetry to manage a virtual environment for a project that I never intend to package or publish.

My particular use case is that I want to use Python for testing a project written for another language. I just want to use Python as a cross-platform scripting language that comes with a nice test framework (pytest). I don't want to have to give my project a name or version in pyproject.toml, but Poetry refuses to create a virtual environment or install any dependencies until they are given. Pipenv doesn't have this limitation (because it doesn't try to handle packaging, which would require a name and version), so I'm using it in the meantime. I love Poetry, and I would rather use one tool, so please consider limiting name and version checks to the methods that absolutely need them.

Feature Virtualenvs

Most helpful comment

As a general workaround for the second point, you could add a trove classifier starting with "Private ::", per https://github.com/pypa/warehouse/pull/5440

All 3 comments

The --no-interaction mode (-n) will infer the name from the directory:

$ cd <my_project>
$ poetry init -n
$ poetry add pytest
$ poetry run pytest

This has worked for all my application projects (e.g. Django) that will never be packaged.

Yes, and the version is defaulted. In my use case, this is sitting in a project that has a name and version in another language's ecosystem. Choosing a name is not difficult. There are two good reasons I don't want to have to give a version, though:

  • I don't want the "dummy version" in pyproject.toml to confuse newcomers into thinking that there is a Python package cohabiting with the rest of the project. The project has a version that is tracked in another file specific to the other language's ecosystem.
  • I don't want me or someone else to accidentally run any commands that might try to package or publish this project to PyPI. I want Poetry to warn that packaging is not possible for this project.

And If I'm not giving a version to Poetry, I might as well not give a name either.

As a general workaround for the second point, you could add a trove classifier starting with "Private ::", per https://github.com/pypa/warehouse/pull/5440

Was this page helpful?
0 / 5 - 0 ratings