cupy-stubs
Type stubs for CuPy
Installation
Add cupy-stubs to your type checking dependencies.
Array shapes
cupy.ndarray has the same type parameters as numpy.ndarray: a shape and a dtype.
Most functions return an unknown shape (ndarray[tuple[int, ...], ...]),
but some parameters require a specific number of dimensions,
e.g. cupy.bincount only accepts 1D arrays.
Checking arr.shape or arr.ndim doesn't change the type of arr.
To get a 1D array, flatten it (no copy for contiguous arrays):
counts = cp.bincount(labels.ravel())
or narrow it with a type guard:
from typing import TypeIs
def is_1d(x: cp.ndarray) -> TypeIs[cp.ndarray[tuple[int]]]:
return x.ndim == 1
if not is_1d(labels):
msg = f"Expected 1D labels, got {labels.ndim}D"
raise ValueError(msg)
counts = cp.bincount(labels)
Release notes
See the GitHub releases.
Contact
For questions and help requests, you can reach out in the scverse discourse. If you found a bug, please use the issue tracker.
Metadata
Release files for cupy-stubs 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cupy_stubs-1.3.0.tar.gz | 20.9 kB | With provenance | Details for cupy_stubs-1.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cupy_stubs-1.3.0-py3-none-any.whl | Python 3 | none | any | Details for cupy_stubs-1.3.0-py3-none-any.whl |
Total release size: 46.8 kB
Release files / cupy_stubs-1.3.0.tar.gz
| Download URL | cupy_stubs-1.3.0.tar.gz |
|---|---|
| Size | 20.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4027007d2e94386596d4d17121d7bc7ad726313c27af511d15ad7becb0670efb
|
|
BLAKE2b-256 checksum How to use checksums |
c332fd7f8e3182325be39c60969108907685d234b2f2f99d9f97d2161e4b2275
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / cupy_stubs-1.3.0-py3-none-any.whl
| Download URL | cupy_stubs-1.3.0-py3-none-any.whl |
|---|---|
| Size | 26.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e2a9251e248617e04a500f12777df005f29e32dded0b2c18f18fd07c869f35e1
|
|
BLAKE2b-256 checksum How to use checksums |
3e202e8c8acfe3e33620605eaaac0159f80d18a353d7d4d8cbb42cbbf70a9c09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logSecurity for cupy-stubs 1.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for cupy_stubs-1.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.