Type transformations
Project description
tytr
Type transformations for Python.
Create types from class definitions.
Create tests to keep those types up to date.
Type creation
# foo.py
class Foo:
a: int
b: float
A TypedDict based on Foo:
$ tytr gen typeddict foo.py::Foo --name FooDict
# 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:
$ tytr gen getter foo.py::Foo --name GetFoo
# 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
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
tytr-0.1.1.tar.gz
(59.6 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
tytr-0.1.1-py3-none-any.whl
(17.3 kB
view details)
File details
Details for the file tytr-0.1.1.tar.gz.
File metadata
- Download URL: tytr-0.1.1.tar.gz
- Upload date:
- Size: 59.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","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 |
9d8fcca5d4f125e2abf8d1fd08e74061e49e80c01bb575f98c81ff0c08b3d2c8
|
|
| MD5 |
a8a57fcb97ad1f3ad77befa13f20cab2
|
|
| BLAKE2b-256 |
2cca07a67d3da1d7b298911d9959b17902c91f7b0ba7a7111c1ddb5ef068de41
|
File details
Details for the file tytr-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tytr-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","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 |
7f0934660c1e16e008319ef7f6ef94b15526037013b15172c378ec029494fe3a
|
|
| MD5 |
e66533a694e3387c7c8c5cae457daf81
|
|
| BLAKE2b-256 |
c929db5097d9c80500d83447bdbd999d4e7f64cc0f5c0971864e2d8c6b62a796
|