Metadata-Version: 2.4
Name: typespecs
Version: 0.2.0
Summary: Data specifications by type hints
Project-URL: homepage, https://astropenguin.github.io/typespecs/v0.2.0
Project-URL: repository, https://github.com/astropenguin/typespecs
Author-email: Akio Taniguchi <taniguchi.akio@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Akio Taniguchi
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: dataclasses,specifications,typing
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: <3.15,>=3.10
Requires-Dist: pandas-stubs<3,>=2
Requires-Dist: pandas<3,>=2
Requires-Dist: typing-extensions<5,>=4
Description-Content-Type: text/markdown

# typespecs
Data specifications by type hints

## Examples

```python
from dataclasses import dataclass
from typespecs import Attr, from_dataclass
from typing import Annotated


@dataclass
class Weather:
    temp: Annotated[
        list[float],
        Attr("category", "data"),
        Attr("name", "Temperature"),
        Attr("units", "K"),
    ]
    wind: Annotated[
        list[float],
        Attr("category", "data"),
        Attr("name", "Wind speed"),
        Attr("units", "m/s"),
    ]
    loc: Annotated[
        str,
        Attr("category", "meta"),
        Attr("name", "Observed location"),
    ]


weather = Weather([273.15, 280.15], [5.0, 10.0], "Tokyo")
print(from_dataclass(weather))
```
```
      category               name units              data           type
index
temp      data        Temperature     K  [273.15, 280.15]    list[float]
wind      data         Wind speed   m/s       [5.0, 10.0]    list[float]
loc       meta  Observed location  <NA>             Tokyo  <class 'str'>
```
