Support Python3.12

Open
#12 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
fastapi, python

Research direction

The failures are reported in tests/test_cli.py and tests/test_tracing.py; start by running those tests under Python 3.12 and trace the FastAPI import chain shown in the report. Check the project's dependency declarations for versions compatible with Python 3.12, then rerun both tests and the full suite; done means collection succeeds and tests pass on Python 3.12.

Written by the indexing model from the issue text.

Description

Currently causes the following test failures:

______________________ ERROR collecting tests/test_cli.py ______________________
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/runner.py", line 341, in from_call
    result: TResult | None = func()
                             ^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/runner.py", line 389, in collect
    return list(collector.collect())
                ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/python.py", line 549, in collect
    self._register_setup_module_fixture()
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/python.py", line 562, in _register_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
    ^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/python.py", line 284, in obj
    self._obj = obj = self._getobj()
                      ^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/python.py", line 546, in _getobj
    return importtestmodule(self.path, self.config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/python.py", line 493, in importtestmodule
    mod = import_path(
          ^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/pathlib.py", line 582, in import_path
    importlib.import_module(module_name)
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/assertion/rewrite.py", line 174, in exec_module
    exec(co, module.__dict__)
  File "/home/runner/work/observability-utils/observability-utils/tests/test_cli.py", line 4, in <module>
    from observability_utils import __version__
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/observability_utils/__init__.py", line 10, in <module>
    from .tracing import (
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/observability_utils/tracing.py", line 3, in <module>
    from fastapi import FastAPI
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/fastapi/__init__.py", line 7, in <module>
    from .applications import FastAPI as FastAPI
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/fastapi/applications.py", line 16, in <module>
    from fastapi import routing
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/fastapi/routing.py", line 22, in <module>
    from fastapi import params
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/fastapi/params.py", line 4, in <module>
    from pydantic.fields import FieldInfo, Undefined
  File "pydantic/__init__.py", line 2, in init pydantic.__init__
  File "pydantic/dataclasses.py", line 48, in init pydantic.dataclasses
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/typing_extensions.py", line 1174, in <module>
    class TypeVar(typing.TypeVar, _DefaultMixin, _root=True):
TypeError: type 'typing.TypeVar' is not an acceptable base type
____________________ ERROR collecting tests/test_tracing.py ____________________
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/runner.py", line 341, in from_call
    result: TResult | None = func()
                             ^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/runner.py", line 389, in collect
    return list(collector.collect())
                ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/python.py", line 549, in collect
    self._register_setup_module_fixture()
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/python.py", line 562, in _register_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
    ^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/python.py", line 284, in obj
    self._obj = obj = self._getobj()
                      ^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/python.py", line 546, in _getobj
    return importtestmodule(self.path, self.config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/python.py", line 493, in importtestmodule
    mod = import_path(
          ^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/pathlib.py", line 582, in import_path
    importlib.import_module(module_name)
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/_pytest/assertion/rewrite.py", line 174, in exec_module
    exec(co, module.__dict__)
  File "/home/runner/work/observability-utils/observability-utils/tests/test_tracing.py", line 3, in <module>
    from fastapi import FastAPI
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/fastapi/__init__.py", line 7, in <module>
    from .applications import FastAPI as FastAPI
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/fastapi/applications.py", line 16, in <module>
    from fastapi import routing
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/fastapi/routing.py", line 22, in <module>
    from fastapi import params
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/fastapi/params.py", line 4, in <module>
    from pydantic.fields import FieldInfo, Undefined
  File "pydantic/__init__.py", line 2, in init pydantic.__init__
  File "pydantic/dataclasses.py", line 48, in init pydantic.dataclasses
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/typing_extensions.py", line 1174, in <module>
    class TypeVar(typing.TypeVar, _DefaultMixin, _root=True):
TypeError: type 'typing.TypeVar' is not an acceptable base type
Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

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.

More from DiamondLightSource/observability-utils

All issues in DiamondLightSource/observability-utils

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.