Metadata-Version: 2.4
Name: tytr
Version: 0.1.1
Summary: Type transformations
Author: Davis Bennett
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
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: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Requires-Dist: typing-extensions>=4.5.0; python_version < '3.13'
Description-Content-Type: text/markdown

# tytr

Type transformations for Python.

Create types from class definitions.

Create tests to keep those types up to date.

## Type creation

```python
# foo.py
class Foo:
    a: int
    b: float
```

A `TypedDict` based on `Foo`:

```bash
$ tytr gen typeddict foo.py::Foo --name FooDict
```

```python
# Generated by tytr gen typeddict
from __future__ import annotations
from typing_extensions import TypedDict

class FooDict(TypedDict):
    a: int
    b: float
```

A protocol for a getter for `Foo`:

```bash
$ tytr gen getter foo.py::Foo --name GetFoo
```

```python
# Generated by tytr gen getter
from __future__ import annotations
from typing import Literal, Protocol, overload

class GetFoo(Protocol):
    @overload
    def __call__(self, key: Literal["a"]) -> int: ...

    @overload
    def __call__(self, key: Literal["b"]) -> float: ...
```

... and many more
