Skip to main content

Backports Python Typing Stubs

Project description

unpy

Backports Python 3.13 typing stubs to earlier Python versions

unpy - PyPI unpy - Python Versions unpy - license

unpy - CI unpy - pre-commit unpy - basedpyright unpy - ruff


[!IMPORTANT] This project is in the early stages of development; You probably shouldn't use it in production.

Installation

The unpy package is available as on PyPI, and can be installed with e.g.

pip install unpy

Usage

Usage: unpy [OPTIONS] FILE_IN [FILE_OUT]

Arguments:
  FILE_IN     [required]
  [FILE_OUT]  [default: -]

Options:
  --install-completion [bash|zsh|fish|powershell|pwsh]
                                  Install completion for the specified shell.
  --show-completion [bash|zsh|fish|powershell|pwsh]
                                  Show completion for the specified shell, to
                                  copy it or customize the installation.
  --help

Features / Wishlist

  • Remove redundant Any and object type-parameter bounds
  • Replace Any type-parameter defaults with the upper-bound or object
  • Replace collections.abc and typing imports with typing_extensions backports.
  • Add additional typing[_extensions] imports for e.g. TypeVar and TypeAlias.
  • Backport PEP-695 type {} aliases to {}: TypeAlias (or use {} = TypeAliasType('{}', ...)) if the LHS and RHS order differs).
  • Backport PEP-695 classes and protocols to Generic and Protocol
  • Backport PEP-695 generic functions
  • Transform PEP-696 T = {} type param defaults to TypeVar("T", default={}).
  • Rename / de-duplicate typevar-like definitions
  • Infer variance of (all) Generic and Protocol type params (currently infer_variance=True is used if there's no {}_co or {}_contra suffix)
  • Transform *Ts to Unpack[Ts] (TypeVarTuple)
  • Transform **Tss to Tss (ParamSpec)
  • Reuse e.g. import typing or import typing as tp if present
  • Detect re-exported imports from typing or typing_extensions of other modules

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unpy-0.2.0.tar.gz (9.8 kB view hashes)

Uploaded Source

Built Distribution

unpy-0.2.0-py3-none-any.whl (10.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft Sir Raditya Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page