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

classmethod properties are removed in Python 3.13 #553

Closed
QuLogic opened this issue Jul 21, 2024 · 3 comments · Fixed by #578
Closed

classmethod properties are removed in Python 3.13 #553

QuLogic opened this issue Jul 21, 2024 · 3 comments · Fixed by #578

Comments

@QuLogic
Copy link
Contributor

QuLogic commented Jul 21, 2024

Problem description

This was added in #519:

@classmethod
@property
def default_level(cls):
"""Returns the default compression level of the underlying zstd library."""
return ZSTD_defaultCLevel()
@classmethod
@property
def min_level(cls):
"""Returns the minimum compression level of the underlying zstd library."""
return ZSTD_minCLevel()
@classmethod
@property
def max_level(cls):
"""Returns the maximum compression level of the underlying zstd library."""
return ZSTD_maxCLevel()

However, as of Python 3.11, using classmethod on property was deprecated, and has been removed in Python 3.13:
https://docs.python.org/3.13/library/functions.html#classmethod

Deprecated since version 3.11, removed in version 3.13: Class methods can no longer wrap other descriptors such as property().

This causes tests to fail on Python 3.13:

____________________________ test_native_functions _____________________________
    def test_native_functions():
        # Note, these assertions might need to be changed for new versions of zstd
>       assert Zstd.default_level == 3
E       AssertionError: assert <bound method default_level of <class 'numcodecs.zstd.Zstd'>> == 3
E        +  where <bound method default_level of <class 'numcodecs.zstd.Zstd'>> = Zstd.default_level
../../BUILDROOT/usr/lib64/python3.13/site-packages/numcodecs/tests/test_zstd.py:93: AssertionError

https://kojipkgs.fedoraproject.org/work/tasks/9111/120819111/build.log

Version and installation information

Please provide the following:

  • Value of numcodecs.__version__ 0.13.0
  • Version of Python interpreter 3.13.0b3
  • Operating system (Linux/Windows/Mac) Fedora Rawhide
  • How NumCodecs was installed (e.g., "using pip into virtual environment", or "using conda") from source
@QuLogic
Copy link
Contributor Author

QuLogic commented Sep 13, 2024

Ping? We're less than a month away from Python 3.13 final.

@dstansby
Copy link
Contributor

I guess a blocker to this is running tests on Python 3.13. Do you know the best way to test on pre-release Python these days? We're currently using conda to manage Python in the tests, which last time I checked didn't ship pre-release versions of Python, but I'm open to moving to another way of managing Python in CI if it gives us pre-release Python.

@QuLogic
Copy link
Contributor Author

QuLogic commented Sep 14, 2024

For Matplotlib, we use actions/setup-python@v5 with allow-prereleases: true and the usual pip install. I don't know about all numcodecs dependencies though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants