Data specifications by type hints
Project description
typespecs
Data specifications by type hints
Examples
from dataclasses import dataclass
from typespecs import Spec, from_dataclass
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_dataclass(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-0.4.0.tar.gz
(67.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-0.4.0.tar.gz.
File metadata
- Download URL: typespecs-0.4.0.tar.gz
- Upload date:
- Size: 67.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"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 |
965c20bcacc3c50cabebcbaccf89a1985c749785f7dbf665977a98b5c80a3acd
|
|
| MD5 |
e5cd8256ceafd6e9375ef39cd7be692f
|
|
| BLAKE2b-256 |
eb2d74d5a32031a4d72d0899268b3e4b2e8aa38c698624db64dd268475f2403c
|
File details
Details for the file typespecs-0.4.0-py3-none-any.whl.
File metadata
- Download URL: typespecs-0.4.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"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 |
6bf39a0059772bb45eefb395192602c00942124c3266c13e2642dfcc62b57257
|
|
| MD5 |
e25b62a64e970fff1b869871625c3233
|
|
| BLAKE2b-256 |
0016f8b952217e628b29e97ce4144dadf110ae3bc3742e114632a459f0361444
|