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

Support Python 3.12 #471

Merged
merged 2 commits into from
Oct 6, 2023
Merged

Support Python 3.12 #471

merged 2 commits into from
Oct 6, 2023

Conversation

jakirkham
Copy link
Member

@jakirkham jakirkham commented Oct 4, 2023

Add support for Python 3.12.


TODO:

  • Unit tests and/or doctests in docstrings
  • Tests pass locally
  • Docstrings and API docs for any new/modified user-facing classes and functions
  • Changes documented in docs/release.rst
  • Docs build locally
  • GitHub Actions CI passes
  • Test coverage to 100% (Codecov passes)

@jakirkham
Copy link
Member Author

jakirkham commented Oct 4, 2023

The macOS Python 3.8 build has a weird error. Snippet below:


  c-blosc/blosc/bitshuffle-avx2.c:22:4: error: AVX2 is not supported by the target architecture/platform and/or this compiler.
    #error AVX2 is not supported by the target architecture/platform and/or this compiler.
     ^
  1 error generated.

Wonder if we should just drop Python 3.8 based on NEP 29. Raising issue ( zarr-developers/community#65 ) to discuss

@jakirkham
Copy link
Member Author

Builds work. Nearly all tests pass

However there is one CI error from the tests. It pertains to entrypoints. Snippet of the error below from CI:

__________________ ERROR at setup of test_entrypoint_codec ____________________

    @pytest.fixture()
    def set_path():
        sys.path.append(here)
>       numcodecs.registry.run_entrypoints()

numcodecs/tests/test_entrypoints.py:15: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def run_entrypoints():
        entries.clear()
        eps = entry_points()
        if hasattr(eps, 'select'):
            # If entry_points() has a select method, use that. Python 3.10+
>           entries.update(eps.select(group="numcodecs.codecs"))
E           ValueError: dictionary update sequence element #0 has length 3; 2 is required

numcodecs/registry.py:16: ValueError

On Python 3.12, the existing code did not produce a `dict` that could be
used to update `entries` whereas previous Python versions had. To
workaround this issue, manually create a `dict` that can be used to
update `entries` with a format consistent to what had been seen in
Python versions before 3.12.
@codecov
Copy link

codecov bot commented Oct 4, 2023

Codecov Report

Merging #471 (49abafe) into main (515d097) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #471   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           56        56           
  Lines         2242      2242           
=========================================
  Hits          2242      2242           
Files Coverage Δ
numcodecs/registry.py 100.00% <100.00%> (ø)

@jakirkham jakirkham marked this pull request as ready for review October 4, 2023 20:00
@jakirkham jakirkham changed the title [WIP] Support Python 3.12 Support Python 3.12 Oct 4, 2023
@jakirkham jakirkham mentioned this pull request Oct 4, 2023
Comment on lines 14 to +16
if hasattr(eps, 'select'):
# If entry_points() has a select method, use that. Python 3.10+
entries.update(eps.select(group="numcodecs.codecs"))
entries.update({e.name: e for e in eps.select(group="numcodecs.codecs")})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martindurant could you please take a look at this change?

@jakirkham
Copy link
Member Author

cc @joshmoore @MSanKeys963 @rabernat (in case any of you have time to review)

@jakirkham
Copy link
Member Author

Going to go ahead and merge to get the release out. Hope that is ok

Happy to discuss further as needed

@jakirkham jakirkham merged commit 680d020 into zarr-developers:main Oct 6, 2023
27 checks passed
@jakirkham jakirkham deleted the py312 branch October 6, 2023 18:06
DimitriPapadopoulos pushed a commit to DimitriPapadopoulos/numcodecs that referenced this pull request Aug 10, 2024
* Support Python 3.12

* Ensure `entries.update(...)` recieves a `dict`

On Python 3.12, the existing code did not produce a `dict` that could be
used to update `entries` whereas previous Python versions had. To
workaround this issue, manually create a `dict` that can be used to
update `entries` with a format consistent to what had been seen in
Python versions before 3.12.
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 this pull request may close these issues.

1 participant