Skip to main content

typing-clean

PyPI GitHub Release

Syntax sugar: import contents of built-in typing module — with protected and shortened names.
(_A for Any, _C for Callable, etc.)

TL;DR

You like type-hinted python, but you hate how much EVERY module's namespace is cluttered with typing objects? Then:

  • Instead of importing from typing or typing_extensions, import from this typing_clean;
  • Use the same objects, just their names prefixed with underscores (Iterable -> _Iterable);
  • They will stay inside your module, never auto-propagating up the import chain;
  • Ask the maintainers of the lib you use to adopt typing-clean, too.

How

This module is deliberately the most barebones wrapper: it implements NOTHING. It merely imports from typing and typing_extensions with prefixed names. Any IDE should be 100% compatible with it.

What and why

By its very purpose, the entire contents of the built-in typing module is what you'd call "implementation details": whenever any of its objects get imported in a module, they should stay hidden inside the module - never to be suggested by an IDE's autocomplete when the module itself gets imported.

But, as you are well aware, this is not what happens. Instead, if you want to code typed python, you're presented a dilemma of how your own module will get polluted by typing - with either or both of:

  • typing's own objects spilled all over your module, while being irrelevant for an outer scope where your module is imported.
    • To add insult to injury, all the "standard" (i.e., non-underscored) names are by default imported into outer scope with wildcard import (from your_module import *), so your module pollutes them upstream... unless you manually add EVERYTHING your module defines by itself to its __all__.
  • importing only typing itself, but adding long prefixes of typing.SpecificType everywhere in your code.

Both clutter the code and IDE autocomplete - either in your own module or from outside.

Ideally, your module should import any typing-related objects with a private (dunder) or at least protected (_) name. But now you just move boilerplate code to the imports section, making it tedious to import each type-hinting class in each of your submodules with as:

from typing import Mapping as _Mapping, TypeVar as _TypeVar, ...

You could define your own service submodule which simply imports from typing with the right names, but then you won't be able to wildcard-import those names from it, unless you list every single name inside __all__... which is exactly what this package does:

  • The classes from typing are imported with underscore prefix;
  • many of the most used ones also have aliases where they are further shortened to just one letter (full names still available);
  • missing/updated classes are imported from typing_extensions - you get the most full set of typing classes in one place;
  • this module defines its __all__, so:
    • in your module, you can do from typing_clean import *,
    • but the imported objects come underscored, so for an outer module (where yours got imported from), they don't get wildcard-imported.

Short names

Here Built-in
_A Any
_C Callable
_G Generator
_I Iterable
_M Mapping
_NT NamedTuple
_O Optional
_U Union
_IV ItemsView
_KV KeysView
_VV ValuesView

TypeVars

The only thing the module defines by itself is a set of TypeVars:

  • both in typing and typing_extensions the defined ones aren't exported, so even though at runtime their import works just fine, some IDEs complain that they can't find them;
  • the built-in set often isn't enough, so I defined extra 3 numbered versions for each.
What Built-in equivalent +Second +Third +Fourth
Just any arbitrary type _T _T2 _T3 _T4
Key type for dicts _KT _KT2 _KT3 _KT4
Value type for dicts _VT _VT2 _VT3 _VT4
Type covariant:
TypeVar(..., covariant=True)
_T_co _T2_co _T3_co _T4_co
Ditto contravariant:
TypeVar(..., contravariant=True)
_T_contra _T2_contra _T3_contra _T4_contra
Parameter specifier _P _P2 _P3 _P4

Version

  • First two numbers: oldest Python version supported;
  • Last number: minor update within it.

The installed python and typing-extensions determine which version of typing-clean to install.

Metadata

Release files for typing-clean 3.6.99

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

Source distribution (sdist)

Source distribution for typing-clean 3.6.99
File Size Uploaded Provenance Actions
typing_clean-3.6.99.tar.gz 17.0 kB With provenance Details for typing_clean-3.6.99.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for typing-clean 3.6.99
File Interpreter ABI Platform Actions
typing_clean-3.6.99-py3-none-any.whl Python 3 none any Details for typing_clean-3.6.99-py3-none-any.whl

Total release size: 29.5 kB

Release files / typing_clean-3.6.99.tar.gz

Download URL typing_clean-3.6.99.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8bcd0d3016c2d8916dc1cfbea075fd3f7a1aa9389b1e6f46e840d26deeced346
BLAKE2b-256 checksum
How to use checksums
82a87146c65ad76e97c7f4bbfeb20285953ff9d89dc230812152444aba2e0bcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / typing_clean-3.6.99-py3-none-any.whl

Download URL typing_clean-3.6.99-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b618310d9976c85182363dd1811b714b0e6a2a85c204ba108b6a3a671b082ff9
BLAKE2b-256 checksum
How to use checksums
f9d368ee3ad4f87e30e298a6fac949a159d85f40e5c6b14b50bcd8684204eb29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for typing-clean 3.6.99

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for typing_clean-3.6.99.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

3.6.99 This release

2 release files Full provenance

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