Metadata-Version: 2.5
Name: glyff-pydantic
Version: 0.14.0
Summary: Pydantic-based Serializer and ArgumentCanonicalizer for glyff.
License: MIT License
        
        Copyright (c) 2026 nueruyu
        
        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
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: AsyncIO
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: glyff>=0.14.0
Requires-Dist: pydantic>=2.0
Description-Content-Type: text/markdown

# glyff-pydantic

Pydantic-based `Serializer` and `ArgumentCanonicalizer` implementations for
[glyff](https://pypi.org/project/glyff/).

Lets a glyff session record results of any type Pydantic's `TypeAdapter` can
handle, and key executions on arguments that are Pydantic models.

## Install

```bash
pip install glyff-pydantic
```

This package depends on `glyff>=0.14.0` and `pydantic>=2.0`.

## Public API

| Name                 | Description                                                                                      |
| -------------------- | ------------------------------------------------------------------------------------------------ |
| `PydanticSerializer` | Serializes values to JSON using `TypeAdapter`. Restores typed values on read.                    |
| `PydanticArgumentCanonicalizer` | Canonicalizes function arguments through Pydantic's own dump, for stable, type-aware identity. |

`PydanticSerializer` works with any type `TypeAdapter` handles. The
canonicalizer's reach is narrower by design: it dumps `BaseModel` instances and
represents the scalars pydantic knows (`datetime`, `UUID`, `Decimal`), while
every container is walked by glyff's shared canonicalization so mappings, sets
and fallback representations follow one set of rules.

Both satisfy the contracts in `glyff.testing`; what they inherit from the stdlib
JSON implementations is proved in `glyff`, and this package's own tests cover
what Pydantic changes.

Canonical arguments are part of an execution's identity, so they must stay stable
across code changes — see
[execution identity](https://github.com/nueruyu/glyff/blob/main/docs/execution-identity.md)
for what the canonicalizer may and may not see.

## Status

Pre-1.0 — the API is unstable and will change.

## License

MIT
