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.0rc3.tar.gz
(74.1 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.0rc3.tar.gz.
File metadata
- Download URL: typespecs-1.0.0rc3.tar.gz
- Upload date:
- Size: 74.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"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 |
6015e3290cd1c72366dfac8a82e9886fb601ec8dc58b35a719f34d9bc0b02759
|
|
| MD5 |
681a254b967c300d4013bc312caca3e5
|
|
| BLAKE2b-256 |
7479b33307033dfeb871789e15a53c8162b4010c2a470c2ba7d44112d6ea0ce3
|
File details
Details for the file typespecs-1.0.0rc3-py3-none-any.whl.
File metadata
- Download URL: typespecs-1.0.0rc3-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"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 |
ff6b9b989eee7aa9652f659abacc1531714dbc3e6f625563dda1118a8ddf4c18
|
|
| MD5 |
86588b4873be473ca922914d139b0fdf
|
|
| BLAKE2b-256 |
441d0779eeae1f79a9c73f34b32bf342ce8ec6d9aff673c75544ad580ac57369
|