Skip to main content

cupy-stubs

Tests PyPI Python versions License

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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cupy-stubs 1.3.1
File Size Uploaded Provenance Actions
cupy_stubs-1.3.1.tar.gz 21.1 kB With provenance Details for cupy_stubs-1.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cupy-stubs 1.3.1
File Interpreter ABI Platform Actions
cupy_stubs-1.3.1-py3-none-any.whl Python 3 none any Details for cupy_stubs-1.3.1-py3-none-any.whl

Total release size: 47.3 kB

Release files / cupy_stubs-1.3.1.tar.gz

Download URL cupy_stubs-1.3.1.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
76338c9d3988d550cbe85906bbc17a85aaf3038a3d6a6da3fef76247634c6a22
BLAKE2b-256 checksum
How to use checksums
233a330d9d6bc4175f5587a7fd8322c7343727998f3e160bfdc2a5f24cd41e4c
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 Nov 20, 2026.

Transparency log

Release files / cupy_stubs-1.3.1-py3-none-any.whl

Download URL cupy_stubs-1.3.1-py3-none-any.whl
Size 26.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc3abc065e2fb524db68064770db2beca240b51888c129bfeaeecfe25ce2da79
BLAKE2b-256 checksum
How to use checksums
6a593a31155439601e6a2cdd8c300fa6ec71f27880b3c5b95064c6c7dbed5294
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 Nov 20, 2026.

Transparency log

Security for cupy-stubs 1.3.1

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cupy_stubs-1.3.1.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 Nov 20, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page