{"id":8747,"library":"types-zxcvbn","title":"zxcvbn Type Stubs","description":"types-zxcvbn is a PEP 561 type stub package providing static type annotations for the zxcvbn library, a realistic password strength estimator. It is part of the typeshed project and is designed to be used by type checkers like MyPy or Pyright. This package aims to provide accurate annotations for zxcvbn==4.5.* and is updated regularly as part of typeshed's release cycle, often daily.","status":"active","version":"4.5.0.20260408","language":"python","source_language":"en","source_url":"https://github.com/python/typeshed","tags":["typing","stubs","zxcvbn","security","password strength","typeshed"],"install":[{"cmd":"pip install types-zxcvbn zxcvbn","lang":"bash","label":"Install with runtime dependency"},{"cmd":"pip install types-zxcvbn","lang":"bash","label":"Install stubs only (requires zxcvbn separately)"}],"dependencies":[{"reason":"This package provides type stubs for the 'zxcvbn' runtime library. The 'zxcvbn' library itself must be installed to use the functionality at runtime.","package":"zxcvbn","optional":false}],"imports":[{"note":"The primary callable is named `zxcvbn` within the `zxcvbn` module itself. Older forks or versions might use `password_strength`.","wrong":"import zxcvbn; zxcvbn.password_strength('test')","symbol":"zxcvbn","correct":"from zxcvbn import zxcvbn"}],"quickstart":{"code":"from zxcvbn import zxcvbn\n\npassword = 'correct horse battery staple'\nuser_inputs = ['correct', 'horse', 'battery', 'staple']\n\n# Evaluate password strength\nresults = zxcvbn(password, user_inputs=user_inputs)\n\nprint(f\"Password: {results['password']}\")\nprint(f\"Score: {results['score']}/4 (0=terrible, 4=great)\")\nprint(f\"Feedback: {results['feedback']['suggestions']}\")\nprint(f\"Estimated crack time: {results['crack_times_display']['online_no_throttling_10_per_second']}\")\n","lang":"python","description":"This quickstart demonstrates how to import the `zxcvbn` function and use it to evaluate a password's strength, providing user inputs to penalize common personal information. The results dictionary contains detailed information, including a score, crack time estimates, and feedback."},"warnings":[{"fix":"Always ensure both `zxcvbn` and `types-zxcvbn` are installed: `pip install zxcvbn types-zxcvbn`.","message":"Installing `types-zxcvbn` alone only provides type hints for static analysis; it does NOT install the actual runtime `zxcvbn` library. You must install `zxcvbn` separately (e.g., `pip install zxcvbn`) for your code to run successfully.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Align the major and minor versions of `types-zxcvbn` with your `zxcvbn` installation. For example, if you use `zxcvbn>=4.5.0,<4.6`, use `types-zxcvbn>=4.5.0,<4.6`.","message":"Type checking failures may occur if the version of `types-zxcvbn` does not accurately match the version of the `zxcvbn` runtime library you are using. `types-zxcvbn` aims to provide annotations for `zxcvbn==4.5.*`.","severity":"breaking","affected_versions":"All versions"},{"fix":"Always install the `zxcvbn` package from PyPI (`pip install zxcvbn`) to ensure you are using the maintained version compatible with these type stubs. Avoid installing directly from old GitHub repositories unless you understand the implications.","message":"There are multiple Python implementations/forks of `zxcvbn`, some of which are deprecated or unmaintained (e.g., `dropbox/python-zxcvbn`). The currently recommended and most up-to-date Python port is `dwolfhub/zxcvbn-python` (which corresponds to the `zxcvbn` package on PyPI).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Avoid setting `max_length` greater than 72. Consider truncating input passwords before passing them to `zxcvbn` if extremely long passwords are not expected or if performance is critical. Check the `zxcvbn` library's documentation for the latest recommendations.","message":"Using the `max_length` parameter in the `zxcvbn` runtime library with values greater than 72 can lead to significantly longer processing times. This can potentially expose server-side applications to denial-of-service (DoS) scenarios.","severity":"gotcha","affected_versions":"zxcvbn 4.5.0 and earlier (runtime library)"}],"env_vars":null,"search_vec":"'4.5':56 '561':10 'accur':52 'aim':49 'annot':17,53 'checker':42 'cycl':67 'daili':69 'design':36 'estim':26 'librari':21 'like':43 'mypi':44 'often':68 'packag':13,48 'part':29,62 'password':24,74 'pep':9 'project':33 'provid':14,51 'pyright':46 'realist':23 'regular':60 'releas':66 'secur':73 'static':15 'strength':25,75 'stub':3,12,71 'type':2,5,11,16,41,70 'types-zxcvbn':4 'typesh':32,64,76 'updat':59 'use':39 'zxcvbn':1,6,20,55,72","created_at":"2026-04-16T17:03:47.693034+00:00","updated_at":"2026-04-16T17:03:47.693034+00:00","problems":{"verify_error":"error: Failed to parse: `types-zxcvbn zxcvbn`\n  Caused by: Expected one of `@`, `(`, `<`, `=`, `>`, `~`, `!`, `;`, found `z`\ntypes-zxcvbn zxcvbn\n             ^"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"4.5.0.20260518","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/typeshed-internal/stub_uploader","docs":null,"changelog":"https://github.com/typeshed-internal/stub_uploader/blob/main/data/changelogs/zxcvbn.md","pypi":"https://pypi.org/project/types-zxcvbn/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["type-stubs","auth-security"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"install_fail","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-05","install_tag":null}}