Skip to content

chore: remove unused constants in metadata - #1488

Merged
henryiii merged 1 commit into
pypa:mainfrom
duriantaco:remove-unused-constants
Nov 4, 2026
Merged

henryiii merged 1 commit into
pypa:mainfrom
duriantaco:remove-unused-constants

Conversation

@duriantaco

Copy link
Copy Markdown
Contributor

Summary

Hi! This is a cleanup.

  • Removed _DICT_FIELDS and _NOT_FOUND from metadata.py, nothing references them (the other field sets are still used)
  • No behaviour changes and no changes made to any APIs

Found with Skylos, a deterministic tool. No AI was used in this PR.

@henryiii henryiii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did a quick history check, below.

🤖 AI text below 🤖

Both came in with 61e6efb, "Support enriched metadata in packaging.metadata" (#686, Brett Cannon, 2023-08-18).

  • _DICT_FIELDS was used at first. The _Validator.__get__ fallback used it to return {} when project_urls was missing, and a test (test_dict_default) was parametrized on it. Commit 09f131b, "Default optional metadata values to None" (#734, 2023-10-15), changed the fallback to instance._raw.get(self.name) and removed that test. Since then nothing has used it.
  • _NOT_FOUND was never used. The only reference in 61e6efb is its definition. It is most likely left over from an earlier draft of that PR.

@henryiii

henryiii commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Out of curiosity, I ran vulture and processed it's output with AI (due to the large number of false positives), and this is what made it through:

🤖 AI text below 🤖

  • tests/property/test_version_releases.py:84-126: PRE_POOL, POST_POOL, DEV_POOL and EPOCH_POOL are defined but never used. Only FINAL_POOL is used, at line 223. They came in with Add property-based tests for PEP 440 #1144, which added the PEP 440 property tests, so they are probably leftovers or pools that were meant for later tests.
  • src/packaging/version.py:76: the alias VersionComparisonMethod is not referenced anywhere in the repo.

@henryiii
henryiii force-pushed the remove-unused-constants branch from 21ae205 to 3390672 Compare November 4, 2026 18:16
@henryiii
henryiii merged commit b189e64 into pypa:main Nov 4, 2026
62 checks passed
@duriantaco

Copy link
Copy Markdown
Contributor Author

Thanks for checking the history and merging this! Greatly appreciate the extra findings also

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.

2 participants