Skip to main content

pwdlib

All Contributors

Modern password hashing for Python

build codecov PyPI version Downloads


Documentation: https://frankie567.github.io/pwdlib/

Source Code: https://github.com/frankie567/pwdlib


Quickstart

pip install 'pwdlib[argon2]'
from pwdlib import PasswordHash

password_hash = PasswordHash.recommended()
hash = password_hash.hash("herminetincture")
password_hash.verify("herminetincture", hash)  # True

Why pwdlib?

For years, the de-facto standard to hash passwords was passlib. Unfortunately, it has not been very active recently and its maintenance status is under question. Starting Python 3.13, passlib won't work anymore.

That's why I decided to start pwdlib, a password hash helper for the modern Python era. However, it's not designed to be a complete replacement for passlib, which supports numerous hashing algorithms and features.

✅ Goals

  • Provide an easy-to-use wrapper to hash and verify passwords
  • Support modern and secure algorithms like Argon2 or Bcrypt

❌ Non-goals

  • Support legacy hashing algorithms like MD5
  • Implement algorithms directly — we should only rely on existing and battle-tested implementations

Development

Setup environment

Install uv and just. Use Python 3.11 or newer for Zensical and pre-commit.

Install the development dependencies and pre-commit hooks with just install.

Run unit tests

just test

Format the code

Run Ruff to format and lint the code, then check types with ty.

just lint

Use just lint-check to run the same checks without editing files.

Publishing a release

  1. Commit the release notes under Unreleased in CHANGELOG.md. From a clean release branch with Git signing configured, run just version patch, just version minor, or just version major. The recipe updates the version, changelog, and lockfile, then opens your Git editor for the signed commit.
  2. Preview the release notes with just release-notes <version>, then push the branch and merge the release PR into main.
  3. With the GitHub CLI authenticated, run just release <PR number>. This signs and pushes a tag pointing to the merged PR commit. After the checks pass, CI publishes the distributions to PyPI with attestations and publishes the GitHub release with build provenance.

The PyPI Trusted Publisher must match the build.yml workflow and the GitHub release environment.

Serve the documentation

The documentation uses Zensical. Start the local preview with the following command.

just docs-serve

Open http://localhost:8000. The preview reloads when documentation changes. Edit pages in docs/ and configure the site in zensical.toml.

Build the static site into site/ with the following command.

just docs-build

License

This project is licensed under the terms of the MIT license.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Hynek Schlawack
Hynek Schlawack

💻
Waket Zheng
Waket Zheng

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Metadata

Release files for pwdlib 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pwdlib 0.4.0
File Size Uploaded Provenance Actions
pwdlib-0.4.0.tar.gz 226.8 kB With provenance Details for pwdlib-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pwdlib 0.4.0
File Interpreter ABI Platform Actions
pwdlib-0.4.0-py3-none-any.whl Python 3 none any Details for pwdlib-0.4.0-py3-none-any.whl

Total release size: 236.3 kB

Release files / pwdlib-0.4.0.tar.gz

Download URL pwdlib-0.4.0.tar.gz
Size 226.8 kB
Tags Source
SHA-256 checksum
How to use checksums
123fd269d0980416f3a2a7b0c3a183f3b2f8580bb44bdadadde93e4bf7582f9d
BLAKE2b-256 checksum
How to use checksums
f39f63dc5850fe793c0c13637792dd2494ff5ae6f7b95e334fd2b89a2d5803c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / pwdlib-0.4.0-py3-none-any.whl

Download URL pwdlib-0.4.0-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef34f40b43efd610fce615391027f08bdb1403fcccda9897978f69275b61b2ee
BLAKE2b-256 checksum
How to use checksums
dc6c63119c0eba65efbe799e291a2cc9532ecaf7abc03d3f20e888df3fddff79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for pwdlib 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pwdlib-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page