Skip to content

Fix empty static project classifiers - #986

Merged
radoering merged 2 commits into
python-poetry:mainfrom
AryanRG:fix/empty-static-classifiers
Nov 8, 2026
Merged

radoering merged 2 commits into
python-poetry:mainfrom
AryanRG:fix/empty-static-classifiers

Conversation

@AryanRG

@AryanRG AryanRG commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Resolves python-poetry/poetry#11146.

An explicit [project] classifiers = [] currently falls through to legacy classifiers and automatic Python/license enrichment. Preserve that static empty list so built metadata contains no classifier headers. Missing project classifiers retain the existing fallback and enrichment.

Regression tests check factory values and actual wheel METADATA, with and without legacy classifiers. The follow-up removes the extra condition and tests for simultaneously declaring classifiers static and dynamic, as requested in review.

  • Added tests for changed code.
  • Updated documentation for changed code. The existing classifier documentation already describes the restored behavior.

Validation on CPython 3.12: default suite and integration tests pass, as do mypy and Ruff. The four retained regressions fail on the unchanged base. The full default suite also passes with the patch applied to current main. Other platforms and the main Poetry downstream suite were not run locally; hosted CI is separate.

Prepared with AI assistance.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. If the empty-list versus dynamic-classifier distinction is wrong, the generated wheel can contain missing or unintended classifier metadata. Reverting fixes future builds, but wheels already built or published retain that metadata and would need a corrected release.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread src/poetry/core/factory.py Resolved

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linked issues

#11146 Poetry Core adds classifiers despite an empty static project.classifiers list · 2 of 3 met

# Requirement Status Notes
1 An explicitly empty, fully static project.classifiers list produces no classifier headers, including when legacy classifiers are present. ✅ Met The change keeps the empty project list and disables enrichment; factory and wheel tests cover cases with and without legacy classifiers.
2 Keep fallback and enrichment when project classifiers are absent. ✅ Met When project.get("classifiers") is None, the change still uses legacy classifiers and enables dynamic enrichment.
3 Preserve fallback and enrichment when an empty initial classifiers list explicitly declares classifiers dynamic. ❌ Not addressed The change treats every present empty list as static and disables dynamic enrichment, without checking whether classifiers are declared dynamic.

Comment thread src/poetry/core/factory.py Resolved
@radoering
radoering force-pushed the fix/empty-static-classifiers branch from c0750aa to 314af8d Compare November 8, 2026 08:01
@radoering
radoering force-pushed the fix/empty-static-classifiers branch from 314af8d to 3d659aa Compare November 8, 2026 08:19
@radoering
radoering enabled auto-merge (squash) November 8, 2026 08:23
@radoering
radoering merged commit d213296 into python-poetry:main Nov 8, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Poetry Core adds classifiers despite an empty static project.classifiers list

2 participants