Registry / type-stubs / types-certifi

types-certifi

JSON →
library2021.10.8.3pypypi✓ verified 26d ago

types-certifi is a PEP 561 type stub package providing external type annotations for the `certifi` library, which itself provides Mozilla's carefully curated collection of Root Certificates for validating SSL certificates in Python applications. It is used by static type-checking tools like Mypy and Pyright to analyze code that uses `certifi`. This specific package version (2021.10.8.3) is an older snapshot from the `typeshed` project.

pip install types-certifi
INSTALL
IMPORT
SIG · TYPES-CERTIFI
T
types-certifi
type-stubspythonv2021.10.8.3
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2021.10.8.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

certifi-stubs
import certifi_stubs
import certifi-stubs

This quickstart demonstrates typical usage of the `certifi` library, for which `types-certifi` provides type stubs. The `certifi.where()` function returns the path to the CA certificate bundle. When `types-certifi` is installed alongside `certifi`, a type checker can statically analyze the usage of `certifi`'s functions and ensure type correctness.

import certifi import requests from typing import Text # certifi.where() provides the path to the CA bundle. # requests automatically uses certifi for SSL verification. ca_bundle_path: Text = certifi.where() def make_secure_request(url: str) -> requests.Response: """Makes a secure HTTP GET request using certifi's CA bundle.""" # Requests typically finds certifi automatically, # but explicitly passing certifi.where() ensures its use and enables type checking. response: requests.Response = requests.get(url, verify=ca_bundle_path) response.raise_for_status() # Raise HTTPError for bad responses (4xx or 5xx) return response # Example usage: try: secure_response = make_secure_request("https://www.google.com") print(f"Successfully connected to {secure_response.url} (Status: {secure_response.status_code})") # Type checkers (e.g., Mypy) would use types-certifi to validate # the types of `certifi.where()` and related calls here. except requests.exceptions.RequestException as e: print(f"Request failed: {e}")
Debug
Known issues
breakingThe `types-certifi` package is obsolete for `certifi` versions 2022.5.18.1 and newer. Starting with `certifi==2022.5.18.1`, the `certifi` library itself includes inline type annotations. If you are using `certifi` 2022.5.18.1 or a newer version (e.g., `certifi==2026.2.25`), you MUST uninstall `types-certifi` to avoid type-checking conflicts and potential errors.
fix
Uninstall `types-certifi`: `pip uninstall types-certifi`. Ensure your `certifi` package is up-to-date: `pip install --upgrade certifi`.
affects: <=2021.10.8.3 (when used with certifi >= 2022.5.18.1)
gotchaType stub packages like `types-certifi` are solely for static type checking (e.g., with Mypy, Pyright, or IDEs) and should not be imported or used at runtime. Attempting to import symbols directly from `types_certifi` in your runtime code will result in an `ImportError`.
fix
Always import symbols from the original runtime library (`certifi`), not from `types_certifi`. `types-certifi` works implicitly with your type checker.
affects: All versions
gotchaMismatched versions between `types-certifi` and the `certifi` runtime package can lead to incorrect or incomplete type-checking results. While `types-certifi` typically tracks `certifi`'s API, older stub versions may not reflect changes in newer runtime versions. This is particularly relevant given the deprecation mentioned above.
fix
Ensure that if you *must* use `types-certifi` (i.e., with an older `certifi` without inline types), its version aligns with the `certifi` version it's stubbing. The safest approach for modern projects is to update `certifi` and remove `types-certifi`.
affects: All versions
breakingThe `certifi` package (the runtime library) is not installed. This will lead to an `ImportError` at runtime when attempting to import `certifi`.
fix
Install `certifi`: `pip install certifi`.
affects: All versions
breakingThe `certifi` module was not found. This indicates that the `certifi` package itself is not installed in the environment. `certifi` is a fundamental runtime dependency for many Python applications needing TLS/SSL certificate verification.
fix
Install `certifi`: `pip install certifi`. Make sure `certifi` is listed in your project's dependencies (e.g., `requirements.txt`).
affects: All versions
Upgrade
Version history
2021.10.8.3latest on PyPI · released Jun 9, 2022
Audit
Dependencies
certifirequiredProvides type stubs for the runtime 'certifi' library.
Agent activity
30 hits · last 30 days
node
26
OpenAI (training)
1
Resources
types-certifi — pip install types-certifi · libregistry