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.6.0.tar.gz
(67.2 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.6.0.tar.gz.
File metadata
- Download URL: typespecs-0.6.0.tar.gz
- Upload date:
- Size: 67.2 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 |
6628006fcd8b009247671a6d1bfaeacbf7c438abedd1b02eb4ab0046f68862bb
|
|
| MD5 |
6aa4b7a3b4e26472d50fff022cf86c95
|
|
| BLAKE2b-256 |
eb1f76baf7706aa1c2384680316d8ed7905bb35df742a520b33ace97ef11ffc1
|
File details
Details for the file typespecs-0.6.0-py3-none-any.whl.
File metadata
- Download URL: typespecs-0.6.0-py3-none-any.whl
- Upload date:
- Size: 6.4 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 |
3720e1f39244b0263cb8ff7521bcc2412a2740dd50d3a869bb4bd93acf520f75
|
|
| MD5 |
27c831a37877f8a0195d9710824fbbc1
|
|
| BLAKE2b-256 |
a5338637e1e7df1103b1469cad61f3f1ce5d91f4acd5c4cecdf147a17187c5d3
|