Typing stubs for backports

0.1.3 · abandoned · verified Wed Apr 15

The `types-backports` library provides automatically generated PEP 561 type stub packages for various 'backports' libraries. These stubs enable static type checkers like mypy, PyCharm, and pytype to validate code that utilizes features backported to older Python versions. The package is generated from the Python typeshed repository. The primary package itself is largely a meta-package, with more specific stubs often residing in `types-backports.*` packages. The current version is 0.1.3, released in June 2021, and its active development for general backports has largely ceased.

Warnings

Install

Quickstart

The `types-backports` package provides type information for runtime 'backports' libraries. It does not typically expose symbols for direct import itself. To leverage it, simply install it alongside the 'backports' library you are using, and your type checker (e.g., mypy) will automatically pick up the provided type stubs for improved code analysis.

import sys
# This package provides type stubs for 'backports' packages that you might install.
# For example, if you use a backported module like 'backports.ssl_match_hostname':
# from backports.ssl_match_hostname import match_hostname

# The types-backports package itself does not usually expose symbols for direct import.
# Its purpose is to be installed alongside runtime 'backports' packages for type checking.
# To demonstrate its effect, you'd typically run a type checker:

# Example of how a type checker would use it (not runnable Python code):
# # mypy your_project.py
# # No issues reported if backports.ssl_match_hostname is used correctly with its stubs.

view raw JSON →