Python strong typing suite, along with Typed NumPy: Static shape typing and runtime shape validation.
Project description
typingkit
Python strong typing suite, along with Typed NumPy: Static shape typing and runtime shape validation.
[!WARNING] Experimental & WIP. See USAGE.md for more details.
Installation
Install uv (optional, recommended)
Install uv, if not already.
Check here for installation instructions.
It is recommended to use uv, as it will automatically install the dependencies in a virtual environment.
If you don't want to use uv, skip to the next step.
TL;DR: Just run
curl -LsSf https://astral.sh/uv/install.sh | sh
Install the package
The dependencies are listed in the pyproject.toml file.
At present, the only required dependency is numpy.
Install the package from the PyPI release:
# Using uv
uv add typingkit
# Or with pip
pip3 install typingkit
To install from the latest commit:
uv add git+https://github.com/AshrithSagar/typingkit.git@main
Usage
from typing import TypeVar
from typingkit._typed.ndarray import TypedNDArray
# Shape variables are just regular TypeVar's
N = TypeVar("N", bound=int, default=int)
M = TypeVar("M", bound=int, default=int)
# Create aliases such as these, or use TypedNDArray directly
Vector = TypedNDArray[tuple[N]]
Matrix = TypedNDArray[tuple[M, N]]
v1 = Vector([1, 2, 3]) # Passes
v2 = Vector([4, 5, 6, 7]) # Also passes
v3 = TypedNDArray[tuple[int]]([[8, 9]])
# Fails, since expected 1D array but passed in a 2D array
See USAGE.md for more details.
License
This project falls under the MIT License.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file typingkit-0.2.2.tar.gz.
File metadata
- Download URL: typingkit-0.2.2.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e630d9bf788e3d5f3648274ca7c118cbf6699f7d2429b6ae8d566d6ae1b7abc
|
|
| MD5 |
2c02795a42b79ac5489c38307d7680fe
|
|
| BLAKE2b-256 |
daf6d5fe55c378093d2d9a4de6c5d1a3423eb348b9089e2f1ee9857e29612dca
|
File details
Details for the file typingkit-0.2.2-py3-none-any.whl.
File metadata
- Download URL: typingkit-0.2.2-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0bd6ddb71162ba454e0f3990f6d6fae0b74163c746a9633b110052f898185e9
|
|
| MD5 |
3c251ac4266bd6a4464b1ac472583642
|
|
| BLAKE2b-256 |
05b748abccccc60d215c58c25ececfcf2c67a0ee59de7ab8fd9b387265a13ca6
|