dataclasses and python > 3.7

Open Beginner friendly
#3,859 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@parabol123654 is already working on this.

Since Nov 10, 2026.

  • #3860 by @parabol123654 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
backend

Research direction

The issue points to the generic dependencies requirements and a compatibility package that conflicts with Python 3.7 and newer. Start by locating where dataclasses is declared and how the project handles Python version markers. Done when installation on Python 3.7+ no longer brings in the backport, while older Python versions can still install it.

Written by the indexing model from the issue text.

Description

bug

Module

generic dependencies

Describe the bug

The requirements provide "dataclasses" for compatibility with python<3.7, but for recent version it failed with dependencies that expect a recent version of dataclasses.

Our use case : having debugpy installed, and then the error arise:

  File "/blabla/app/python-env/lib/python3.11/site-packages/debugpy/adapter/__main__.py", line 230, in <module>
    __import__("debugpy")
  File "/blabla/app/python-env/lib/python3.11/site-packages/debugpy/adapter/../../debugpy/__init__.py", line 37, in <module>
    from debugpy.public_api import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/blabla/app/python-env/lib/python3.11/site-packages/debugpy/adapter/../../debugpy/public_api.py", line 25, in <module>
    @dataclasses.dataclass(frozen=True)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/blabla/app/python-env/lib/python3.11/site-packages/debugpy/adapter/../../dataclasses.py", line 950, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/blabla/app/python-env/lib/python3.11/site-packages/debugpy/adapter/../../dataclasses.py", line 800, in _process_class
    cls_fields = [_get_field(cls, name, type)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/blabla/app/python-env/lib/python3.11/site-packages/debugpy/adapter/../../dataclasses.py", line 800, in <listcomp>
    cls_fields = [_get_field(cls, name, type)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/blabla/app/python-env/lib/python3.11/site-packages/debugpy/adapter/../../dataclasses.py", line 659, in _get_field
    if (_is_classvar(a_type, typing)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/blabla/app/python-env/lib/python3.11/site-packages/debugpy/adapter/../../dataclasses.py", line 550, in _is_classvar
    return type(a_type) is typing._ClassVar
                           ^^^^^^^^^^^^^^^^
AttributeError: module 'typing' has no attribute '_ClassVar'. Did you mean: 'ClassVar'?

To Reproduce

Affected versions: everything that is python >= 3.7

Expected behavior
Should not install dataclasse module for python >= 3.7

Uninstalling dataclasses simply resolve the error, since it load the module from standard lib and not virtual env.

Dominant language
Python
Stars
960
Forks
1.7k
Avg merge
5d 23h
Merged PRs (30d)
15

Getting set up

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 OCA/server-tools

All issues in OCA/server-tools

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.