{"id":6481,"library":"types-backports","title":"Typing stubs for backports","description":"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.","status":"abandoned","version":"0.1.3","language":"en","source_language":"en","source_url":"https://github.com/python/typeshed/tree/main/stubs/backports","tags":["typing","stubs","backports","typeshed","mypy"],"install":[{"cmd":"pip install types-backports","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[],"quickstart":{"code":"import sys\n# This package provides type stubs for 'backports' packages that you might install.\n# For example, if you use a backported module like 'backports.ssl_match_hostname':\n# from backports.ssl_match_hostname import match_hostname\n\n# The types-backports package itself does not usually expose symbols for direct import.\n# Its purpose is to be installed alongside runtime 'backports' packages for type checking.\n# To demonstrate its effect, you'd typically run a type checker:\n\n# Example of how a type checker would use it (not runnable Python code):\n# # mypy your_project.py\n# # No issues reported if backports.ssl_match_hostname is used correctly with its stubs.","lang":"python","description":"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."},"warnings":[{"fix":"Avoid installing `types-backports` directly unless specifically required by a dependency. If you need stubs for a particular 'backports' library, search for `types-` followed by the specific library name (e.g., `types-backports.ssl-match-hostname`). If the runtime package is `py.typed`, no separate stub package is needed.","message":"The `types-backports` package is largely obsolete and no longer actively maintained for providing general backport stubs. Many specific backports now have their own dedicated stub packages (e.g., `types-backports.ssl-match-hostname`), or the runtime package itself is `py.typed`.","severity":"breaking","affected_versions":"<=0.1.3"},{"fix":"If you require stubs for `backports.ssl_match_hostname`, install `types-backports.ssl-match-hostname` instead of `types-backports`. Note that `types-backports.ssl-match-hostname` itself is also unmaintained as of March 2023.","message":"The functionality of providing stubs for `backports.ssl_match_hostname` was moved to `types-backports.ssl-match-hostname`. The general `types-backports` package no longer serves this purpose and was noted as obsolete for this specific module.","severity":"deprecated","affected_versions":"0.1.3"},{"fix":"Do not install `types-backports` (or any `types-*` package) for `backports.zoneinfo`. The `backports.zoneinfo` package itself contains the necessary type hints.","message":"`types-backports` never provided stubs for `backports.zoneinfo` because `backports.zoneinfo` is a `py.typed` package and provides its own type information.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}