Install & Compatibility
Where this runs
tested against v1.7.7.20260211 · 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
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 69.6MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
68MB installed
● package 68MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
CryptContext
✓ from passlib_stubs.context import CryptContext
✗ from passlib_stubs.context import CryptContext
This quickstart demonstrates the core functionality of the `passlib` library for which `types-passlib` provides type hints: hashing and verifying a password using `CryptContext` with the bcrypt scheme.
from passlib.context import CryptContext
import os
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
def hash_password(password: str) -> str:
return pwd_context.hash(password)
def verify_password(password: str, hashed_password: str) -> bool:
return pwd_context.verify(password, hashed_password)
# Example usage
plain_password = os.environ.get('TEST_PASSWORD', 'mysecretpassword')
hashed = hash_password(plain_password)
print(f"Hashed password: {hashed}")
is_valid = verify_password(plain_password, hashed)
print(f"Password valid: {is_valid}")
is_invalid = verify_password('wrongpassword', hashed)
print(f"Wrong password valid: {is_invalid}")
Debug
Known issues
deprecatedThe `types-passlib` package is officially unmaintained and will not receive further updates on PyPI. All contributions and fixes for `passlib` type stubs should be directed to the `typeshed` project on GitHub.fixContribute type stub improvements directly to the `typeshed` repository (github.com/python/typeshed). Monitor `typeshed` for updates rather than expecting `types-passlib` PyPI releases.
affects: >=1.7.7.20260211
gotchaThe upstream `passlib` library has known compatibility issues with `bcrypt` versions >= 4.1.0, leading to `AttributeError` during password hashing. This is due to `passlib` internally expecting an attribute that was removed in newer `bcrypt` versions.fixDowngrade the `bcrypt` library to a version below 4.1.0 (e.g., `bcrypt==4.0.1`) when using `passlib==1.7.*`.
affects: passlib==1.7.* with bcrypt>=4.1.0
breakingThe `passlib` library itself, for which these stubs are provided, is largely unmaintained (last release 1.7.4 in 2020) and has potential breakage in Python 3.13 due to the removal of the `crypt` module. While `passlib` has a fallback, its long-term compatibility and security posture are uncertain.fixFor new projects or security-critical applications, consider actively maintained password hashing libraries or forks like `pwdlib` or `libpass` that address the maintenance concerns of upstream `passlib`. If continuing to use `passlib`, thoroughly test on Python 3.13+.
affects: passlib==1.7.* on Python>=3.13
Upgrade
Version history
1.7.7.20260211latest on PyPI · released Feb 10, 2026
Audit
Dependencies
passlibrequiredProvides the runtime functionality that these type stubs annotate.