Arnav Borborah
Arnav Borborah

Reputation: 11787

Specify Python tag for wheel using Poetry

I'm thinking of migrating my Python library from Pipenv with setup.py to just Poetry. Previously, in order to build my project, I would run

python setup.py sdist bdist_wheel

For the package I'm building, the minimum supported Python version is 3.6, so I've added the following in a setup.cfg file so that this is specified in the built wheel (based on this):

[bdist_wheel]
python-tag = py36

However, with Poetry, the poetry build comamnd is used, which ignores this section in setup.cfg and instead puts a general py3 tag on the wheel. Is there any equivalent way to get the tag onto the generated wheel using Poetry?

Upvotes: 4

Views: 2811

Answers (1)

Arne
Arne

Reputation: 20217

The only config file that poetry considers is pyproject.toml. It is documented here, which should help you port all relevant info over. The particular tag that you're asking for would be the python version:

[tool.poetry]
name = "example"
version = "0.1.0"
...

[tool.poetry.dependencies]
python = "^3.6"  # having something here is mandatory for a build to work

A wheels-build will then contain the following in example.whl/example-0.1.0.dist-info/METADATA:

...

Requires-Python: >=3.6,<4.0
...

Upvotes: 1

Related Questions