Skip to content

Drop Python 2 compatibility code from bundled decorator module#1196

Open
shekhargit1912 wants to merge 1 commit into
prometheus:masterfrom
shekhargit1912:fix-1107-decorator-dependency
Open

Drop Python 2 compatibility code from bundled decorator module#1196
shekhargit1912 wants to merge 1 commit into
prometheus:masterfrom
shekhargit1912:fix-1107-decorator-dependency

Conversation

@shekhargit1912

Copy link
Copy Markdown

What

Removes the Python 2/3 compatibility branching from the vendored prometheus_client/decorator.py: the getfullargspec shim class, the formatargspec-based signature-building path, and the Python 2-only get_init variant.

Why

pyproject.toml requires python_requires = ">=3.9", so these Python 2 code paths have been dead for years. This addresses the "at least upgrade it" part of #1107 by cleaning up the vendored copy in place. A full unbundle to an external decorator dependency is a separate call for maintainers to make, so this PR doesn't attempt that.

Testing

  • tox -e flake8 passes
  • tox -e py310: 379 passed, 35 failed, 12 skipped, 6 errors -- identical to the pre-change baseline (remaining failures are pre-existing and Windows-specific, in test_multiprocess.py / test_wsgi.py, unrelated to this change)

Fixes #1107

The vendored decorator.py still carried Python 2/3 branching (a
getfullargspec shim, formatargspec-based signature building, and the
py2-only get_init variant) even though the project now requires
Python >= 3.9. Removing the dead Python 2 paths leaves the Python 3
behavior unchanged.

Fixes prometheus#1107

Signed-off-by: shekhargit1912 <shekharchaugule302@gmail.com>
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.

Unbundle the decorator dependency, or at least upgrade it

1 participant