Data specifications by type hints
Project description
typespecs
Data specifications by type hints
Examples
from dataclasses import dataclass
from typespecs import Spec, from_annotated
from typing import Annotated as Ann
@dataclass
class Weather:
temp: Ann[list[float], Spec(category="data", name="Temperature", units="K")]
wind: Ann[list[float], Spec(category="data", name="Wind speed", units="m/s")]
loc: Ann[str, Spec(category="metadata", name="Observed location")]
weather = Weather([273.15, 280.15], [5.0, 10.0], "Tokyo")
specs = from_annotated(weather)
print(specs)
category data name type units
temp data [273.15, 280.15] Temperature list[float] K
wind data [5.0, 10.0] Wind speed list[float] m/s
loc metadata Tokyo Observed location <class 'str'> <NA>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
typespecs-1.0.0rc2.tar.gz
(71.4 kB
view details)
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 typespecs-1.0.0rc2.tar.gz.
File metadata
- Download URL: typespecs-1.0.0rc2.tar.gz
- Upload date:
- Size: 71.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf42bdd0aacfac08d336ba761b867f7b5b31e2948e17f619499cf0690962542c
|
|
| MD5 |
48bb866472c3b0b7494857ce917e1daf
|
|
| BLAKE2b-256 |
b04fd45368f2ba4d01a95c1aa4806ea4c450b220360a418e8cd1c2d1019169b6
|
File details
Details for the file typespecs-1.0.0rc2-py3-none-any.whl.
File metadata
- Download URL: typespecs-1.0.0rc2-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50cb84aebfe5c86d6e06cf8493deb134536099995e972f6c9f5cb79bb4de435b
|
|
| MD5 |
fe87b6574360c72a1ad068141ec7b155
|
|
| BLAKE2b-256 |
4b25065970c41ba4b46b8bb063630b1d11e1ee230df18f3f25d1f10158fb5761
|