Metadata-Version: 2.4
Name: typestr
Version: 0.3
Summary: Human-readable type strings for Python
Author-email: "UnknownUser03393@github.com" <bilibilireds2023@outlook.com>
License: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# pytypestr

Human-readable type strings for Python.

Single-file, zero-dependency utility for rendering Python type hints into clean, modern signatures.

---

## Usage

PyPI: https://pypi.org/project/typestr/0.1.0/

```
pip install typestr
```

```python
from typing import Literal
from typestr import render_function, render_type


def foo(x: int | None, y: list[str]) -> bool:
	pass


print(render_function(foo))
print(render_type(
	list[
		Literal[200, 300, 400]
		| tuple[str | int, str, dict[str, int | float], ...]
		]
))
````

**Output:**

```
(x: int?, y: list<str>) -> bool
list<200 | 300 | 400 | (str | int, str, dict<str, int | float>, ...)>
```

---

## Features

* Modern `Union` syntax `Union[A, B]` → `A | B`

* Modern `Literal` syntax `Literal[A, B, ...]` → `A | B | ...`

* Tuple formatting `tuple[A, B, ...]` → `(A, B, ...)`

* Generic types `list[A]` → `list<A>`

* Optional shorthand `Optional[A]` → `A?`

* Callable signatures `Callable[[A], B]` → `(A) -> B`

* Built-in container types support

---

## License

MIT
