Skip to main content

Type-Less PyPI

Type Less

Find yourself typing less with automatic type inference for Python! Inject function return types at runtime for code generation 🤙.

FastAPI Example

class User:
    id: int
    first: str
    last: str

@app.get("/user/me")
def user_me(user: User):
    return {
        "id": user.id,
        "balance": 13.37,
        "name": {
            "first": user.first,
            "last": user.last,
        },
    }

🚀 Generates Return Types:

class UserMeName(TypedDict):
    first: str
    last: str

class UserMe(TypedDict):
    id: int
    balance: Literal[13.37]
    name: UserMeName

📋 OpenAPI Spec:

OpenAPI Example

Using in FastAPI Project

Inject types before by hooking before setting up routes. Types will be automatically generated when new routes are added.

from type_less.inject import inject_fastapi_route_types
from fastapi import FastAPI

app = FastAPI()
app = inject_fastapi_route_types(app)

@app.get("/test")
def test(request):
    ...

Testing

  • uv run pytest

TODO:

Add Support:

  • Nested class inference
  • Deep function call / return inference

Better Way?:

  • Possibly use pyright, pyre, mypy, or anything else to infer the type?

Cleanup:

  • Possibly refactor - a large portion of the initial work was codegen from claude and has patterns that need rethinking of proper documentation

Metadata

Release files for type-less 0.1.28

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

Source distribution (sdist)

Source distribution for type-less 0.1.28
File Size Uploaded Provenance
type_less-0.1.28.tar.gz 77.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for type-less 0.1.28
File Interpreter ABI Platform
type_less-0.1.28-py3-none-any.whl Python 3 none any Details

Total release size: 90.4 kB

Release files / type_less-0.1.28.tar.gz

Download URL type_less-0.1.28.tar.gz
Size 77.7 kB
Tags Source
SHA-256 checksum
How to use checksums
08b2a229b3cc0aec28940c398699c8c13d85de92e11badea70b67b359d6c94d9
BLAKE2b-256 checksum
How to use checksums
c2eac56df22ea74fdc033877e1360ad0c5be8a53053f35dc63c472e2de7da86e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.27.0 CPython/3.14.5 Linux/6.17.0-1015-azure

Release files / type_less-0.1.28-py3-none-any.whl

Download URL type_less-0.1.28-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12a1fa43a57cdb41bd38fe0c1264a9726534090d4d616ddcbc4bfaab6ebe8d08
BLAKE2b-256 checksum
How to use checksums
40d5c7a19d8ad3fd812f20c11fd768582b594ddbd8303c571b59656c86306f16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.27.0 CPython/3.14.5 Linux/6.17.0-1015-azure

Security for type-less 0.1.28

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.

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