{"id":4304,"library":"types-passlib","title":"Type Stubs for Passlib","description":"types-passlib is a type stub package providing static type annotations for the 'passlib' library. It allows type checkers like Mypy and Pyright to analyze code that uses passlib. This package specifically targets passlib version 1.7.*. As of its latest release (1.7.7.20260211), the package is unmaintained, and any fixes or updates to the type stubs should be contributed directly to the `typeshed` project on GitHub. The upstream `passlib` library itself has maintenance concerns.","status":"maintenance","version":"1.7.7.20260211","language":"en","source_language":"en","source_url":"https://github.com/python/typeshed/tree/master/stubs/passlib","tags":["typing","type stubs","passlib","security","password hashing"],"install":[{"cmd":"pip install types-passlib","lang":"bash","label":"Install types-passlib"},{"cmd":"pip install passlib","lang":"bash","label":"Install upstream passlib"}],"dependencies":[{"reason":"Provides the runtime functionality that these type stubs annotate.","package":"passlib","optional":false}],"imports":[{"note":"This is an import from the runtime library 'passlib', not 'types-passlib' itself, as 'types-passlib' only provides type hints.","symbol":"CryptContext","correct":"from passlib.context import CryptContext"},{"note":"Commonly used hashing algorithms like bcrypt are imported directly from passlib.hash.","symbol":"hash","correct":"from passlib.hash import bcrypt"}],"quickstart":{"code":"from passlib.context import CryptContext\nimport os\n\npwd_context = CryptContext(schemes=[\"bcrypt\"], deprecated=\"auto\")\n\ndef hash_password(password: str) -> str:\n    return pwd_context.hash(password)\n\ndef verify_password(password: str, hashed_password: str) -> bool:\n    return pwd_context.verify(password, hashed_password)\n\n# Example usage\nplain_password = os.environ.get('TEST_PASSWORD', 'mysecretpassword')\nhashed = hash_password(plain_password)\nprint(f\"Hashed password: {hashed}\")\n\nis_valid = verify_password(plain_password, hashed)\nprint(f\"Password valid: {is_valid}\")\n\nis_invalid = verify_password('wrongpassword', hashed)\nprint(f\"Wrong password valid: {is_invalid}\")","lang":"python","description":"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."},"warnings":[{"fix":"Contribute type stub improvements directly to the `typeshed` repository (github.com/python/typeshed). Monitor `typeshed` for updates rather than expecting `types-passlib` PyPI releases.","message":"The `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.","severity":"deprecated","affected_versions":">=1.7.7.20260211"},{"fix":"Downgrade the `bcrypt` library to a version below 4.1.0 (e.g., `bcrypt==4.0.1`) when using `passlib==1.7.*`.","message":"The 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.","severity":"gotcha","affected_versions":"passlib==1.7.* with bcrypt>=4.1.0"},{"fix":"For 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+.","message":"The `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.","severity":"breaking","affected_versions":"passlib==1.7.* on Python>=3.13"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}