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-0.5.0.tar.gz
(67.6 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.5.0.tar.gz.
File metadata
- Download URL: typespecs-0.5.0.tar.gz
- Upload date:
- Size: 67.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"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 |
8975a7db6025968afd0cfde2413c0fc2a9d3bfeabe441a55e5743e2c4a65b36e
|
|
| MD5 |
5caa942bd4e46039479255fbc1909b79
|
|
| BLAKE2b-256 |
ea668810c0007365f347b1a5c1f5b768dfd1126b5f0597e3b417ffccdd9fafb0
|
File details
Details for the file typespecs-0.5.0-py3-none-any.whl.
File metadata
- Download URL: typespecs-0.5.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"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 |
36cb45b433c559c611bbbae8d6c7485adae2b25b553242eee6281c5db5a8eeb8
|
|
| MD5 |
e53fd13d4f70315bc9dce4283f9a5a93
|
|
| BLAKE2b-256 |
9fe3e92808f7598013999d173d9d72345df512a4887772c36a72199830ee9af4
|