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

WIP: Enable PyPy #409

Closed
wants to merge 7 commits into from
Closed

Conversation

jakirkham
Copy link
Member

Add PyPy 3.9 to CI.

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

There are a couple test failures, but surprisingly not that many

=================================== FAILURES ===================================
______________________________ test_encode_decode ______________________________

    def test_encode_decode():
        for arr, codec in itertools.product(arrays, codecs):
>           check_encode_decode(arr, codec)

numcodecs/tests/test_lzma.py:53: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
numcodecs/tests/common.py:59: in check_encode_decode
    compare_arrays(arr, dec, precision=precision)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

arr = array([  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,
        13,  14,  15,  16,  17,  18,  19,  20,...1, 982, 983, 984, 985, 986, 987,
       988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999],
      dtype=int32)
res = array([  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,
        13,  14,  15,  16,  17,  18,  19,  20,..., 232, 233,
       234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246,
       247, 248, 249], dtype=int32)
precision = None

    def compare_arrays(arr, res, precision=None):
    
        # ensure numpy array with matching dtype
        res = ensure_ndarray(res).view(arr.dtype)
    
        # convert to correct shape
        if arr.flags.f_contiguous:
            order = 'F'
        else:
            order = 'C'
>       res = res.reshape(arr.shape, order=order)
E       ValueError: cannot reshape array of size 250 into shape (1000,)

numcodecs/tests/common.py:34: ValueError
_______________________________ test_encode_none _______________________________

    def test_encode_none():
        a = np.array([b'foo', None, b'bar'], dtype=object)
        codec = VLenBytes()
>       enc = codec.encode(a)

numcodecs/tests/test_vlen_bytes.py:85: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   store_le32(<uint8_t*>data, l)
E   TypeError: expected bytes, NoneType found

numcodecs/vlen.pyx:250: TypeError

---------- coverage: platform linux, python 3.9.18-final-0 -----------
Coverage XML written to file coverage.xml

=========================== short test summary info ============================
FAILED numcodecs/tests/test_lzma.py::test_encode_decode - ValueError: cannot reshape array of size 250 into shape (1000,)
FAILED numcodecs/tests/test_vlen_bytes.py::test_encode_none - TypeError: expected bytes, NoneType found
======= 2 failed, 582 passed, 35 skipped, 36 xfailed in 75.66s (0:01:15) =======

These may not have been part of Cython in the past. Now that they are,
`cimport` them instead of using `extern`.
Needed for `PyUnicode_FromStringAndSize`, which wasn't added until
Cython 3.0.0. Other `unicode` and `bytearray` operations have been
around longer, but this one is relatively new.
@jakirkham jakirkham mentioned this pull request Oct 20, 2023
@dstansby dstansby mentioned this pull request Aug 10, 2024
7 tasks
@dstansby dstansby closed this Aug 25, 2024
Copy link

codecov bot commented Aug 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (c58f210) to head (3cfd739).
Report is 105 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #409   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           57        57           
  Lines         2261      2261           
=========================================
  Hits          2261      2261           
---- 🚨 Try these New Features:

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

Successfully merging this pull request may close these issues.

2 participants