Skip to main content

Py Jaxtyping

Pydantic support for Jaxtyping array annotations

Usage

Instead of Int[np.ndarray, 'B 256 64 3'], do PyArray[Int, int, 'B 256 64 3']

You can use it with jaxtyping as normal, but also it will:

  • Serialize to nested lists
  • Validate the correct shape and datatypes from serialized lists

Example

from pydantic import BaseModel, ConfigDict
from py_jaxtyping import PyArray
from jaxtyping import Int
import numpy as np

class Sample(BaseModel):
  model_config = ConfigDict(arbitrary_types_allowed=True)
  img: PyArray[Int, int, "W H 3"]
  label: str

Sample.model_validate({
  'img': np.ones((256, 64, 3)),
  'label': 'car'
})
# checks out!


Sample.model_validate({
  'img': np.ones((256, 64, 1)),
  'label': 'car'
})
# fails: invalid dims :/

Metadata

Release files for py-jaxtyping 0.1.5

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

Source distribution (sdist)

Source distribution for py-jaxtyping 0.1.5
File Size Uploaded Provenance Actions
py_jaxtyping-0.1.5.tar.gz 2.8 kB Without provenance Details for py_jaxtyping-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py-jaxtyping 0.1.5
File Interpreter ABI Platform Actions
py_jaxtyping-0.1.5-py3-none-any.whl Python 3 none any Details for py_jaxtyping-0.1.5-py3-none-any.whl

Total release size: 6.6 kB

Release files / py_jaxtyping-0.1.5.tar.gz

Download URL py_jaxtyping-0.1.5.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
196fa11613a56ff506b2d3d977d57be6860a5635f4199e432a33d014d1ae5c73
BLAKE2b-256 checksum
How to use checksums
6f3d3debfa3b3499bc898b5246e1504d75dc1c2c13eaccfc3b98d1418c36796c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.9

Release files / py_jaxtyping-0.1.5-py3-none-any.whl

Download URL py_jaxtyping-0.1.5-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e3f22dac8bd01081387731e8932ebacd6e0035072b2c53c913ebbef5f50283e
BLAKE2b-256 checksum
How to use checksums
c7d1b58f144895eba1a333e8592c7bad089872a8796c33eaff977678acbf1121
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.9

Security for py-jaxtyping 0.1.5

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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