Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test fail against Python 3.13-dev with a Pint error #2320

Closed
simonw opened this issue Apr 14, 2024 · 4 comments
Closed

Test fail against Python 3.13-dev with a Pint error #2320

simonw opened this issue Apr 14, 2024 · 4 comments

Comments

@simonw
Copy link
Owner

simonw commented Apr 14, 2024

I think there may be an issue with Pint - I just hit this error with Python 3.13 on my local machine:

Traceback (most recent call last):
  File "/Users/simon/.local/share/virtualenvs/ohno-fc4nBpYX/bin/datasette", line 5, in <module>
    from datasette.cli import cli
  File "/Users/simon/.local/share/virtualenvs/ohno-fc4nBpYX/lib/python3.13/site-packages/datasette/cli.py", line 17, in <module>
    from .app import (
    ...<6 lines>...
    )
  File "/Users/simon/.local/share/virtualenvs/ohno-fc4nBpYX/lib/python3.13/site-packages/datasette/app.py", line 29, in <module>
    from .views.base import ureg
  File "/Users/simon/.local/share/virtualenvs/ohno-fc4nBpYX/lib/python3.13/site-packages/datasette/views/base.py", line 37, in <module>
    ureg = pint.UnitRegistry()
           ~~~~~~~~~~~~~~~~~^^
  File "/Users/simon/.local/share/virtualenvs/ohno-fc4nBpYX/lib/python3.13/site-packages/pint/facets/plain/registry.py", line 157, in __call__
    obj = super().__call__(*args, **kwargs)
          ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/simon/.local/share/virtualenvs/ohno-fc4nBpYX/lib/python3.13/site-packages/pint/registry.py", line 129, in __init__
    super().__init__(
    ~~~~~~~~~~~~~~~~^
        filename=filename,
        ^^^^^^^^^^^^^^^^^^
    ...<12 lines>...
        cache_folder=cache_folder,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/simon/.local/share/virtualenvs/ohno-fc4nBpYX/lib/python3.13/site-packages/pint/facets/system/registry.py", line 57, in __init__
    super().__init__(**kwargs)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/Users/simon/.local/share/virtualenvs/ohno-fc4nBpYX/lib/python3.13/site-packages/pint/facets/group/registry.py", line 48, in __init__
    super().__init__(**kwargs)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/Users/simon/.local/share/virtualenvs/ohno-fc4nBpYX/lib/python3.13/site-packages/pint/facets/context/registry.py", line 69, in __init__
    super().__init__(**kwargs)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/Users/simon/.local/share/virtualenvs/ohno-fc4nBpYX/lib/python3.13/site-packages/pint/facets/nonmultiplicative/registry.py", line 50, in __init__
    super().__init__(**kwargs)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/Users/simon/.local/share/virtualenvs/ohno-fc4nBpYX/lib/python3.13/site-packages/pint/facets/plain/registry.py", line 247, in __init__
    from ... import delegates  # TODO: change thiss
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/simon/.local/share/virtualenvs/ohno-fc4nBpYX/lib/python3.13/site-packages/pint/delegates/__init__.py", line 11, in <module>
    from . import txt_defparser
  File "/Users/simon/.local/share/virtualenvs/ohno-fc4nBpYX/lib/python3.13/site-packages/pint/delegates/txt_defparser/__init__.py", line 12, in <module>
    from .defparser import DefParser
  File "/Users/simon/.local/share/virtualenvs/ohno-fc4nBpYX/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/simon/.local/share/virtualenvs/ohno-fc4nBpYX/lib/python3.13/site-packages/pint/delegates/txt_defparser/common.py", line 21, in <module>
    @dataclass(frozen=True)
     ~~~~~~~~~^^^^^^^^^^^^^
  File "/Users/simon/.pyenv/versions/3.13-dev/lib/python3.13/dataclasses.py", line 1247, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                          frozen, match_args, kw_only, slots,
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                          weakref_slot)
                          ^^^^^^^^^^^^^
  File "/Users/simon/.pyenv/versions/3.13-dev/lib/python3.13/dataclasses.py", line 1015, in _process_class
    raise TypeError('cannot inherit frozen dataclass from a '
                    'non-frozen one')
TypeError: cannot inherit frozen dataclass from a non-frozen one
@simonw
Copy link
Owner Author

simonw commented Apr 14, 2024

https://devguide.python.org/versions/ says that Python 3.13 is scheduled for release in October 2024.

@simonw
Copy link
Owner Author

simonw commented Apr 14, 2024

Got that same Pint error in CI: https://github.com/simonw/datasette/actions/runs/8681173571/job/23803398510?pr=2321

/opt/hostedtoolcache/Python/3.13.0-alpha.6/x64/lib/python3.13/site-packages/pint/delegates/txt_defparser/common.py:21: in <module>
    @dataclass(frozen=True)
/opt/hostedtoolcache/Python/3.13.0-alpha.6/x64/lib/python3.13/dataclasses.py:1289: in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
/opt/hostedtoolcache/Python/3.13.0-alpha.6/x64/lib/python3.13/dataclasses.py:1044: in _process_class
    raise TypeError('cannot inherit frozen dataclass from a '
E   TypeError: cannot inherit frozen dataclass from a non-frozen one

@simonw
Copy link
Owner Author

simonw commented Apr 14, 2024

We currently pin to:

"pint>=0.9",

The most recent version is 0.23 from December 2023: https://github.com/hgrecco/pint/releases/tag/0.23

The only open issue I can find in Pint that relates to dataclasses is this one:

Which links to this:

Unclear if either of those relate to the error I am seeing though.

@simonw
Copy link
Owner Author

simonw commented Apr 14, 2024

@simonw simonw changed the title Test against Python 3.13-dev Test fail against Python 3.13-dev with a Pint error Apr 14, 2024
simonw added a commit that referenced this issue Aug 21, 2024
simonw added a commit that referenced this issue Aug 21, 2024
@simonw simonw closed this as completed Aug 21, 2024
simonw added a commit that referenced this issue Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant