python-poetry / python-poetry/poetry

Wrong metadata generated for old Python versions

Open
#3,791 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/build-system kind/bug status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

Although Poetry doesn't run with old Python versions like 2.6, as far as I understand, developing packages supporting Python 2.6 should be still supported by Poetry (running with a newer Python).

But it seems that source distributions and wheels generated by poetry build have wrong metadata for old Python versions.
Example:

[tool.poetry.dependencies]
python = "~2.6 || ~2.7 || ^3.2"

Poetry generates:

Metadata-Version: 2.1
Name: example
Version: 0.1.0
Summary: 
Author: Your Name
Author-email: you@example.com
Requires-Python: >=2.7, !=3.0.*, !=3.1.*
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9

So, 2.6 is omitted in Requires-Python (same for python_requires in setup.py). 3.2 and 3.3 are also missing in the classifiers.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the linked pyproject.toml and poetry build, then inspect the generated source-distribution and wheel metadata. Check how the Python constraint becomes Requires-Python and classifiers; done means Python 2.6 appears in Requires-Python and Python 3.2 and 3.3 are represented in the classifiers.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.