Skip to main content

Typing for array API and array-api-compat

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Python array API standard typing

CI Status Documentation Status Test coverage percentage

uv Ruff pre-commit

PyPI Version Supported Python versions License


Documentation: https://array-api.readthedocs.io

Source Code: https://github.com/34j/array-api


Typing for array API and array-api-compat

Installation

Install this via pip (or your favourite package manager):

pip install array-api

Usage

Type stubs

Provices type stubs for array-api-compat.

import array_api_compat

xp = array_api_compat.array_namespace(x)

Screenshot 1 Screenshot 2

Array Type

from array_api._2024_12 import Array


def my_function[TArray: Array](x: TArray) -> TArray:
    return x + 1

Namespace Type

You can test if an object matches the Protocol by:

import array_api_strict

from array_api._2024_12 import ArrayNamespace, ArrayNamespaceFull


assert isinstance(array_api_strict, ArrayNamespace)
# Full version contains fft and linalg
# fft and linalg are not included by default in array_api_strict
assert not isinstance(array_api_strict, ArrayNamespaceFull)

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

Credits

Copier

This package was created with Copier and the browniebroke/pypackage-template project template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

array_api-1.0.0.tar.gz (365.5 kB view details)

Uploaded Source

Built Distribution

array_api-1.0.0-py3-none-any.whl (368.8 kB view details)

Uploaded Python 3

File details

Details for the file array_api-1.0.0.tar.gz.

File metadata

  • Download URL: array_api-1.0.0.tar.gz
  • Upload date:
  • Size: 365.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for array_api-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e354c466f68daadc6a45330e1c90df5560d2c3fcaa351fd003ce8f1b85a37e17
MD5 e8bd062f18e30440a7c1549ef1eb01a9
BLAKE2b-256 ea69c5015ba09a4c7dfc59de091c60c96d8555cfe81a3ab97b3491552c7ddda9

See more details on using hashes here.

Provenance

The following attestation bundles were made for array_api-1.0.0.tar.gz:

Publisher: ci.yml on 34j/array-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file array_api-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: array_api-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 368.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for array_api-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5bdc02b81c6c3f957324869b6abed19744630777541097e400e26f07881c8b07
MD5 c9c42a5eecd985201216cd8f76713f90
BLAKE2b-256 71772e33ceaf3fdf7959a18222a7ed1c56b1f7e746d3c07f9bf7f4810283da06

See more details on using hashes here.

Provenance

The following attestation bundles were made for array_api-1.0.0-py3-none-any.whl:

Publisher: ci.yml on 34j/array-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page