Skip to main content

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
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

Metadata

Release files for typestr 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for typestr 0.3.1
File Size Uploaded Provenance Actions
typestr-0.3.1.tar.gz 2.9 kB Without provenance Details for typestr-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for typestr 0.3.1
File Interpreter ABI Platform Actions
typestr-0.3.1-py3-none-any.whl Python 3 none any Details for typestr-0.3.1-py3-none-any.whl

Total release size: 6.0 kB

Release files / typestr-0.3.1.tar.gz

Download URL typestr-0.3.1.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
95edb9f595fca978b75b9c61756735f9e5290ca70ea18028ff94d54591b64681
BLAKE2b-256 checksum
How to use checksums
6e8a268fa2fff91608f39289b99641e75315b87c09cd3671fea41431c40a7e53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / typestr-0.3.1-py3-none-any.whl

Download URL typestr-0.3.1-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f342e4149099f20c813ddf2dc7b00f9b1d74bb81d6c27dc0e7e9b2460000781
BLAKE2b-256 checksum
How to use checksums
f807b6432b6dbe2a28fa7ea77f10d8902d7b15bfa7d7bb1c116ef527b4b5bbd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for typestr 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page