prometheus / prometheus/client_python

Unbundle the `decorator` dependency, or at least upgrade it

Open
#1,107 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.4k
Forks
876
Avg merge
8d 4h
Merged PRs (30d)
1

Description

Hi,

In #91 years ago, it was decided to add the decorator to fix a problem. Back then choices was made to not add a new dependency, but really bundle the only decorar file needed. Distributions (in my case Fedora) usually prefer to rely on the actual package than bundled dependencies. Fedora does apply a patch to unbundle decorator, maybe other distro do that too.

Do we still want to avoid dependencies in 2025 ? I have seen other discussions where it was discussed adding a protobuf dependency, which pulls many more dependencies, so isn't ok now to depend on decorator ?

If not, would it make sense at least to upgrade it ? By doing so, you hit the issue that decorator.getargspec has been removed years ago. In python 3 there is now inspect.getfullargspec which is not strictly equivalent but does provide a similar feature. Fedora uses a minimal patch here: https://src.fedoraproject.org/rpms/python-prometheus_client/blob/rawhide/f/0001-Remove-the-bundled-decorator-package.patch#_506 but tries to avoid adding much code, most likely the "real" change is more verbose.

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

No repository file or test is named in the issue. Start by reviewing the current bundled decorator implementation and the linked Fedora unbundling patch, then determine whether the project will depend on the external package or retain an updated bundled version. Done means the chosen dependency strategy works with current Python versions and its compatibility is covered by the existing test suite.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.