Skip to content

fix: Python3.8 type compatibility #330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bilbobx182
Copy link

@bilbobx182 bilbobx182 commented Apr 23, 2025

What does this do?

There's currently a breaking problem with python 3.8 support.

    from prometheus_fastapi_instrumentator import Instrumentator
  File "/pythonlibs/prometheus_fastapi_instrumentator/__init__.py", line 1, in <module>
    from .instrumentation import PrometheusFastApiInstrumentator
  File "/pythonlibs/prometheus_fastapi_instrumentator/instrumentation.py", line 21, in <module>
    from prometheus_fastapi_instrumentator import metrics
  File "/pythonlibs/prometheus_fastapi_instrumentator/metrics.py", line 601, in <module>
    def _map_label_name_value(label_name: tuple) -> list[str]:
TypeError: 'type' object is not subscriptable
Process SpawnProcess-4:

Why do we need it?

To support python3.8 we need to use the typing module to support it. It's already in use elsewhere in the file, however when this feature was added it used more modern python types.
This is a trivial change of changing it to use the typing module.

Who is this for?

Anyone who wants to use the library.

Linked issues

Stems from these changes
#326

@bilbobx182 bilbobx182 changed the title Fix: Python3.8 type compatibility fix: Python3.8 type compatibility Apr 23, 2025
@bilbobx182 bilbobx182 marked this pull request as ready for review April 23, 2025 16:37
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.

1 participant