ramonhagenaars / nptyping

💡 Type hints for Numpy and Pandas
MIT License
593 stars 30 forks source link

2.3.0: pytest is failing #89

Open kloczek opened 2 years ago

kloczek commented 2 years ago

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-nptyping-2.3.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-nptyping-2.3.0-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra --ignore tests/test_package_info.py =========================================================================== test session starts ============================================================================ platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/nptyping-2.3.0 plugins: typeguard-2.13.3 collected 91 items tests/test_assert_isinstance.py ... [ 3%] tests/test_base_meta_classes.py ......... [ 13%] tests/test_beartype.py .... [ 17%] tests/test_lib_export.py . [ 18%] tests/test_mypy.py FFFFFFFFFF. [ 30%] tests/test_ndarray.py .......................... [ 59%] tests/test_performance.py . [ 60%] tests/test_pyright.py .. [ 62%] tests/test_recarray.py ... [ 65%] tests/test_shape.py ..... [ 71%] tests/test_shape_expression.py ... [ 74%] tests/test_structure.py ........ [ 83%] tests/test_structure_expression.py ........ [ 92%] tests/test_typeguard.py .... [ 96%] tests/test_wheel.py F.. [100%] ================================================================================= FAILURES ================================================================================= _______________________________________________________________ MyPyTest.test_mypy_accepts_ndarray_with_any ________________________________________________________________ self = def test_mypy_accepts_ndarray_with_any(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any from nptyping import NDArray NDArray[Any, Any] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:26: AssertionError ______________________________________________________________ MyPyTest.test_mypy_accepts_ndarray_with_shape _______________________________________________________________ self = def test_mypy_accepts_ndarray_with_shape(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any from nptyping import NDArray, Shape NDArray[Shape["3, 3"], Any] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:39: AssertionError ____________________________________________________________ MyPyTest.test_mypy_accepts_ndarray_with_structure _____________________________________________________________ self = def test_mypy_accepts_ndarray_with_structure(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any from nptyping import NDArray, RecArray, Structure NDArray[Any, Structure["x: Float, y: Int"]] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:52: AssertionError ________________________________________________________ MyPyTest.test_mypy_accepts_ndarrays_as_function_arguments _________________________________________________________ self = def test_mypy_accepts_ndarrays_as_function_arguments(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import NDArray, Shape def func(_: NDArray[Shape["2, 2"], Any]) -> None: ... func(np.array([1, 2])) # (Wrong shape though) """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:90: AssertionError __________________________________________________________ MyPyTest.test_mypy_accepts_ndarrays_as_variable_hints ___________________________________________________________ self = def test_mypy_accepts_ndarrays_as_variable_hints(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import NDArray arr: NDArray[Any, Any] = np.array([1, 2, 3]) """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:104: AssertionError ________________________________________________________________ MyPyTest.test_mypy_accepts_nptyping_types _________________________________________________________________ self = def test_mypy_accepts_nptyping_types(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any import numpy as np import numpy.typing as npt from nptyping import ( NDArray, Number, Bool, Bool8, Object, Object0, Datetime64, Integer, SignedInteger, Int8, Int16, Int32, Int64, Byte, Short, IntC, IntP, Int0, Int, LongLong, Timedelta64, UnsignedInteger, UInt8, UInt16, UInt32, UInt64, UByte, UShort, UIntC, UIntP, UInt0, UInt, ULongLong, Inexact, Floating, Float16, Float32, Float64, Half, Single, Double, Float, LongDouble, LongFloat, ComplexFloating, Complex64, Complex128, CSingle, SingleComplex, CDouble, Complex, CFloat, CLongDouble, CLongFloat, LongComplex, Flexible, Void, Void0, Character, Bytes, String, Bytes0, Unicode, Str0, ) NDArray[Any, Number] NDArray[Any, Bool] NDArray[Any, Bool8] NDArray[Any, Object] NDArray[Any, Object0] NDArray[Any, Datetime64] NDArray[Any, Integer] NDArray[Any, SignedInteger] NDArray[Any, Int8] NDArray[Any, Int16] NDArray[Any, Int32] NDArray[Any, Int64] NDArray[Any, Byte] NDArray[Any, Short] NDArray[Any, IntC] NDArray[Any, IntP] NDArray[Any, Int0] NDArray[Any, Int] NDArray[Any, LongLong] NDArray[Any, Timedelta64] NDArray[Any, UnsignedInteger] NDArray[Any, UInt8] NDArray[Any, UInt16] NDArray[Any, UInt32] NDArray[Any, UInt64] NDArray[Any, UByte] NDArray[Any, UShort] NDArray[Any, UIntC] NDArray[Any, UIntP] NDArray[Any, UInt0] NDArray[Any, UInt] NDArray[Any, ULongLong] NDArray[Any, Inexact] NDArray[Any, Floating] NDArray[Any, Float16] NDArray[Any, Float32] NDArray[Any, Float64] NDArray[Any, Half] NDArray[Any, Single] NDArray[Any, Double] NDArray[Any, Float] NDArray[Any, LongDouble] NDArray[Any, LongFloat] NDArray[Any, ComplexFloating] NDArray[Any, Complex64] NDArray[Any, Complex128] NDArray[Any, CSingle] NDArray[Any, SingleComplex] NDArray[Any, CDouble] NDArray[Any, Complex] NDArray[Any, CFloat] NDArray[Any, CLongDouble] NDArray[Any, CLongFloat] NDArray[Any, LongComplex] NDArray[Any, Flexible] NDArray[Any, Void] NDArray[Any, Void0] NDArray[Any, Character] NDArray[Any, Bytes] NDArray[Any, String] NDArray[Any, Bytes0] NDArray[Any, Unicode] NDArray[Any, Str0] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:312: AssertionError __________________________________________________________________ MyPyTest.test_mypy_accepts_numpy_types __________________________________________________________________ self = def test_mypy_accepts_numpy_types(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any from nptyping import NDArray import numpy as np NDArray[Any, np.dtype[np.int_]] NDArray[Any, np.dtype[np.float_]] NDArray[Any, np.dtype[np.uint8]] NDArray[Any, np.dtype[np.bool_]] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:134: AssertionError ____________________________________________________________ MyPyTest.test_mypy_accepts_recarray_with_structure ____________________________________________________________ self = def test_mypy_accepts_recarray_with_structure(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any from nptyping import RecArray, Structure RecArray[Any, Structure["x: Float, y: Int"]] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:117: AssertionError ___________________________________________________ MyPyTest.test_mypy_disapproves_ndarray_with_wrong_function_arguments ___________________________________________________ self = def test_mypy_disapproves_ndarray_with_wrong_function_arguments(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import NDArray, Shape def func(_: NDArray[Shape["2, 2"], Any]) -> None: ... func("Not an array...") """ ) self.assertIn('Argument 1 to "func" has incompatible type "str"', stdout) self.assertIn('expected "ndarray[Any, Any]"', stdout) > self.assertIn("Found 1 error in 1 file", stdout) E AssertionError: 'Found 1 error in 1 file' not found in 'nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc]\nnptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment\n/tmp/tmpmb3qsf1a/test_file.py:10: error: Argument 1 to "func" has incompatible type "str"; expected "ndarray[Any, Any]" [arg-type]\nFound 2 errors in 2 files (checked 1 source file)\n' tests/test_mypy.py:72: AssertionError _______________________________________________________________ MyPyTest.test_mypy_knows_of_ndarray_methods ________________________________________________________________ self = def test_mypy_knows_of_ndarray_methods(self): # If MyPy knows of some arbitrary ndarray methods, we can assume that # code completion works. exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any from nptyping import NDArray arr: NDArray[Any, Any] arr.shape arr.size arr.sort arr.squeeze arr.transpose """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:171: AssertionError _________________________________________________________________ WheelTest.test_wheel_is_built_correctly __________________________________________________________________ self = def test_wheel_is_built_correctly(self): with working_dir(_ROOT): > subprocess.check_output(f"{sys.executable} -m invoke wheel", shell=True) tests/test_wheel.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True, popenargs = ('/usr/bin/python3 -m invoke wheel',), kwargs = {'shell': True, 'stdout': -1} process = , stdout = b'', stderr = None, retcode = 1 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '/usr/bin/python3 -m invoke wheel' returned non-zero exit status 1. /usr/lib64/python3.8/subprocess.py:516: CalledProcessError --------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------- /usr/bin/python3: No module named invoke ============================================================================= warnings summary ============================================================================= ../../../../../usr/lib64/python3.8/unittest/loader.py:66 /usr/lib64/python3.8/unittest/loader.py:66: PytestCollectionWarning: cannot collect test class 'TestLoader' because it has a __init__ constructor (from: tests/test_wheel.py) class TestLoader(object): -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ========================================================================= short test summary info ========================================================================== FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_any - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dty... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_shape - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "d... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_structure - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final clas... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarrays_as_function_arguments - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from fi... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarrays_as_variable_hints - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final ... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_nptyping_types - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_numpy_types - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" ... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_recarray_with_structure - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final cla... FAILED tests/test_mypy.py::MyPyTest::test_mypy_disapproves_ndarray_with_wrong_function_arguments - AssertionError: 'Found 1 error in 1 file' not found in 'nptyping/struc... FAILED tests/test_mypy.py::MyPyTest::test_mypy_knows_of_ndarray_methods - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dty... FAILED tests/test_wheel.py::WheelTest::test_wheel_is_built_correctly - subprocess.CalledProcessError: Command '/usr/bin/python3 -m invoke wheel' returned non-zero exit s... ================================================================ 11 failed, 80 passed, 1 warning in 41.36s ================================================================= ```

Here is list of installed modules in build env

```console Package Version ----------------- -------------- appdirs 1.4.4 attrs 22.1.0 beartype 0.10.4 Brlapi 0.8.3 build 0.8.0 codespell 2.1.0 cssselect 1.1.0 distro 1.7.0 extras 1.0.0 fixtures 4.0.0 gpg 1.17.1-unknown iniconfig 1.1.1 libcomps 0.1.18 louis 3.22.0 lxml 4.9.1 mypy 0.971 mypy-extensions 0.4.3 nodeenv 1.7.0 numpy 1.23.1 packaging 21.3 pbr 5.9.0 pep517 0.12.0 pip 22.2.1 pluggy 1.0.0 py 1.11.0 PyGObject 3.42.2 pyparsing 3.0.9 pyright 1.1.268 pytest 7.1.2 python-dateutil 2.8.2 rpm 4.17.0 scour 0.38.2 setuptools 65.3.0 six 1.16.0 testtools 2.5.0 tomli 2.0.1 typeguard 2.13.3 typing_extensions 4.2.0 wheel 0.37.1 ```
kloczek commented 2 years ago

With installed invoke, lexicon, pyyaml and fluidity-sm

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-nptyping-2.3.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-nptyping-2.3.0-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra --ignore tests/test_package_info.py =========================================================================== test session starts ============================================================================ platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/nptyping-2.3.0 plugins: typeguard-2.13.3 collected 91 items tests/test_assert_isinstance.py ... [ 3%] tests/test_base_meta_classes.py ......... [ 13%] tests/test_beartype.py .... [ 17%] tests/test_lib_export.py . [ 18%] tests/test_mypy.py FFFFFFFFFF. [ 30%] tests/test_ndarray.py .......................... [ 59%] tests/test_performance.py . [ 60%] tests/test_pyright.py .. [ 62%] tests/test_recarray.py ... [ 65%] tests/test_shape.py ..... [ 71%] tests/test_shape_expression.py ... [ 74%] tests/test_structure.py ........ [ 83%] tests/test_structure_expression.py ........ [ 92%] tests/test_typeguard.py .... [ 96%] tests/test_wheel.py F.. [100%] ================================================================================= FAILURES ================================================================================= _______________________________________________________________ MyPyTest.test_mypy_accepts_ndarray_with_any ________________________________________________________________ self = def test_mypy_accepts_ndarray_with_any(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any from nptyping import NDArray NDArray[Any, Any] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:26: AssertionError ______________________________________________________________ MyPyTest.test_mypy_accepts_ndarray_with_shape _______________________________________________________________ self = def test_mypy_accepts_ndarray_with_shape(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any from nptyping import NDArray, Shape NDArray[Shape["3, 3"], Any] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:39: AssertionError ____________________________________________________________ MyPyTest.test_mypy_accepts_ndarray_with_structure _____________________________________________________________ self = def test_mypy_accepts_ndarray_with_structure(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any from nptyping import NDArray, RecArray, Structure NDArray[Any, Structure["x: Float, y: Int"]] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:52: AssertionError ________________________________________________________ MyPyTest.test_mypy_accepts_ndarrays_as_function_arguments _________________________________________________________ self = def test_mypy_accepts_ndarrays_as_function_arguments(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import NDArray, Shape def func(_: NDArray[Shape["2, 2"], Any]) -> None: ... func(np.array([1, 2])) # (Wrong shape though) """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:90: AssertionError __________________________________________________________ MyPyTest.test_mypy_accepts_ndarrays_as_variable_hints ___________________________________________________________ self = def test_mypy_accepts_ndarrays_as_variable_hints(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import NDArray arr: NDArray[Any, Any] = np.array([1, 2, 3]) """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:104: AssertionError ________________________________________________________________ MyPyTest.test_mypy_accepts_nptyping_types _________________________________________________________________ self = def test_mypy_accepts_nptyping_types(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any import numpy as np import numpy.typing as npt from nptyping import ( NDArray, Number, Bool, Bool8, Object, Object0, Datetime64, Integer, SignedInteger, Int8, Int16, Int32, Int64, Byte, Short, IntC, IntP, Int0, Int, LongLong, Timedelta64, UnsignedInteger, UInt8, UInt16, UInt32, UInt64, UByte, UShort, UIntC, UIntP, UInt0, UInt, ULongLong, Inexact, Floating, Float16, Float32, Float64, Half, Single, Double, Float, LongDouble, LongFloat, ComplexFloating, Complex64, Complex128, CSingle, SingleComplex, CDouble, Complex, CFloat, CLongDouble, CLongFloat, LongComplex, Flexible, Void, Void0, Character, Bytes, String, Bytes0, Unicode, Str0, ) NDArray[Any, Number] NDArray[Any, Bool] NDArray[Any, Bool8] NDArray[Any, Object] NDArray[Any, Object0] NDArray[Any, Datetime64] NDArray[Any, Integer] NDArray[Any, SignedInteger] NDArray[Any, Int8] NDArray[Any, Int16] NDArray[Any, Int32] NDArray[Any, Int64] NDArray[Any, Byte] NDArray[Any, Short] NDArray[Any, IntC] NDArray[Any, IntP] NDArray[Any, Int0] NDArray[Any, Int] NDArray[Any, LongLong] NDArray[Any, Timedelta64] NDArray[Any, UnsignedInteger] NDArray[Any, UInt8] NDArray[Any, UInt16] NDArray[Any, UInt32] NDArray[Any, UInt64] NDArray[Any, UByte] NDArray[Any, UShort] NDArray[Any, UIntC] NDArray[Any, UIntP] NDArray[Any, UInt0] NDArray[Any, UInt] NDArray[Any, ULongLong] NDArray[Any, Inexact] NDArray[Any, Floating] NDArray[Any, Float16] NDArray[Any, Float32] NDArray[Any, Float64] NDArray[Any, Half] NDArray[Any, Single] NDArray[Any, Double] NDArray[Any, Float] NDArray[Any, LongDouble] NDArray[Any, LongFloat] NDArray[Any, ComplexFloating] NDArray[Any, Complex64] NDArray[Any, Complex128] NDArray[Any, CSingle] NDArray[Any, SingleComplex] NDArray[Any, CDouble] NDArray[Any, Complex] NDArray[Any, CFloat] NDArray[Any, CLongDouble] NDArray[Any, CLongFloat] NDArray[Any, LongComplex] NDArray[Any, Flexible] NDArray[Any, Void] NDArray[Any, Void0] NDArray[Any, Character] NDArray[Any, Bytes] NDArray[Any, String] NDArray[Any, Bytes0] NDArray[Any, Unicode] NDArray[Any, Str0] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:312: AssertionError __________________________________________________________________ MyPyTest.test_mypy_accepts_numpy_types __________________________________________________________________ self = def test_mypy_accepts_numpy_types(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any from nptyping import NDArray import numpy as np NDArray[Any, np.dtype[np.int_]] NDArray[Any, np.dtype[np.float_]] NDArray[Any, np.dtype[np.uint8]] NDArray[Any, np.dtype[np.bool_]] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:134: AssertionError ____________________________________________________________ MyPyTest.test_mypy_accepts_recarray_with_structure ____________________________________________________________ self = def test_mypy_accepts_recarray_with_structure(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any from nptyping import RecArray, Structure RecArray[Any, Structure["x: Float, y: Int"]] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:117: AssertionError ___________________________________________________ MyPyTest.test_mypy_disapproves_ndarray_with_wrong_function_arguments ___________________________________________________ self = def test_mypy_disapproves_ndarray_with_wrong_function_arguments(self): exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import NDArray, Shape def func(_: NDArray[Shape["2, 2"], Any]) -> None: ... func("Not an array...") """ ) self.assertIn('Argument 1 to "func" has incompatible type "str"', stdout) self.assertIn('expected "ndarray[Any, Any]"', stdout) > self.assertIn("Found 1 error in 1 file", stdout) E AssertionError: 'Found 1 error in 1 file' not found in 'nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc]\nnptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment\n/tmp/tmpztiv4ptc/test_file.py:10: error: Argument 1 to "func" has incompatible type "str"; expected "ndarray[Any, Any]" [arg-type]\nFound 2 errors in 2 files (checked 1 source file)\n' tests/test_mypy.py:72: AssertionError _______________________________________________________________ MyPyTest.test_mypy_knows_of_ndarray_methods ________________________________________________________________ self = def test_mypy_knows_of_ndarray_methods(self): # If MyPy knows of some arbitrary ndarray methods, we can assume that # code completion works. exit_code, stdout, stderr = _check_mypy_on_code( """ from typing import Any from nptyping import NDArray arr: NDArray[Any, Any] arr.shape arr.size arr.sort arr.squeeze arr.transpose """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" [misc] E nptyping/structure.pyi:37: note: Error code "misc" not covered by "type: ignore" comment E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:171: AssertionError _________________________________________________________________ WheelTest.test_wheel_is_built_correctly __________________________________________________________________ self = def test_wheel_is_built_correctly(self): with working_dir(_ROOT): > subprocess.check_output(f"{sys.executable} -m invoke wheel", shell=True) tests/test_wheel.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True, popenargs = ('/usr/bin/python3 -m invoke wheel',), kwargs = {'shell': True, 'stdout': -1} process = , stdout = b'Installing dependencies into: .venv3.8.13\n', stderr = None, retcode = 127 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '/usr/bin/python3 -m invoke wheel' returned non-zero exit status 127. /usr/lib64/python3.8/subprocess.py:516: CalledProcessError --------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------- /bin/bash: line 1: .venv3.8.13/bin/python: No such file or directory ============================================================================= warnings summary ============================================================================= ../../../../../usr/lib64/python3.8/unittest/loader.py:66 /usr/lib64/python3.8/unittest/loader.py:66: PytestCollectionWarning: cannot collect test class 'TestLoader' because it has a __init__ constructor (from: tests/test_wheel.py) class TestLoader(object): -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ========================================================================= short test summary info ========================================================================== FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_any - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dty... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_shape - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "d... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_structure - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final clas... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarrays_as_function_arguments - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from fi... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarrays_as_variable_hints - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final ... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_nptyping_types - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_numpy_types - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dtype" ... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_recarray_with_structure - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final cla... FAILED tests/test_mypy.py::MyPyTest::test_mypy_disapproves_ndarray_with_wrong_function_arguments - AssertionError: 'Found 1 error in 1 file' not found in 'nptyping/struc... FAILED tests/test_mypy.py::MyPyTest::test_mypy_knows_of_ndarray_methods - AssertionError: 0 != 1 : nptyping/structure.pyi:37: error: Cannot inherit from final class "dty... FAILED tests/test_wheel.py::WheelTest::test_wheel_is_built_correctly - subprocess.CalledProcessError: Command '/usr/bin/python3 -m invoke wheel' returned non-zero exit s... ================================================================ 11 failed, 80 passed, 1 warning in 39.75s ================================================================= ```
ramonhagenaars commented 2 years ago

The majority of the errors are caused by a difference in the numpy version that is locked in the constraints.txt (1.22.4) and the one you have (1.23.1); apparently numpy marked dtype with @final in that new version. Would it work for you to pin numpy to 1.22.4 until I manage to patch this?

The other error I read is the failure of this command:

/usr/bin/python3 -m invoke wheel

with

/usr/bin/python3: No module named invoke

Can you doublecheck that invoke has been installed on /usr/bin/python3?

kloczek commented 2 years ago

Would it work for you to pin numpy to 1.22.4 until I manage to patch this?

Just checked.

[tkloczko@pers-jacek SPECS]$ grep 'BuildRequires.*python3dist(numpy)' python*
python-cairocffi.spec:#BuildRequires:   python3dist(numpy)
python-cftime.spec:BuildRequires:       python3dist(numpy)
python-colorspacious.spec:BuildRequires:        python3dist(numpy)
python-cython.spec:BuildRequires:       python3dist(numpy)
python-django.spec:BuildRequires:       python3dist(numpy)
python-fsspec.spec:BuildRequires:       python3dist(numpy)
python-hypothesis.spec:BuildRequires:   python3dist(numpy)
python-ipykernel.spec:BuildRequires:    python3dist(numpy)
python-ipyparallel.spec:BuildRequires:  python3dist(numpy)
python-ipython.spec:BuildRequires:      python3dist(numpy)
python-joblib.spec:BuildRequires:       python3dist(numpy)
python-matplotlib.spec:BuildRequires:   python3dist(numpy)
python-myst-nb.spec:BuildRequires:      python3dist(numpy)
python-nb2plots.spec:#BuildRequires:    python3dist(numpy)
python-nptyping.spec:BuildRequires:     python3dist(numpy)
python-pandas.spec:BuildRequires:       python3dist(numpy)
python-partd.spec:BuildRequires:        python3dist(numpy)      >= 1.9
python-pillow.spec:BuildRequires:       python3dist(numpy)
python-pytest-randomly.spec:BuildRequires:      python3dist(numpy)
python-pythran.spec:BuildRequires:      python3dist(numpy)
python-scipy.spec:BuildRequires:        python3dist(numpy)
python-sympy.spec:BuildRequires:        python3dist(numpy)
python-tabulate.spec:BuildRequires:     python3dist(numpy)
python-websockify.spec:BuildRequires:   python3dist(numpy)

None of those modules has any problems with latest numpy. Do you have any plans to update for latest numpy?🤔

Just in case .. so in your opinion those fails are caused by numpy?🤔

/usr/bin/python3: No module named invoke

I've alredy sorted out that and lookd like that missig dependency had no connections with those fails.

ramonhagenaars commented 2 years ago

Do you have any plans to update for latest numpy?🤔

Yes I do plan to find a patch for this, hopefully in the coming days.

Just in case .. so in your opinion those fails are caused by numpy?🤔

At least most of them are caused by numpy marking dtype as final in 1.23.1 (that was not final in 1.22.4), which some type of nptyping inherits from, which causes mypy to complain, which causes those tests to fail.

ramonhagenaars commented 2 years ago

I just released a patch that should take care of most of your errors. Can you please check again against v2.3.1?

kloczek commented 2 years ago

Just tested new version

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-nptyping-2.3.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-nptyping-2.3.1-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra --ignore tests/test_package_info.py =========================================================================== test session starts ============================================================================ platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/nptyping-2.3.1 plugins: typeguard-2.13.3 collected 92 items tests/test_assert_isinstance.py ... [ 3%] tests/test_base_meta_classes.py ......... [ 13%] tests/test_beartype.py .... [ 17%] tests/test_lib_export.py . [ 18%] tests/test_mypy.py ........... [ 30%] tests/test_ndarray.py .......................... [ 58%] tests/test_performance.py . [ 59%] tests/test_pyright.py .. [ 61%] tests/test_recarray.py ... [ 65%] tests/test_shape.py ...... [ 71%] tests/test_shape_expression.py ... [ 75%] tests/test_structure.py ........ [ 83%] tests/test_structure_expression.py ........ [ 92%] tests/test_typeguard.py .... [ 96%] tests/test_wheel.py F.. [100%] ================================================================================= FAILURES ================================================================================= _________________________________________________________________ WheelTest.test_wheel_is_built_correctly __________________________________________________________________ self = def test_wheel_is_built_correctly(self): with working_dir(_ROOT): > subprocess.check_output(f"{sys.executable} -m invoke wheel", shell=True) tests/test_wheel.py:83: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True, popenargs = ('/usr/bin/python3 -m invoke wheel',), kwargs = {'shell': True, 'stdout': -1} process = , stdout = b'Installing dependencies into: .venv3.8.13\n', stderr = None, retcode = 127 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '/usr/bin/python3 -m invoke wheel' returned non-zero exit status 127. /usr/lib64/python3.8/subprocess.py:516: CalledProcessError --------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------- /bin/bash: line 1: .venv3.8.13/bin/python: No such file or directory ============================================================================= warnings summary ============================================================================= ../../../../../usr/lib64/python3.8/unittest/loader.py:66 /usr/lib64/python3.8/unittest/loader.py:66: PytestCollectionWarning: cannot collect test class 'TestLoader' because it has a __init__ constructor (from: tests/test_wheel.py) class TestLoader(object): -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ========================================================================= short test summary info ========================================================================== FAILED tests/test_wheel.py::WheelTest::test_wheel_is_built_correctly - subprocess.CalledProcessError: Command '/usr/bin/python3 -m invoke wheel' returned non-zero exit s... ================================================================= 1 failed, 91 passed, 1 warning in 41.35s ================================================================= ```

So issue has bben solved and new one popped out 😋

kloczek commented 2 years ago

In this case instead sys.executable should be used.

kloczek commented 2 years ago

Correction: tests/test_wheel.py::WheelTest::test_wheel_is_built_correctly has been failing before as well.

kloczek commented 2 years ago

Just tested 2.4.0 and looks like test suite is failing now in mypy related units Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-nptyping-2.4.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-nptyping-2.4.0-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra --deselect tests/test_wheel.py::WheelTest::test_wheel_is_built_correctly --ignore tests/test_package_info.py =========================================================================== test session starts ============================================================================ platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/nptyping-2.4.0 plugins: typeguard-2.13.3 collected 106 items / 1 deselected / 105 selected tests/test_assert_isinstance.py ... [ 2%] tests/test_base_meta_classes.py ......... [ 11%] tests/test_beartype.py .... [ 15%] tests/test_lib_export.py . [ 16%] tests/test_mypy.py FFFFFFFFFF. [ 26%] tests/test_ndarray.py .......................... [ 51%] tests/test_performance.py . [ 52%] tests/test_pyright.py .. [ 54%] tests/test_recarray.py ... [ 57%] tests/test_shape.py ...... [ 62%] tests/test_shape_expression.py ... [ 65%] tests/test_structure.py ........ [ 73%] tests/test_structure_expression.py ......... [ 81%] tests/test_typeguard.py .... [ 85%] tests/test_wheel.py .. [ 87%] tests/pandas_/test_dataframe.py ......... [ 96%] tests/pandas_/test_fork_sync.py . [ 97%] tests/pandas_/test_mypy_dataframe.py FFF [100%] ================================================================================= FAILURES ================================================================================= _______________________________________________________________ MyPyTest.test_mypy_accepts_ndarray_with_any ________________________________________________________________ self = def test_mypy_accepts_ndarray_with_any(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import NDArray NDArray[Any, Any] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/shape.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/shape.pyi:32: error: Literal[...] must have at least one parameter [valid-type] E nptyping/shape.pyi:32: note: Error code "valid-type" not covered by "type: ignore" comment E nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/structure.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/structure.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/structure.pyi:34: error: Literal[...] must have at least one parameter [valid-type] E nptyping/structure.pyi:34: note: Error code "valid-type" not covered by "type: ignore" comment E Found 5 errors in 3 files (checked 1 source file) tests/test_mypy.py:17: AssertionError ______________________________________________________________ MyPyTest.test_mypy_accepts_ndarray_with_shape _______________________________________________________________ self = def test_mypy_accepts_ndarray_with_shape(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import NDArray, Shape NDArray[Shape["3, 3"], Any] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/shape.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/shape.pyi:32: error: Literal[...] must have at least one parameter [valid-type] E nptyping/shape.pyi:32: note: Error code "valid-type" not covered by "type: ignore" comment E nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/structure.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/structure.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/structure.pyi:34: error: Literal[...] must have at least one parameter [valid-type] E nptyping/structure.pyi:34: note: Error code "valid-type" not covered by "type: ignore" comment E Found 5 errors in 3 files (checked 1 source file) tests/test_mypy.py:30: AssertionError ____________________________________________________________ MyPyTest.test_mypy_accepts_ndarray_with_structure _____________________________________________________________ self = def test_mypy_accepts_ndarray_with_structure(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import NDArray, RecArray, Structure NDArray[Any, Structure["x: Float, y: Int"]] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/shape.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/shape.pyi:32: error: Literal[...] must have at least one parameter [valid-type] E nptyping/shape.pyi:32: note: Error code "valid-type" not covered by "type: ignore" comment E nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/structure.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/structure.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/structure.pyi:34: error: Literal[...] must have at least one parameter [valid-type] E nptyping/structure.pyi:34: note: Error code "valid-type" not covered by "type: ignore" comment E Found 5 errors in 3 files (checked 1 source file) tests/test_mypy.py:43: AssertionError ________________________________________________________ MyPyTest.test_mypy_accepts_ndarrays_as_function_arguments _________________________________________________________ self = def test_mypy_accepts_ndarrays_as_function_arguments(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import NDArray, Shape def func(_: NDArray[Shape["2, 2"], Any]) -> None: ... func(np.array([1, 2])) # (Wrong shape though) """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/shape.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/shape.pyi:32: error: Literal[...] must have at least one parameter [valid-type] E nptyping/shape.pyi:32: note: Error code "valid-type" not covered by "type: ignore" comment E nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/structure.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/structure.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/structure.pyi:34: error: Literal[...] must have at least one parameter [valid-type] E nptyping/structure.pyi:34: note: Error code "valid-type" not covered by "type: ignore" comment E Found 5 errors in 3 files (checked 1 source file) tests/test_mypy.py:81: AssertionError __________________________________________________________ MyPyTest.test_mypy_accepts_ndarrays_as_variable_hints ___________________________________________________________ self = def test_mypy_accepts_ndarrays_as_variable_hints(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import NDArray arr: NDArray[Any, Any] = np.array([1, 2, 3]) """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/shape.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/shape.pyi:32: error: Literal[...] must have at least one parameter [valid-type] E nptyping/shape.pyi:32: note: Error code "valid-type" not covered by "type: ignore" comment E nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/structure.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/structure.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/structure.pyi:34: error: Literal[...] must have at least one parameter [valid-type] E nptyping/structure.pyi:34: note: Error code "valid-type" not covered by "type: ignore" comment E Found 5 errors in 3 files (checked 1 source file) tests/test_mypy.py:95: AssertionError ________________________________________________________________ MyPyTest.test_mypy_accepts_nptyping_types _________________________________________________________________ self = def test_mypy_accepts_nptyping_types(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any import numpy as np import numpy.typing as npt from nptyping import ( NDArray, Number, Bool, Bool8, Object, Object0, Datetime64, Integer, SignedInteger, Int8, Int16, Int32, Int64, Byte, Short, IntC, IntP, Int0, Int, LongLong, Timedelta64, UnsignedInteger, UInt8, UInt16, UInt32, UInt64, UByte, UShort, UIntC, UIntP, UInt0, UInt, ULongLong, Inexact, Floating, Float16, Float32, Float64, Half, Single, Double, Float, LongDouble, LongFloat, ComplexFloating, Complex64, Complex128, CSingle, SingleComplex, CDouble, Complex, CFloat, CLongDouble, CLongFloat, LongComplex, Flexible, Void, Void0, Character, Bytes, String, Bytes0, Unicode, Str0, ) NDArray[Any, Number] NDArray[Any, Bool] NDArray[Any, Bool8] NDArray[Any, Object] NDArray[Any, Object0] NDArray[Any, Datetime64] NDArray[Any, Integer] NDArray[Any, SignedInteger] NDArray[Any, Int8] NDArray[Any, Int16] NDArray[Any, Int32] NDArray[Any, Int64] NDArray[Any, Byte] NDArray[Any, Short] NDArray[Any, IntC] NDArray[Any, IntP] NDArray[Any, Int0] NDArray[Any, Int] NDArray[Any, LongLong] NDArray[Any, Timedelta64] NDArray[Any, UnsignedInteger] NDArray[Any, UInt8] NDArray[Any, UInt16] NDArray[Any, UInt32] NDArray[Any, UInt64] NDArray[Any, UByte] NDArray[Any, UShort] NDArray[Any, UIntC] NDArray[Any, UIntP] NDArray[Any, UInt0] NDArray[Any, UInt] NDArray[Any, ULongLong] NDArray[Any, Inexact] NDArray[Any, Floating] NDArray[Any, Float16] NDArray[Any, Float32] NDArray[Any, Float64] NDArray[Any, Half] NDArray[Any, Single] NDArray[Any, Double] NDArray[Any, Float] NDArray[Any, LongDouble] NDArray[Any, LongFloat] NDArray[Any, ComplexFloating] NDArray[Any, Complex64] NDArray[Any, Complex128] NDArray[Any, CSingle] NDArray[Any, SingleComplex] NDArray[Any, CDouble] NDArray[Any, Complex] NDArray[Any, CFloat] NDArray[Any, CLongDouble] NDArray[Any, CLongFloat] NDArray[Any, LongComplex] NDArray[Any, Flexible] NDArray[Any, Void] NDArray[Any, Void0] NDArray[Any, Character] NDArray[Any, Bytes] NDArray[Any, String] NDArray[Any, Bytes0] NDArray[Any, Unicode] NDArray[Any, Str0] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/shape.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/shape.pyi:32: error: Literal[...] must have at least one parameter [valid-type] E nptyping/shape.pyi:32: note: Error code "valid-type" not covered by "type: ignore" comment E nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/structure.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/structure.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/structure.pyi:34: error: Literal[...] must have at least one parameter [valid-type] E nptyping/structure.pyi:34: note: Error code "valid-type" not covered by "type: ignore" comment E Found 5 errors in 3 files (checked 1 source file) tests/test_mypy.py:303: AssertionError __________________________________________________________________ MyPyTest.test_mypy_accepts_numpy_types __________________________________________________________________ self = def test_mypy_accepts_numpy_types(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import NDArray import numpy as np NDArray[Any, np.dtype[np.int_]] NDArray[Any, np.dtype[np.float_]] NDArray[Any, np.dtype[np.uint8]] NDArray[Any, np.dtype[np.bool_]] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/shape.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/shape.pyi:32: error: Literal[...] must have at least one parameter [valid-type] E nptyping/shape.pyi:32: note: Error code "valid-type" not covered by "type: ignore" comment E nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/structure.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/structure.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/structure.pyi:34: error: Literal[...] must have at least one parameter [valid-type] E nptyping/structure.pyi:34: note: Error code "valid-type" not covered by "type: ignore" comment E Found 5 errors in 3 files (checked 1 source file) tests/test_mypy.py:125: AssertionError ____________________________________________________________ MyPyTest.test_mypy_accepts_recarray_with_structure ____________________________________________________________ self = def test_mypy_accepts_recarray_with_structure(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import RecArray, Structure RecArray[Any, Structure["x: Float, y: Int"]] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/shape.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/shape.pyi:32: error: Literal[...] must have at least one parameter [valid-type] E nptyping/shape.pyi:32: note: Error code "valid-type" not covered by "type: ignore" comment E nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/structure.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/structure.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/structure.pyi:34: error: Literal[...] must have at least one parameter [valid-type] E nptyping/structure.pyi:34: note: Error code "valid-type" not covered by "type: ignore" comment E Found 5 errors in 3 files (checked 1 source file) tests/test_mypy.py:108: AssertionError ___________________________________________________ MyPyTest.test_mypy_disapproves_ndarray_with_wrong_function_arguments ___________________________________________________ self = def test_mypy_disapproves_ndarray_with_wrong_function_arguments(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import NDArray, Shape def func(_: NDArray[Shape["2, 2"], Any]) -> None: ... func("Not an array...") """ ) self.assertIn('Argument 1 to "func" has incompatible type "str"', stdout) self.assertIn('expected "ndarray[Any, Any]"', stdout) > self.assertIn("Found 1 error in 1 file", stdout) E AssertionError: 'Found 1 error in 1 file' not found in 'nptyping/shape.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment]\nnptyping/shape.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment\nnptyping/shape.pyi:32: error: Literal[...] must have at least one parameter [valid-type]\nnptyping/shape.pyi:32: note: Error code "valid-type" not covered by "type: ignore" comment\nnptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import]\nnptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports\nnptyping/structure.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment]\nnptyping/structure.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment\nnptyping/structure.pyi:34: error: Literal[...] must have at least one parameter [valid-type]\nnptyping/structure.pyi:34: note: Error code "valid-type" not covered by "type: ignore" comment\n/tmp/tmpa5dvenun/test_file.py:10: error: Argument 1 to "func" has incompatible type "str"; expected "ndarray[Any, Any]" [arg-type]\nFound 6 errors in 4 files (checked 1 source file)\n' tests/test_mypy.py:63: AssertionError _______________________________________________________________ MyPyTest.test_mypy_knows_of_ndarray_methods ________________________________________________________________ self = def test_mypy_knows_of_ndarray_methods(self): # If MyPy knows of some arbitrary ndarray methods, we can assume that # code completion works. exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import NDArray arr: NDArray[Any, Any] arr.shape arr.size arr.sort arr.squeeze arr.transpose """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/shape.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/shape.pyi:32: error: Literal[...] must have at least one parameter [valid-type] E nptyping/shape.pyi:32: note: Error code "valid-type" not covered by "type: ignore" comment E nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/structure.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/structure.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/structure.pyi:34: error: Literal[...] must have at least one parameter [valid-type] E nptyping/structure.pyi:34: note: Error code "valid-type" not covered by "type: ignore" comment E Found 5 errors in 3 files (checked 1 source file) tests/test_mypy.py:162: AssertionError ______________________________________________________________ MyPyDataFrameTest.test_mypy_accepts_dataframe _______________________________________________________________ self = @skipUnless( 7 < sys.version_info.minor < 11, "MyPy does not work with DataFrame on 3.7" ) def test_mypy_accepts_dataframe(self): exit_code, stdout, stderr = check_mypy_on_code( """ from nptyping import DataFrame, Structure as S import pandas as pd df: DataFrame[S["x: Int, y: Int"]] = pd.DataFrame({"x": [1], "y": [1]}) """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/shape.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/shape.pyi:32: error: Literal[...] must have at least one parameter [valid-type] E nptyping/shape.pyi:32: note: Error code "valid-type" not covered by "type: ignore" comment E nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/structure.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/structure.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/structure.pyi:34: error: Literal[...] must have at least one parameter [valid-type] E nptyping/structure.pyi:34: note: Error code "valid-type" not covered by "type: ignore" comment E /tmp/tmpytzgy32r/test_file.py:2: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E /tmp/tmpytzgy32r/test_file.py:2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E Found 6 errors in 4 files (checked 1 source file) tests/pandas_/test_mypy_dataframe.py:21: AssertionError _____________________________________________ MyPyDataFrameTest.test_mypy_disapproves_dataframe_with_wrong_function_arguments ______________________________________________ self = @skipUnless( 7 < sys.version_info.minor < 11, "MyPy does not work with DataFrame on 3.7" ) def test_mypy_disapproves_dataframe_with_wrong_function_arguments(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import DataFrame, Structure as S def func(_: DataFrame[S["x: Float, y: Float"]]) -> None: ... func("Not an array...") """ ) > self.assertIn('Argument 1 to "func" has incompatible type "str"', stdout) E AssertionError: 'Argument 1 to "func" has incompatible type "str"' not found in 'nptyping/shape.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment]\nnptyping/shape.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment\nnptyping/shape.pyi:32: error: Literal[...] must have at least one parameter [valid-type]\nnptyping/shape.pyi:32: note: Error code "valid-type" not covered by "type: ignore" comment\nnptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import]\nnptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports\nnptyping/structure.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment]\nnptyping/structure.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment\nnptyping/structure.pyi:34: error: Literal[...] must have at least one parameter [valid-type]\nnptyping/structure.pyi:34: note: Error code "valid-type" not covered by "type: ignore" comment\nFound 5 errors in 3 files (checked 1 source file)\n' tests/pandas_/test_mypy_dataframe.py:42: AssertionError __________________________________________________________ MyPyDataFrameTest.test_mypy_knows_of_dataframe_methods __________________________________________________________ self = @skipUnless( 7 < sys.version_info.minor < 11, "MyPy does not work with DataFrame on 3.7" ) def test_mypy_knows_of_dataframe_methods(self): # If MyPy knows of some arbitrary DataFrame methods, we can assume that # code completion works. exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import DataFrame df: DataFrame[Any] df.shape df.dtypes df.values df.boxplot df.filter """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/shape.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/shape.pyi:32: error: Literal[...] must have at least one parameter [valid-type] E nptyping/shape.pyi:32: note: Error code "valid-type" not covered by "type: ignore" comment E nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/structure.pyi:27: error: Incompatible import of "Literal" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm") [assignment] E nptyping/structure.pyi:27: note: Error code "assignment" not covered by "type: ignore" comment E nptyping/structure.pyi:34: error: Literal[...] must have at least one parameter [valid-type] E nptyping/structure.pyi:34: note: Error code "valid-type" not covered by "type: ignore" comment E Found 5 errors in 3 files (checked 1 source file) tests/pandas_/test_mypy_dataframe.py:67: AssertionError ============================================================================= warnings summary ============================================================================= ../../../../../usr/lib64/python3.8/unittest/loader.py:66 /usr/lib64/python3.8/unittest/loader.py:66: PytestCollectionWarning: cannot collect test class 'TestLoader' because it has a __init__ constructor (from: tests/test_wheel.py) class TestLoader(object): -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ========================================================================= short test summary info ========================================================================== FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_any - AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (import... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_shape - AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (impo... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_structure - AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarrays_as_function_arguments - AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Li... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarrays_as_variable_hints - AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Litera... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_nptyping_types - AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (imported... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_numpy_types - AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (imported na... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_recarray_with_structure - AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" ... FAILED tests/test_mypy.py::MyPyTest::test_mypy_disapproves_ndarray_with_wrong_function_arguments - AssertionError: 'Found 1 error in 1 file' not found in 'nptyping/shape... FAILED tests/test_mypy.py::MyPyTest::test_mypy_knows_of_ndarray_methods - AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import of "Literal" (import... FAILED tests/pandas_/test_mypy_dataframe.py::MyPyDataFrameTest::test_mypy_accepts_dataframe - AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatible import ... FAILED tests/pandas_/test_mypy_dataframe.py::MyPyDataFrameTest::test_mypy_disapproves_dataframe_with_wrong_function_arguments - AssertionError: 'Argument 1 to "func" has... FAILED tests/pandas_/test_mypy_dataframe.py::MyPyDataFrameTest::test_mypy_knows_of_dataframe_methods - AssertionError: 0 != 1 : nptyping/shape.pyi:27: error: Incompatibl... ========================================================= 13 failed, 92 passed, 1 deselected, 1 warning in 50.16s ========================================================== ```

Here is list of installed modules in build env

```console Package Version ----------------- -------------- appdirs 1.4.4 attrs 22.1.0 beartype 0.11.0 Brlapi 0.8.3 build 0.9.0 contourpy 1.0.6 cssselect 1.1.0 cycler 0.11.0 distro 1.8.0 dnspython 2.2.1 extras 1.0.0 fixtures 4.0.0 fluidity-sm 0.2.0 fonttools 4.38.0 gpg 1.17.1-unknown iniconfig 1.1.1 invoke 1.7.0 kiwisolver 1.4.4 lexicon 2.0.1 libcomps 0.1.19 louis 3.23.0 lxml 4.9.1 matplotlib 3.6.2 mypy 0.990 mypy-extensions 0.4.3 nodeenv 1.7.0 numpy 1.23.1 olefile 0.46 packaging 21.3 pandas 1.4.2 pbr 5.9.0 pep517 0.13.0 Pillow 9.3.0 pip 22.2.2 pluggy 1.0.0 py 1.11.0 PyGObject 3.42.2 pyparsing 3.0.9 pyright 1.1.279 pytest 7.1.3 python-dateutil 2.8.2 pytz 2022.4 PyYAML 6.0 rpm 4.17.0 scour 0.38.2 setuptools 65.5.1 six 1.16.0 testtools 2.5.0 tomli 2.0.1 typeguard 2.13.3 typing_extensions 4.3.0 wheel 0.37.1 ```
ramonhagenaars commented 2 years ago

Thank you for testing (so quickly)! I will look into this.

ramonhagenaars commented 2 years ago

I think I may have found the issue. My tests have been running against mypy==0.981 whereas you are using mypy==0.990.

Can you run your tests again with mypy==0.981 just to see if this "resolves" it?

I can silence the mypy issues in a patch release to make it compatible with mypy==0.990.

kloczek commented 2 years ago

Can you run your tests again with mypy==0.981 just to see if this "resolves" it?

I've already deleted rpm package with older mypy version :/ Sooner or later it will be necessary to move to new mypy version so .. 😋

ramonhagenaars commented 2 years ago

Alright, fair enough. v2.4.1 is compatible with mypy==0.991 (and also mypy==0.990). Can you check against this release?

kloczek commented 2 years ago

Tag pattern is has been changed from v<version> to <version>. Mistake or from now now it will be like that? My auomation don't care about pattern as long as it is fixed 😄

ramonhagenaars commented 2 years ago

Oops... 😆 here we go: v2.4.1

kloczek commented 2 years ago

OK 😄 Will back shortly 😋

kloczek commented 2 years ago

Now popped out some pandas related issues 🤔

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-nptyping-2.4.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-nptyping-2.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra --ignore tests/test_package_info.py =========================================================================== test session starts ============================================================================ platform linux -- Python 3.8.15, pytest-7.1.3, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/nptyping-2.4.1 plugins: typeguard-2.13.3 collected 106 items tests/test_assert_isinstance.py ... [ 2%] tests/test_base_meta_classes.py ......... [ 11%] tests/test_beartype.py .... [ 15%] tests/test_lib_export.py . [ 16%] tests/test_mypy.py FFFFFFFFFF. [ 26%] tests/test_ndarray.py .......................... [ 50%] tests/test_performance.py . [ 51%] tests/test_pyright.py .. [ 53%] tests/test_recarray.py ... [ 56%] tests/test_shape.py ...... [ 62%] tests/test_shape_expression.py ... [ 65%] tests/test_structure.py ........ [ 72%] tests/test_structure_expression.py ......... [ 81%] tests/test_typeguard.py .... [ 84%] tests/test_wheel.py F.. [ 87%] tests/pandas_/test_dataframe.py ......... [ 96%] tests/pandas_/test_fork_sync.py . [ 97%] tests/pandas_/test_mypy_dataframe.py FFF [100%] ================================================================================= FAILURES ================================================================================= _______________________________________________________________ MyPyTest.test_mypy_accepts_ndarray_with_any ________________________________________________________________ self = def test_mypy_accepts_ndarray_with_any(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import NDArray NDArray[Any, Any] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:17: AssertionError ______________________________________________________________ MyPyTest.test_mypy_accepts_ndarray_with_shape _______________________________________________________________ self = def test_mypy_accepts_ndarray_with_shape(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import NDArray, Shape NDArray[Shape["3, 3"], Any] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:30: AssertionError ____________________________________________________________ MyPyTest.test_mypy_accepts_ndarray_with_structure _____________________________________________________________ self = def test_mypy_accepts_ndarray_with_structure(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import NDArray, RecArray, Structure NDArray[Any, Structure["x: Float, y: Int"]] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:43: AssertionError ________________________________________________________ MyPyTest.test_mypy_accepts_ndarrays_as_function_arguments _________________________________________________________ self = def test_mypy_accepts_ndarrays_as_function_arguments(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import NDArray, Shape def func(_: NDArray[Shape["2, 2"], Any]) -> None: ... func(np.array([1, 2])) # (Wrong shape though) """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:81: AssertionError __________________________________________________________ MyPyTest.test_mypy_accepts_ndarrays_as_variable_hints ___________________________________________________________ self = def test_mypy_accepts_ndarrays_as_variable_hints(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import NDArray arr: NDArray[Any, Any] = np.array([1, 2, 3]) """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:95: AssertionError ________________________________________________________________ MyPyTest.test_mypy_accepts_nptyping_types _________________________________________________________________ self = def test_mypy_accepts_nptyping_types(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any import numpy as np import numpy.typing as npt from nptyping import ( NDArray, Number, Bool, Bool8, Object, Object0, Datetime64, Integer, SignedInteger, Int8, Int16, Int32, Int64, Byte, Short, IntC, IntP, Int0, Int, LongLong, Timedelta64, UnsignedInteger, UInt8, UInt16, UInt32, UInt64, UByte, UShort, UIntC, UIntP, UInt0, UInt, ULongLong, Inexact, Floating, Float16, Float32, Float64, Half, Single, Double, Float, LongDouble, LongFloat, ComplexFloating, Complex64, Complex128, CSingle, SingleComplex, CDouble, Complex, CFloat, CLongDouble, CLongFloat, LongComplex, Flexible, Void, Void0, Character, Bytes, String, Bytes0, Unicode, Str0, ) NDArray[Any, Number] NDArray[Any, Bool] NDArray[Any, Bool8] NDArray[Any, Object] NDArray[Any, Object0] NDArray[Any, Datetime64] NDArray[Any, Integer] NDArray[Any, SignedInteger] NDArray[Any, Int8] NDArray[Any, Int16] NDArray[Any, Int32] NDArray[Any, Int64] NDArray[Any, Byte] NDArray[Any, Short] NDArray[Any, IntC] NDArray[Any, IntP] NDArray[Any, Int0] NDArray[Any, Int] NDArray[Any, LongLong] NDArray[Any, Timedelta64] NDArray[Any, UnsignedInteger] NDArray[Any, UInt8] NDArray[Any, UInt16] NDArray[Any, UInt32] NDArray[Any, UInt64] NDArray[Any, UByte] NDArray[Any, UShort] NDArray[Any, UIntC] NDArray[Any, UIntP] NDArray[Any, UInt0] NDArray[Any, UInt] NDArray[Any, ULongLong] NDArray[Any, Inexact] NDArray[Any, Floating] NDArray[Any, Float16] NDArray[Any, Float32] NDArray[Any, Float64] NDArray[Any, Half] NDArray[Any, Single] NDArray[Any, Double] NDArray[Any, Float] NDArray[Any, LongDouble] NDArray[Any, LongFloat] NDArray[Any, ComplexFloating] NDArray[Any, Complex64] NDArray[Any, Complex128] NDArray[Any, CSingle] NDArray[Any, SingleComplex] NDArray[Any, CDouble] NDArray[Any, Complex] NDArray[Any, CFloat] NDArray[Any, CLongDouble] NDArray[Any, CLongFloat] NDArray[Any, LongComplex] NDArray[Any, Flexible] NDArray[Any, Void] NDArray[Any, Void0] NDArray[Any, Character] NDArray[Any, Bytes] NDArray[Any, String] NDArray[Any, Bytes0] NDArray[Any, Unicode] NDArray[Any, Str0] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:303: AssertionError __________________________________________________________________ MyPyTest.test_mypy_accepts_numpy_types __________________________________________________________________ self = def test_mypy_accepts_numpy_types(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import NDArray import numpy as np NDArray[Any, np.dtype[np.int_]] NDArray[Any, np.dtype[np.float_]] NDArray[Any, np.dtype[np.uint8]] NDArray[Any, np.dtype[np.bool_]] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:125: AssertionError ____________________________________________________________ MyPyTest.test_mypy_accepts_recarray_with_structure ____________________________________________________________ self = def test_mypy_accepts_recarray_with_structure(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import RecArray, Structure RecArray[Any, Structure["x: Float, y: Int"]] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:108: AssertionError ___________________________________________________ MyPyTest.test_mypy_disapproves_ndarray_with_wrong_function_arguments ___________________________________________________ self = def test_mypy_disapproves_ndarray_with_wrong_function_arguments(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import NDArray, Shape def func(_: NDArray[Shape["2, 2"], Any]) -> None: ... func("Not an array...") """ ) self.assertIn('Argument 1 to "func" has incompatible type "str"', stdout) self.assertIn('expected "ndarray[Any, Any]"', stdout) > self.assertIn("Found 1 error in 1 file", stdout) E AssertionError: 'Found 1 error in 1 file' not found in 'nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import]\nnptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports\n/tmp/tmp2vh8d6jj/test_file.py:10: error: Argument 1 to "func" has incompatible type "str"; expected "ndarray[Any, Any]" [arg-type]\nFound 2 errors in 2 files (checked 1 source file)\n' tests/test_mypy.py:63: AssertionError _______________________________________________________________ MyPyTest.test_mypy_knows_of_ndarray_methods ________________________________________________________________ self = def test_mypy_knows_of_ndarray_methods(self): # If MyPy knows of some arbitrary ndarray methods, we can assume that # code completion works. exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import NDArray arr: NDArray[Any, Any] arr.shape arr.size arr.sort arr.squeeze arr.transpose """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E Found 1 error in 1 file (checked 1 source file) tests/test_mypy.py:162: AssertionError _________________________________________________________________ WheelTest.test_wheel_is_built_correctly __________________________________________________________________ self = def test_wheel_is_built_correctly(self): with working_dir(_ROOT): > subprocess.check_output(f"{sys.executable} -m invoke wheel", shell=True) tests/test_wheel.py:91: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True, popenargs = ('/usr/bin/python3 -m invoke wheel',), kwargs = {'shell': True, 'stdout': -1} process = , stdout = b'Installing dependencies into: .venv3.8.15\n', stderr = None, retcode = 127 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '/usr/bin/python3 -m invoke wheel' returned non-zero exit status 127. /usr/lib64/python3.8/subprocess.py:516: CalledProcessError --------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------- /bin/bash: line 1: .venv3.8.15/bin/python: No such file or directory ______________________________________________________________ MyPyDataFrameTest.test_mypy_accepts_dataframe _______________________________________________________________ self = @skipUnless( 7 < sys.version_info.minor < 11, "MyPy does not work with DataFrame on 3.7" ) def test_mypy_accepts_dataframe(self): exit_code, stdout, stderr = check_mypy_on_code( """ from nptyping import DataFrame, Structure as S import pandas as pd df: DataFrame[S["x: Int, y: Int"]] = pd.DataFrame({"x": [1], "y": [1]}) """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E /tmp/tmp7mbbxlv_/test_file.py:2: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E /tmp/tmp7mbbxlv_/test_file.py:2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E Found 2 errors in 2 files (checked 1 source file) tests/pandas_/test_mypy_dataframe.py:21: AssertionError _____________________________________________ MyPyDataFrameTest.test_mypy_disapproves_dataframe_with_wrong_function_arguments ______________________________________________ self = @skipUnless( 7 < sys.version_info.minor < 11, "MyPy does not work with DataFrame on 3.7" ) def test_mypy_disapproves_dataframe_with_wrong_function_arguments(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import DataFrame, Structure as S def func(_: DataFrame[S["x: Float, y: Float"]]) -> None: ... func("Not an array...") """ ) > self.assertIn('Argument 1 to "func" has incompatible type "str"', stdout) E AssertionError: 'Argument 1 to "func" has incompatible type "str"' not found in 'nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import]\nnptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports\nFound 1 error in 1 file (checked 1 source file)\n' tests/pandas_/test_mypy_dataframe.py:42: AssertionError __________________________________________________________ MyPyDataFrameTest.test_mypy_knows_of_dataframe_methods __________________________________________________________ self = @skipUnless( 7 < sys.version_info.minor < 11, "MyPy does not work with DataFrame on 3.7" ) def test_mypy_knows_of_dataframe_methods(self): # If MyPy knows of some arbitrary DataFrame methods, we can assume that # code completion works. exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import DataFrame df: DataFrame[Any] df.shape df.dtypes df.values df.boxplot df.filter """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E Found 1 error in 1 file (checked 1 source file) tests/pandas_/test_mypy_dataframe.py:67: AssertionError ============================================================================= warnings summary ============================================================================= ../../../../../usr/lib64/python3.8/unittest/loader.py:66 /usr/lib64/python3.8/unittest/loader.py:66: PytestCollectionWarning: cannot collect test class 'TestLoader' because it has a __init__ constructor (from: tests/test_wheel.py) class TestLoader(object): -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ========================================================================= short test summary info ========================================================================== FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_any - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas":... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_shape - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_structure - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pa... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarrays_as_function_arguments - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analy... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarrays_as_variable_hints - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_nptyping_types - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": m... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_numpy_types - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": modu... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_recarray_with_structure - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "p... FAILED tests/test_mypy.py::MyPyTest::test_mypy_disapproves_ndarray_with_wrong_function_arguments - AssertionError: 'Found 1 error in 1 file' not found in 'nptyping/panda... FAILED tests/test_mypy.py::MyPyTest::test_mypy_knows_of_ndarray_methods - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas":... FAILED tests/test_wheel.py::WheelTest::test_wheel_is_built_correctly - subprocess.CalledProcessError: Command '/usr/bin/python3 -m invoke wheel' returned non-zero exit s... FAILED tests/pandas_/test_mypy_dataframe.py::MyPyDataFrameTest::test_mypy_accepts_dataframe - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping... FAILED tests/pandas_/test_mypy_dataframe.py::MyPyDataFrameTest::test_mypy_disapproves_dataframe_with_wrong_function_arguments - AssertionError: 'Argument 1 to "func" has... FAILED tests/pandas_/test_mypy_dataframe.py::MyPyDataFrameTest::test_mypy_knows_of_dataframe_methods - AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error:... ================================================================ 14 failed, 92 passed, 1 warning in 47.78s ================================================================= ```
[tkloczko@devel-g2v SPECS]$ pip show pandas
Name: pandas
Version: 1.4.2
Summary: Powerful data structures for data analysis, time series, and statistics
Home-page: https://pandas.pydata.org
Author: The Pandas Development Team
Author-email: pandas-dev@python.org
License: BSD-3-Clause
Location: /usr/lib64/python3.8/site-packages
Requires: numpy, python-dateutil, pytz
Required-by:
ramonhagenaars commented 2 years ago

It seems that pandas-stubs-fork is missing. Did you install the extra dependencies for pandas? Normally, one of the following commands would work: pip install nptyping[pandas] or pip install nptyping[complete] or pip install nptyping[dev]

What install command did you use?

kloczek commented 2 years ago

I'm installing all modules using rpm packages. As I wrote on the begginig I'm packaging all stuff as rpm packages which have python modules dependencies as rpm metadata.

In dependencies/pandas-requirements.txt I see:

pandas
pandas-stubs-fork ; python_version>="3.8"

Does it mean that this pandas-stubs-fork is necessary only with python 3.8.x? (which I'm using now) If yes we can ignore for now that part for now because I'm going to move all my python modules to python 3.9.x (only to develop general approach of the migration to new python major version) and than to 3.10.x and after that to 3.11.x. In other words bringing all that to working state on top of python 3.8 is not worth your or mine time.

ramonhagenaars commented 2 years ago

It means that for any Python version greater than or equal to 3.8, pandas-stubs-fork should be installed if hints for pandas are to be available. That includes 3.10.x and 3.11.x.

rhurlin commented 1 year ago

Hi @ramonhagenaars,

Is there a reason you are using your own fork https://pypi.org/project/pandas-stubs-fork/ instead of the one on PyPi derived directly from https://github.com/pandas-dev/pandas-stubs as https://pypi.org/project/pandas-stubs/? The latter is on the same level with the GitHub repo.

I need the pandas stubs for your project nptyping on FreeBSD ;)

A short explanation would be nice, thanks.

ramonhagenaars commented 1 year ago

Hi @rhurlin ,

The reason is that the DataFrame type of the regular pandas-stubs does not take generics. I opened up an issue at the original project, but I didn't want to wait with the DataFrame support. Hopefully, eventually, I can drop this fork and use the original.

rhurlin commented 1 year ago

Hi @ramonhagenaars, hanks for the explanation.

Since I want to port your project nptyping to FreeBSD, and for that I need to port the original repo pandas-stubs as well if possible, I will probably wait a bit with that.

kloczek commented 1 year ago

Just tested 2.5.0 and some units still are failing

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-nptyping-2.5.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-nptyping-2.5.0-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' --ignore tests/test_package_info.py ============================= test session starts ============================== platform linux -- Python 3.8.16, pytest-7.2.1, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/nptyping-2.5.0 plugins: typeguard-2.13.3 collected 110 items tests/test_assert_isinstance.py ... [ 2%] tests/test_base_meta_classes.py ......... [ 10%] tests/test_beartype.py .... [ 14%] tests/test_help_texts.py ... [ 17%] tests/test_lib_export.py . [ 18%] tests/test_mypy.py FFFFFFFFFF. [ 28%] tests/test_ndarray.py .......................... [ 51%] tests/test_performance.py . [ 52%] tests/test_pyright.py .. [ 54%] tests/test_recarray.py ... [ 57%] tests/test_shape.py ...... [ 62%] tests/test_shape_expression.py ... [ 65%] tests/test_structure.py ........ [ 72%] tests/test_structure_expression.py .......... [ 81%] tests/test_typeguard.py .... [ 85%] tests/test_wheel.py sss [ 88%] tests/pandas_/test_dataframe.py ......... [ 96%] tests/pandas_/test_fork_sync.py . [ 97%] tests/pandas_/test_mypy_dataframe.py FFF [100%] =================================== FAILURES =================================== _________________ MyPyTest.test_mypy_accepts_ndarray_with_any __________________ self = def test_mypy_accepts_ndarray_with_any(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import NDArray NDArray[Any, Any] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/typing_.pyi:50: error: Name "np.bool8" is not defined [name-defined] E nptyping/typing_.pyi:52: error: Name "np.object0" is not defined [name-defined] E nptyping/typing_.pyi:64: error: Name "np.int0" is not defined [name-defined] E nptyping/typing_.pyi:77: error: Name "np.uint0" is not defined [name-defined] E nptyping/typing_.pyi:104: error: Name "np.void0" is not defined [name-defined] E nptyping/typing_.pyi:109: error: Name "np.bytes0" is not defined [name-defined] E nptyping/typing_.pyi:111: error: Name "np.str0" is not defined [name-defined] E Found 8 errors in 2 files (checked 1 source file) tests/test_mypy.py:17: AssertionError ________________ MyPyTest.test_mypy_accepts_ndarray_with_shape _________________ self = def test_mypy_accepts_ndarray_with_shape(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import NDArray, Shape NDArray[Shape["3, 3"], Any] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/typing_.pyi:50: error: Name "np.bool8" is not defined [name-defined] E nptyping/typing_.pyi:52: error: Name "np.object0" is not defined [name-defined] E nptyping/typing_.pyi:64: error: Name "np.int0" is not defined [name-defined] E nptyping/typing_.pyi:77: error: Name "np.uint0" is not defined [name-defined] E nptyping/typing_.pyi:104: error: Name "np.void0" is not defined [name-defined] E nptyping/typing_.pyi:109: error: Name "np.bytes0" is not defined [name-defined] E nptyping/typing_.pyi:111: error: Name "np.str0" is not defined [name-defined] E Found 8 errors in 2 files (checked 1 source file) tests/test_mypy.py:30: AssertionError ______________ MyPyTest.test_mypy_accepts_ndarray_with_structure _______________ self = def test_mypy_accepts_ndarray_with_structure(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import NDArray, RecArray, Structure NDArray[Any, Structure["x: Float, y: Int"]] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/typing_.pyi:50: error: Name "np.bool8" is not defined [name-defined] E nptyping/typing_.pyi:52: error: Name "np.object0" is not defined [name-defined] E nptyping/typing_.pyi:64: error: Name "np.int0" is not defined [name-defined] E nptyping/typing_.pyi:77: error: Name "np.uint0" is not defined [name-defined] E nptyping/typing_.pyi:104: error: Name "np.void0" is not defined [name-defined] E nptyping/typing_.pyi:109: error: Name "np.bytes0" is not defined [name-defined] E nptyping/typing_.pyi:111: error: Name "np.str0" is not defined [name-defined] E Found 8 errors in 2 files (checked 1 source file) tests/test_mypy.py:43: AssertionError __________ MyPyTest.test_mypy_accepts_ndarrays_as_function_arguments ___________ self = def test_mypy_accepts_ndarrays_as_function_arguments(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import NDArray, Shape def func(_: NDArray[Shape["2, 2"], Any]) -> None: ... func(np.array([1, 2])) # (Wrong shape though) """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/typing_.pyi:50: error: Name "np.bool8" is not defined [name-defined] E nptyping/typing_.pyi:52: error: Name "np.object0" is not defined [name-defined] E nptyping/typing_.pyi:64: error: Name "np.int0" is not defined [name-defined] E nptyping/typing_.pyi:77: error: Name "np.uint0" is not defined [name-defined] E nptyping/typing_.pyi:104: error: Name "np.void0" is not defined [name-defined] E nptyping/typing_.pyi:109: error: Name "np.bytes0" is not defined [name-defined] E nptyping/typing_.pyi:111: error: Name "np.str0" is not defined [name-defined] E Found 8 errors in 2 files (checked 1 source file) tests/test_mypy.py:81: AssertionError ____________ MyPyTest.test_mypy_accepts_ndarrays_as_variable_hints _____________ self = def test_mypy_accepts_ndarrays_as_variable_hints(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import NDArray arr: NDArray[Any, Any] = np.array([1, 2, 3]) """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/typing_.pyi:50: error: Name "np.bool8" is not defined [name-defined] E nptyping/typing_.pyi:52: error: Name "np.object0" is not defined [name-defined] E nptyping/typing_.pyi:64: error: Name "np.int0" is not defined [name-defined] E nptyping/typing_.pyi:77: error: Name "np.uint0" is not defined [name-defined] E nptyping/typing_.pyi:104: error: Name "np.void0" is not defined [name-defined] E nptyping/typing_.pyi:109: error: Name "np.bytes0" is not defined [name-defined] E nptyping/typing_.pyi:111: error: Name "np.str0" is not defined [name-defined] E Found 8 errors in 2 files (checked 1 source file) tests/test_mypy.py:95: AssertionError __________________ MyPyTest.test_mypy_accepts_nptyping_types ___________________ self = def test_mypy_accepts_nptyping_types(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any import numpy as np import numpy.typing as npt from nptyping import ( NDArray, Number, Bool, Bool8, Object, Object0, Datetime64, Integer, SignedInteger, Int8, Int16, Int32, Int64, Byte, Short, IntC, IntP, Int0, Int, LongLong, Timedelta64, UnsignedInteger, UInt8, UInt16, UInt32, UInt64, UByte, UShort, UIntC, UIntP, UInt0, UInt, ULongLong, Inexact, Floating, Float16, Float32, Float64, Half, Single, Double, Float, LongDouble, LongFloat, ComplexFloating, Complex64, Complex128, CSingle, SingleComplex, CDouble, Complex, CFloat, CLongDouble, CLongFloat, LongComplex, Flexible, Void, Void0, Character, Bytes, String, Bytes0, Unicode, Str0, ) NDArray[Any, Number] NDArray[Any, Bool] NDArray[Any, Bool8] NDArray[Any, Object] NDArray[Any, Object0] NDArray[Any, Datetime64] NDArray[Any, Integer] NDArray[Any, SignedInteger] NDArray[Any, Int8] NDArray[Any, Int16] NDArray[Any, Int32] NDArray[Any, Int64] NDArray[Any, Byte] NDArray[Any, Short] NDArray[Any, IntC] NDArray[Any, IntP] NDArray[Any, Int0] NDArray[Any, Int] NDArray[Any, LongLong] NDArray[Any, Timedelta64] NDArray[Any, UnsignedInteger] NDArray[Any, UInt8] NDArray[Any, UInt16] NDArray[Any, UInt32] NDArray[Any, UInt64] NDArray[Any, UByte] NDArray[Any, UShort] NDArray[Any, UIntC] NDArray[Any, UIntP] NDArray[Any, UInt0] NDArray[Any, UInt] NDArray[Any, ULongLong] NDArray[Any, Inexact] NDArray[Any, Floating] NDArray[Any, Float16] NDArray[Any, Float32] NDArray[Any, Float64] NDArray[Any, Half] NDArray[Any, Single] NDArray[Any, Double] NDArray[Any, Float] NDArray[Any, LongDouble] NDArray[Any, LongFloat] NDArray[Any, ComplexFloating] NDArray[Any, Complex64] NDArray[Any, Complex128] NDArray[Any, CSingle] NDArray[Any, SingleComplex] NDArray[Any, CDouble] NDArray[Any, Complex] NDArray[Any, CFloat] NDArray[Any, CLongDouble] NDArray[Any, CLongFloat] NDArray[Any, LongComplex] NDArray[Any, Flexible] NDArray[Any, Void] NDArray[Any, Void0] NDArray[Any, Character] NDArray[Any, Bytes] NDArray[Any, String] NDArray[Any, Bytes0] NDArray[Any, Unicode] NDArray[Any, Str0] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/typing_.pyi:50: error: Name "np.bool8" is not defined [name-defined] E nptyping/typing_.pyi:52: error: Name "np.object0" is not defined [name-defined] E nptyping/typing_.pyi:64: error: Name "np.int0" is not defined [name-defined] E nptyping/typing_.pyi:77: error: Name "np.uint0" is not defined [name-defined] E nptyping/typing_.pyi:104: error: Name "np.void0" is not defined [name-defined] E nptyping/typing_.pyi:109: error: Name "np.bytes0" is not defined [name-defined] E nptyping/typing_.pyi:111: error: Name "np.str0" is not defined [name-defined] E Found 8 errors in 2 files (checked 1 source file) tests/test_mypy.py:303: AssertionError ____________________ MyPyTest.test_mypy_accepts_numpy_types ____________________ self = def test_mypy_accepts_numpy_types(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import NDArray import numpy as np NDArray[Any, np.dtype[np.int_]] NDArray[Any, np.dtype[np.float_]] NDArray[Any, np.dtype[np.uint8]] NDArray[Any, np.dtype[np.bool_]] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/typing_.pyi:50: error: Name "np.bool8" is not defined [name-defined] E nptyping/typing_.pyi:52: error: Name "np.object0" is not defined [name-defined] E nptyping/typing_.pyi:64: error: Name "np.int0" is not defined [name-defined] E nptyping/typing_.pyi:77: error: Name "np.uint0" is not defined [name-defined] E nptyping/typing_.pyi:104: error: Name "np.void0" is not defined [name-defined] E nptyping/typing_.pyi:109: error: Name "np.bytes0" is not defined [name-defined] E nptyping/typing_.pyi:111: error: Name "np.str0" is not defined [name-defined] E Found 8 errors in 2 files (checked 1 source file) tests/test_mypy.py:125: AssertionError ______________ MyPyTest.test_mypy_accepts_recarray_with_structure ______________ self = def test_mypy_accepts_recarray_with_structure(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import RecArray, Structure RecArray[Any, Structure["x: Float, y: Int"]] """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/typing_.pyi:50: error: Name "np.bool8" is not defined [name-defined] E nptyping/typing_.pyi:52: error: Name "np.object0" is not defined [name-defined] E nptyping/typing_.pyi:64: error: Name "np.int0" is not defined [name-defined] E nptyping/typing_.pyi:77: error: Name "np.uint0" is not defined [name-defined] E nptyping/typing_.pyi:104: error: Name "np.void0" is not defined [name-defined] E nptyping/typing_.pyi:109: error: Name "np.bytes0" is not defined [name-defined] E nptyping/typing_.pyi:111: error: Name "np.str0" is not defined [name-defined] E Found 8 errors in 2 files (checked 1 source file) tests/test_mypy.py:108: AssertionError _____ MyPyTest.test_mypy_disapproves_ndarray_with_wrong_function_arguments _____ self = def test_mypy_disapproves_ndarray_with_wrong_function_arguments(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import NDArray, Shape def func(_: NDArray[Shape["2, 2"], Any]) -> None: ... func("Not an array...") """ ) self.assertIn('Argument 1 to "func" has incompatible type "str"', stdout) self.assertIn('expected "ndarray[Any, Any]"', stdout) > self.assertIn("Found 1 error in 1 file", stdout) E AssertionError: 'Found 1 error in 1 file' not found in 'nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import]\nnptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports\nnptyping/typing_.pyi:50: error: Name "np.bool8" is not defined [name-defined]\nnptyping/typing_.pyi:52: error: Name "np.object0" is not defined [name-defined]\nnptyping/typing_.pyi:64: error: Name "np.int0" is not defined [name-defined]\nnptyping/typing_.pyi:77: error: Name "np.uint0" is not defined [name-defined]\nnptyping/typing_.pyi:104: error: Name "np.void0" is not defined [name-defined]\nnptyping/typing_.pyi:109: error: Name "np.bytes0" is not defined [name-defined]\nnptyping/typing_.pyi:111: error: Name "np.str0" is not defined [name-defined]\n/tmp/tmpmkcmhfrc/test_file.py:10: error: Argument 1 to "func" has incompatible type "str"; expected "ndarray[Any, Any]" [arg-type]\nFound 9 errors in 3 files (checked 1 source file)\n' tests/test_mypy.py:63: AssertionError _________________ MyPyTest.test_mypy_knows_of_ndarray_methods __________________ self = def test_mypy_knows_of_ndarray_methods(self): # If MyPy knows of some arbitrary ndarray methods, we can assume that # code completion works. exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import NDArray arr: NDArray[Any, Any] arr.shape arr.size arr.sort arr.squeeze arr.transpose """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/typing_.pyi:50: error: Name "np.bool8" is not defined [name-defined] E nptyping/typing_.pyi:52: error: Name "np.object0" is not defined [name-defined] E nptyping/typing_.pyi:64: error: Name "np.int0" is not defined [name-defined] E nptyping/typing_.pyi:77: error: Name "np.uint0" is not defined [name-defined] E nptyping/typing_.pyi:104: error: Name "np.void0" is not defined [name-defined] E nptyping/typing_.pyi:109: error: Name "np.bytes0" is not defined [name-defined] E nptyping/typing_.pyi:111: error: Name "np.str0" is not defined [name-defined] E Found 8 errors in 2 files (checked 1 source file) tests/test_mypy.py:162: AssertionError ________________ MyPyDataFrameTest.test_mypy_accepts_dataframe _________________ self = @skipUnless(7 < sys.version_info.minor, "MyPy does not work with DataFrame on 3.7") def test_mypy_accepts_dataframe(self): exit_code, stdout, stderr = check_mypy_on_code( """ from nptyping import DataFrame, Structure as S import pandas as pd df: DataFrame[S["x: Int, y: Int"]] = pd.DataFrame({"x": [1], "y": [1]}) """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/typing_.pyi:50: error: Name "np.bool8" is not defined [name-defined] E nptyping/typing_.pyi:52: error: Name "np.object0" is not defined [name-defined] E nptyping/typing_.pyi:64: error: Name "np.int0" is not defined [name-defined] E nptyping/typing_.pyi:77: error: Name "np.uint0" is not defined [name-defined] E nptyping/typing_.pyi:104: error: Name "np.void0" is not defined [name-defined] E nptyping/typing_.pyi:109: error: Name "np.bytes0" is not defined [name-defined] E nptyping/typing_.pyi:111: error: Name "np.str0" is not defined [name-defined] E /tmp/tmpqh0y2okt/test_file.py:2: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E /tmp/tmpqh0y2okt/test_file.py:2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E Found 9 errors in 3 files (checked 1 source file) tests/pandas_/test_mypy_dataframe.py:19: AssertionError _ MyPyDataFrameTest.test_mypy_disapproves_dataframe_with_wrong_function_arguments _ self = @skipUnless(7 < sys.version_info.minor, "MyPy does not work with DataFrame on 3.7") def test_mypy_disapproves_dataframe_with_wrong_function_arguments(self): exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any import numpy as np from nptyping import DataFrame, Structure as S def func(_: DataFrame[S["x: Float, y: Float"]]) -> None: ... func("Not an array...") """ ) > self.assertIn('Argument 1 to "func" has incompatible type "str"', stdout) E AssertionError: 'Argument 1 to "func" has incompatible type "str"' not found in 'nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import]\nnptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports\nnptyping/typing_.pyi:50: error: Name "np.bool8" is not defined [name-defined]\nnptyping/typing_.pyi:52: error: Name "np.object0" is not defined [name-defined]\nnptyping/typing_.pyi:64: error: Name "np.int0" is not defined [name-defined]\nnptyping/typing_.pyi:77: error: Name "np.uint0" is not defined [name-defined]\nnptyping/typing_.pyi:104: error: Name "np.void0" is not defined [name-defined]\nnptyping/typing_.pyi:109: error: Name "np.bytes0" is not defined [name-defined]\nnptyping/typing_.pyi:111: error: Name "np.str0" is not defined [name-defined]\nFound 8 errors in 2 files (checked 1 source file)\n' tests/pandas_/test_mypy_dataframe.py:38: AssertionError ____________ MyPyDataFrameTest.test_mypy_knows_of_dataframe_methods ____________ self = @skipUnless(7 < sys.version_info.minor, "MyPy does not work with DataFrame on 3.7") def test_mypy_knows_of_dataframe_methods(self): # If MyPy knows of some arbitrary DataFrame methods, we can assume that # code completion works. exit_code, stdout, stderr = check_mypy_on_code( """ from typing import Any from nptyping import DataFrame df: DataFrame[Any] df.shape df.dtypes df.values df.boxplot df.filter """ ) > self.assertEqual(0, exit_code, stdout) E AssertionError: 0 != 1 : nptyping/pandas_/dataframe.pyi:25: error: Skipping analyzing "pandas": module is installed, but missing library stubs or py.typed marker [import] E nptyping/pandas_/dataframe.pyi:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports E nptyping/typing_.pyi:50: error: Name "np.bool8" is not defined [name-defined] E nptyping/typing_.pyi:52: error: Name "np.object0" is not defined [name-defined] E nptyping/typing_.pyi:64: error: Name "np.int0" is not defined [name-defined] E nptyping/typing_.pyi:77: error: Name "np.uint0" is not defined [name-defined] E nptyping/typing_.pyi:104: error: Name "np.void0" is not defined [name-defined] E nptyping/typing_.pyi:109: error: Name "np.bytes0" is not defined [name-defined] E nptyping/typing_.pyi:111: error: Name "np.str0" is not defined [name-defined] E Found 8 errors in 2 files (checked 1 source file) tests/pandas_/test_mypy_dataframe.py:61: AssertionError =============================== warnings summary =============================== nptyping/typing_.py:51 /home/tkloczko/rpmbuild/BUILD/nptyping-2.5.0/nptyping/typing_.py:51: DeprecationWarning: `np.bool8` is a deprecated alias for `np.bool_`. (Deprecated NumPy 1.24) Bool8 = np.bool8 nptyping/typing_.py:54 /home/tkloczko/rpmbuild/BUILD/nptyping-2.5.0/nptyping/typing_.py:54: DeprecationWarning: `np.object0` is a deprecated alias for ``np.object0` is a deprecated alias for `np.object_`. `object` can be used instead. (Deprecated NumPy 1.24)`. (Deprecated NumPy 1.24) Object0 = np.object0 nptyping/typing_.py:66 /home/tkloczko/rpmbuild/BUILD/nptyping-2.5.0/nptyping/typing_.py:66: DeprecationWarning: `np.int0` is a deprecated alias for `np.intp`. (Deprecated NumPy 1.24) Int0 = np.int0 nptyping/typing_.py:80 /home/tkloczko/rpmbuild/BUILD/nptyping-2.5.0/nptyping/typing_.py:80: DeprecationWarning: `np.uint0` is a deprecated alias for `np.uintp`. (Deprecated NumPy 1.24) UInt0 = np.uint0 nptyping/typing_.py:107 /home/tkloczko/rpmbuild/BUILD/nptyping-2.5.0/nptyping/typing_.py:107: DeprecationWarning: `np.void0` is a deprecated alias for `np.void`. (Deprecated NumPy 1.24) Void0 = np.void0 nptyping/typing_.py:112 /home/tkloczko/rpmbuild/BUILD/nptyping-2.5.0/nptyping/typing_.py:112: DeprecationWarning: `np.bytes0` is a deprecated alias for `np.bytes_`. (Deprecated NumPy 1.24) Bytes0 = np.bytes0 nptyping/typing_.py:114 /home/tkloczko/rpmbuild/BUILD/nptyping-2.5.0/nptyping/typing_.py:114: DeprecationWarning: `np.str0` is a deprecated alias for `np.str_`. (Deprecated NumPy 1.24) Str0 = np.str0 ../../../../../usr/lib64/python3.8/unittest/loader.py:66 /usr/lib64/python3.8/unittest/loader.py:66: PytestCollectionWarning: cannot collect test class 'TestLoader' because it has a __init__ constructor (from: tests/test_wheel.py) class TestLoader(object): -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ SKIPPED [1] tests/test_wheel.py:91: Does not work on 3.11 due to invoke SKIPPED [1] tests/test_wheel.py:109: Does not work on 3.11 due to invoke SKIPPED [1] tests/test_wheel.py:124: Does not work on 3.11 due to invoke FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_any - Ass... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_shape - A... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarray_with_structure FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarrays_as_function_arguments FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_ndarrays_as_variable_hints FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_nptyping_types - Asser... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_numpy_types - Assertio... FAILED tests/test_mypy.py::MyPyTest::test_mypy_accepts_recarray_with_structure FAILED tests/test_mypy.py::MyPyTest::test_mypy_disapproves_ndarray_with_wrong_function_arguments FAILED tests/test_mypy.py::MyPyTest::test_mypy_knows_of_ndarray_methods - Ass... FAILED tests/pandas_/test_mypy_dataframe.py::MyPyDataFrameTest::test_mypy_accepts_dataframe FAILED tests/pandas_/test_mypy_dataframe.py::MyPyDataFrameTest::test_mypy_disapproves_dataframe_with_wrong_function_arguments FAILED tests/pandas_/test_mypy_dataframe.py::MyPyDataFrameTest::test_mypy_knows_of_dataframe_methods ======= 13 failed, 94 passed, 3 skipped, 8 warnings in 62.90s (0:01:02) ======== ```
kloczek commented 1 year ago

gentle ping .. ay update? 🤔

mgorny commented 1 year ago

@kloczek, not sure if you need it directly but in Gentoo we only needed it for tests in sphinx-autodoc-typehints. I've just removed the deps and marked nptyping for removal.

kloczek commented 1 year ago

@kloczek, not sure if you need it directly but in Gentoo we only needed it for tests in sphinx-autodoc-typehints. I've just removed the deps and marked nptyping for removal.

Just checked and .. it is yet another module

[tkloczko@pers-jacek SPECS]$ grep "BuildRequires:.*python3dist(nptyping)" *
python-sphinx-autodoc-typehints.spec:BuildRequires:     python3dist(nptyping)
python-typish.spec:BuildRequires:       python3dist(nptyping)}