-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Hello. I have used this library a handful of times over the years and it has been helpful to me.
Recently, however, on Python 3.9 I have seen failing builds due to the dependence on dataclasses
. After installing ecological
, all further pip commands throw errors like this:
Traceback (most recent call last):
File "/install/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
File "/install/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/install/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/install/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/install/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "/install/lib/python3.9/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "/install/lib/python3.9/site-packages/pip/_internal/configuration.py", line 20, in <module>
from pip._internal.exceptions import (
File "/install/lib/python3.9/site-packages/pip/_internal/exceptions.py", line 14, in <module>
from pip._vendor.rich.console import Console, ConsoleOptions, RenderResult
File "/install/lib/python3.9/site-packages/pip/_vendor/rich/console.py", line 55, in <module>
from .pretty import Pretty, is_expandable
File "/install/lib/python3.9/site-packages/pip/_vendor/rich/pretty.py", line 366, in <module>
class Node:
File "/install/lib/python3.9/site-packages/dataclasses.py", line 958, in dataclass
return wrap(_cls)
File "/install/lib/python3.9/site-packages/dataclasses.py", line 950, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
File "/install/lib/python3.9/site-packages/dataclasses.py", line 800, in _process_class
cls_fields = [_get_field(cls, name, type)
File "/install/lib/python3.9/site-packages/dataclasses.py", line 800, in <listcomp>
cls_fields = [_get_field(cls, name, type)
File "/install/lib/python3.9/site-packages/dataclasses.py", line 659, in _get_field
if (_is_classvar(a_type, typing)
File "/install/lib/python3.9/site-packages/dataclasses.py", line 550, in _is_classvar
return type(a_type) is typing._ClassVar
AttributeError: module 'typing' has no attribute '_ClassVar'
When ecological
is removed as a dependency (or copied and built without dataclasses
) the error goes away.
My request is to change the pyproject.toml for this project to stop supporting python 3.6 and remove the dependency on dataclasses:
[tool.poetry.dependencies]
python = "^3.7"
There is a precedent for other Python libraries recently dropping support for Python3.6.
Alternatively, I know that with a setup.py
, it's possible to specify a dependency like dataclasses
only if using an earlier Python version. For instance, in a setup.py
, the following would work:
install_requires=["dataclasses>=0.7;python_version<'3.7'"]
I believe that the pyproject.toml for this project may be modified in the following way to achieve this:
dataclasses = {version = "0.6", markers = "python_version < '3.7'"}