Repository navigation
0.5.1: no inherited operation a library cannot perform; host calls leave the accelerator alone; warn_return_any on - #13
Merged
Conversation
ArrayLibrary supplies no implementation that assumes an array API. The NumPy-style defaults move to NumpyArrayApi (NumPy, CuPy, JAX); linspace, ones, outer and floor are declared by ArrayMath, which pyclesperanto does not inherit; assignment by item is InPlaceAssignment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The execution wrapper reads the device from the call's arguments. It used to ask the library for its current device whenever an accelerator existed, which for torch initialises CUDA and opens a stream for a function working on host tensors, and used the selected device's stream even when the data was on another device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… type warn_return_any is on and ignore_missing_imports is off. The numpy.* follow_imports = "skip" override is gone. Every library the package imports is declared in stubs/, which lists what arraybridge calls and comes before an installed copy on mypy_path, so the result does not depend on what is installed. CI checks `mypy src/ stubs/`. - A leaf states `module = <library>` under TYPE_CHECKING, so its calls are checked against the declaration of that one library. - NumpyArrayApi and MutableArrays name their module by the Protocols NumpyFunctions and MutableNumpyFunctions, and their arrays by NumpyArray and MutableNumpyArray; each leaf returns its module from `array_module` and the checker compares the two. - Values with no static type are checked where they enter: _mapped_dtype (the dtype class asked for), MemoryContractAttribute.read (a name or None), DeviceMove.convert (one library), DLPackExchange.convert (the target imports DLPack), TorchLibrary.stream_scope (a torch stream). - AcceleratorDevices asks each leaf for _device_if_accepted; CudaLibrary for create_stream; DLPackImport.from_dlpack returns NotImplemented when the leaf's _reads_dlpack says no, so _import_dlpack returns an array. - The MemoryType metaclass overrides carry EnumMeta's signatures. The __call__ override is removed: Enum already asks _missing_ for a value it does not know. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-ups to 0.5.0. Details are in
CHANGELOG.md.ArrayLibrarysupplies no NumPy-style implementation.NumpyArrayApi(NumPy, CuPy, JAX) holds them;ArrayMathdeclareslinspace/ones/outer/floorand pyclesperanto does not inherit it, so those four are anAttributeErrorthere instead of a failure inside the call;InPlaceAssignmentholdsassignby item.tests/test_operation_soundness.pycalls every array operation on every importable library and checks the class structure of the rest.torch.cuda.current_device()(which initialises CUDA) or opens a stream; data on device N uses device N's stream.warn_return_any = true,ignore_missing_imports = false, thenumpy.*skip override removed. Each imported library is declared instubs/(first onmypy_path, not in the wheel);NumpyArrayApinames its module by a Protocol. NoAny, no casts, no ignores. Enum metaclass overrides annotated.CONTRIBUTING.md: compatibility rule removed.TESTING.md: commands for a GPU run.Local: 344 passed, 123 skipped on Python 3.10, 3.12, 3.13 (NumPy only); 372 passed, 95 skipped on 3.12 with the torch CPU wheel;
mypy src/ stubs/, ruff and black clean. Not run on a GPU.🤖 Generated with Claude Code