Skip to content

Support Python 3.11 #4149

Description

@Yun-Kim

This issue is to track our progress in supporting Python 3.11.

Update (April 3, 2023): The ddtrace library now supports Python 3.11, with the exception of certain integrations for which libraries are not themselves compatible with Python 3.11. This includes celery, which should be resolved once they release version 5.3.

The dd-trace-py library currently does not support Python 3.11, which is scheduled to be released October 24 2022. We have several integrations and core components that are failing to build or failing tests with #4125.

Checklist for dd-trace-py core components:

  1. ✅ ddtrace-run: ~gevent dependency fails to install due to API changes to their vendored greenlet. ~
  • Waiting on gevent to unblock and support 3.11 issue and PR.
  • Updated test suite to run with Python 3.11 and gevent:latest.
  1. ✅ debugger (Dynamic Instrumentation), internal: depend on the bytecode module which doesn't support Python 3.11 yet, so the debugger and internal test suites won't pass.
  • skipping Python 3.11 tests until bytecode supports Python 3.11.
  • Bytecode now supports 3.11, but our injection and wrapping bytecode needs to be updated to match Python 3.11's new bytecode op codes.
  • Dynamic instrumentation will support Python 3.11 once feat: add Python 3.11 support to Dynamic Instrumentation #4854 is merged.
  1. ✅ profiler: see feat(profiler): add Python 3.11 support #4343 description, the profiler is still crashing on Python 3.11. The profiler now supports Python 3.11 as of feat(profiling): add support for Python 3.11 #4511.
  1. ✅ tracer: Riot seems to have problems with Python 3.11's importlib in terms of managing virtual environments. Specifically, Hypothesis' vendored text file is not being found even though there is no problem running the test locally with Python 3.11.
  • Workaround was to ignore the failing test file that imported from hypothesis.provisional, and create a separate test suite using tox to test it separately.

Checklist for integrations:

  1. ❌ celery: getting a AttributeError: '_Code' object has no attribute 'co_positions' error for 2 celery tests, failing tests marked as flaky but they are constantly failing with PR feat(tracer): add Python 3.11 support #4125
  • Skipping testing with Python 3.11 for now as celery's dependency billiard is not yet Python 3.11 compatible. See issue
  • Waiting for celery to release a Python 3.11 compatible version, should be released in celery=5.3.0
  1. ✅ cherrypy & pynamodb: inspect.getargspec() has been deprecated since Python 3.0 and was now removed in Python 3.11.
  • Known issue and resolved by cherrypy fix, released in version 18.7.
  • In other words Python 3.11 is only compatible with Cherrypy >= 18.7.
  • Pynamodb released compatibility fix for removed getargspec() in version 4.1
  • Updated cherrypy & pynamodb test suites to use versions 18.7 & 4.1 respectively with Python 3.11.
  1. ✅ dogpilecache: inspect.getargspec() has been deprecated since Python 3.0 and was now removed in Python 3.11.
  • Known issue and resolved in dogpilecache >= 0.7
  • Updated dogpilecache test suite to run with Py 3.11 with dogpilecache >= 0.7.
  1. ✅ kombu: failing in CI due to a pinned dependency.
  • Kombu's dependency Vine==1.3.0 is pinned in CI for some reason and it is incompatible with Python 3.11 (inspect.formatargspec() has been deprecated since Python 3.5 and was now removed in Python 3.11.)
  • kombu >= 5.0 is compatible with Python 3.11, updated kombu test suite to run with kombu >= 5.0
  1. ✅ django: Python's gettext.py module removed a deprecated function argument codeset as of Python 3.11.
  • Django 4.1 is meant to be first django version compatible with Python 3.11
  • Updated django test suite to run Py3.11 with Django 4.1.
  1. ✅ fastapi & starlette:
  • Getting TypeError: Passing coroutines is forbidden, use tasks explicitly. errors from asyncio
  • fastapi giving the same error, makes sense as it is based on and dependent on starlette
  • starlette released Python 3.11 compatible version as of v0.21.0, updated starlette and fastapi test suites to use starlette >= 0.21.0 with Python 3.11.
  1. ✅ graphene, graphql:
  • Getting error as they are also dependent on the bytecode module, which doesn't yet support Python 3.11
  • skipping Python 3.11 tests until bytecode supports Python 3.11.
  • Bytecode now supports 3.11, but our injection and wrapping bytecode needs to be updated to match Python 3.11's new bytecode op codes.
  • Will be unblocked once feat: add Python 3.11 support to Dynamic Instrumentation #4854 is merged.
  1. ✅ grpc:
  • According to grpc maintainers grpc 1.49.0 will support python 3.11 which should be released soon.
  • Updated grpc test suites to use 1.49.0 with Python 3.11.
  • Note: grpcio with pytest-asyncio is causing Python segmentation faults on the test_unary_exception and test_unary_cancellation test cases. You can reproduce this using this gist. Thus I am skipping Python 3.11 tests with grpcio and pytest-asyncio.
  1. ✅ mariabd: fails to install with Python 3.11 currently, version 1.1.2 onwards should be compatible with Python 3.11.
  • Updated mariadb test suite to use 1.1.2+ for Python 3.11.
  1. ✅ asyncpg: ~getting asyncpg/pgproto/pgproto.c:223:12: fatal error: longintrepr.h: No such file or directory #include "longintrepr.h" error during install process
  • Should be fixed in coming release of asyncpg. See issue~
  • Skipping the asyncpg python 3.11 tests for now until asyncpg releases a compatible version.
  • Updated asyncpg test suite to use latest (0.27.0) with Python 3.11.
  1. ✅ aioredis: failing to run test cases with TypeError: duplicate base class "TimeoutError"
  • According to this aioredis issue, aioredis is being replaced by the redis library (4.2.0+), and no longer supports Python 3.11 (redis will take over support for aioredis). Therefore, the aioredis test suite has been update to exclude Python 3.11 and an internal issue has been raised to transition our integration/testing for aioredis into our redis integration.
  1. ✅ psycopg: failing to install.
  • According to psycopg docs, version 2.9.2 has preliminary support for python 3.11, but our riotfile tests are based on ~=2..8.0, ~=2.9.0, latest
  • Updated psycopg test suite to use 2.9.2+ with Python 3.11.
  1. ✅ pylibmc: fails to build with Python 3.11, fixed in pylibmc==1.6.1
  • Updated pylibmc test suite to use 1.6.1+ with Python 3.11.
  1. ✅ gevent: fails to build with Python 3.11.
  • gevent uses a vendored version of greenlet, which is not yet compatible with Python 3.11 (See issue)
  • Skipping the gevent python 3.11 tests for now until gevent releases a compatible version.
  • Updated gevent test suite to use 22.8+ with Python 3.11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions