globaldothealth / adtl

Another data transformation language
https://adtl.readthedocs.io
MIT License
1 stars 0 forks source link

Import error with Python 3.13 #97

Open jsbrittain opened 1 week ago

jsbrittain commented 1 week ago

adtl does not import under Python 3.13 (latest release version). This appears to be due to the new stricter frozen dataclass hierarchies. In particular, the issue seems to relate to pint, and if you import pint you get a very similar error to the one seen below (see https://github.com/hgrecco/pint/issues/ 1969; note that the pint issue was raised in April).

Python 3.13.0 (v3.13.0:60403a5409f, Oct  7 2024, 00:37:40) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import adtl
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    import adtl
  File "/Users/jsb/Desktop/ddd/venv/lib/python3.13/site-packages/adtl/__init__.py", line 18, in <module>
    import pint
  File "/Users/jsb/Desktop/ddd/venv/lib/python3.13/site-packages/pint/__init__.py", line 18, in <module>
    from .delegates.formatter._format_helpers import formatter
  File "/Users/jsb/Desktop/ddd/venv/lib/python3.13/site-packages/pint/delegates/__init__.py", line 12, in <module>
    from . import txt_defparser
  File "/Users/jsb/Desktop/ddd/venv/lib/python3.13/site-packages/pint/delegates/txt_defparser/__init__.py", line 12, in <module>
    from .defparser import DefParser
  File "/Users/jsb/Desktop/ddd/venv/lib/python3.13/site-packages/pint/delegates/txt_defparser/defparser.py", line 10, in <module>
    from . import block, common, context, defaults, group, plain, system
  File "/Users/jsb/Desktop/ddd/venv/lib/python3.13/site-packages/pint/delegates/txt_defparser/common.py", line 23, in <module>
    @dataclass(frozen=True)
     ~~~~~~~~~^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/dataclasses.py", line 1295, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
                          frozen, match_args, kw_only, slots,
                          weakref_slot)
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/dataclasses.py", line 1043, in _process_class
    raise TypeError('cannot inherit frozen dataclass from a '
                    'non-frozen one')
TypeError: cannot inherit frozen dataclass from a non-frozen one
>>>
pipliggins commented 3 days ago

Thanks for raising this @jsbrittain - seems like supporting 3.13 will be blocked until the Pint issue is resolved. I'll mirror what you have done for InsightBoard and add a label to the docs indicating 3.13 is not currently supported.