Metadata-Version: 2.4
Name: fields-metadata
Version: 1.8.0
Summary: A Python library for extracting field metadata from dataclasses and Pydantic models
Project-URL: Homepage, https://gitlab.com/Kencho1/fields-metadata
Project-URL: Repository, https://gitlab.com/Kencho1/fields-metadata
Project-URL: Documentation, https://fields-metadata.readthedocs.io
Author: Jesús Alonso Abad
License: MIT
License-File: LICENSE
Keywords: dataclass,introspection,metadata,pydantic,reflection
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: annotated-types~=0.6
Requires-Dist: therismos
Provides-Extra: dev
Requires-Dist: mypy>=1.7.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
Requires-Dist: pytest>=7.4.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Requires-Dist: tox>=4.0.0; extra == 'dev'
Provides-Extra: pydantic
Requires-Dist: pydantic-extra-types>=2.0; extra == 'pydantic'
Requires-Dist: pydantic>=2.0; extra == 'pydantic'
Description-Content-Type: text/markdown

# fields-metadata

A Python library for extracting comprehensive field metadata from dataclasses and Pydantic models,
with support for derived fields, custom annotations, filtering/sorting/grouping via
[therismos](https://pypi.org/project/therismos/), and recursive traversal of nested structures.

## Installation

```bash
pip install fields-metadata
pip install "fields-metadata[pydantic]"  # with Pydantic support
```

## Quick Start

```python
from dataclasses import dataclass
from typing import Annotated
from annotated_types import DocInfo, Ge
from fields_metadata import MetadataExtractor, HumanReadableId

@dataclass
class Person:
    name: Annotated[str, HumanReadableId(), DocInfo("Full name")]
    age: Annotated[int, Ge(0)]
    email: str | None = None

extractor = MetadataExtractor()
metadata = extractor.extract(Person)

print(metadata["name"].doc)        # "Full name"
print(metadata["age"].numeric)     # True
print(metadata["email"].optional)  # True
```

Full documentation: [fields-metadata.readthedocs.io](https://fields-metadata.readthedocs.io)

## License

MIT
