4

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?

Arnav Borborah
  • 11,357
  • 8
  • 43
  • 88

1 Answers1

1

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
...
Arne
  • 17,706
  • 5
  • 83
  • 99
  • 1
    I do have the line you mentioned in `pyproject.toml` but I'm looking for a way to modify the tag on the wheel itself, i.e instead of `package-py3-none-any.whl` I want a generated `package-py36-none-any.whl` if its possible through poetry. – Arnav Borborah Feb 17 '20 at 14:37
  • The `bdist_wheel` option with `setup.py` has the `--python-tag` option. I was looking for the equivalent for Poetry. I could modify it by hand, but do not want to unless necessary. – Arnav Borborah Feb 17 '20 at 14:48
  • strictly speaking, the wheel name is arbitrary and you can rename it by hand (or script) to whatever you want - any packaging tool will only look at the metadata, which is already set up correctly. – Arne Feb 17 '20 at 15:43
  • 1
    So it looks like I'll have to add it by hand. That's unfortunate. I'll consider opening an issue on the poetry repository to perhaps add a config option for this case. – Arnav Borborah Feb 17 '20 at 16:19