Skip to main content

🔐 Advanced Password Validator

License: MIT Python Version PyPI - Coming Soon


A dynamic, rule-based password validation system for Python. Supports configurable validation rules and pre-set security modes to suit different application needs.

🚀 Features

  • ✅ Rule-based architecture — plug & play validation rules
  • 🔁 Preconfigured modes: lenient, moderate, strict
  • 🔒 Supports: min/max length, symbols, blacklist, common password checks, etc.
  • 📂 Compare passwords to a list of over 30000 already-registered passwords for added security
  • 🧪 Designed for unit testing & integration

📦 Installation

pip install advanced_password_validator
poetry add advanced_password_validator

🌎 Code Usage:

An overview of a common coding example utilizing the advanced_password_validator to validate a password using customizable rules

from advanced_password_validator import PasswordValidator, Mode

# Instantiate a validator object:
validator = PasswordValidator(
    min_length = 8,                     # Integer / Defaults to None
    max_length = 65,                    # Integer / Defaults to None
    require_uppercase = True,           # Boolean / Defaults to False
    require_numbers = True,             # Boolean / Defaults to False
    require_symbols = True,             # Boolean / Defaults to False
    no_spaces = True,                   # Boolean / Defaults to False
    must_include_char = None,           # String / Defaults to None
    no_repeating_chars = 5,             # Integer / Defaults to None
    blacklisted_pattern = False,        # Boolean / Defaults to False
    not_common = False,                 # Boolean / Defaults to False
    mode = None                         # Mode (Enum) / Defaults to None
)

# validate against password strings:
password_valid1 = validator.validate("ThisIsSuperValid123+")[0]
password_valid2 = validator.validate("nouppercase123+")[0]
password_valid3 = validator.validate("NoNumbers++")[0]

print(password_valid1)  # <= Returns True
print(password_valid2)  # <= Returns False
print(password_valid3)  # <= Returns False

0️⃣ Return Type

The validate method returns a tuple: (bool, list)

  • [0] = a boolean value determining if the password passed the validation
  • [1] = a list of errors based on what Rules the password didn't pass (the list will be empty if validation passes)

📜 Rules Overview:

A rudimentary overview of the rules that can enabled for custom validation

Rules Description
min_length Specifies the minimum length required for the password (Integer)
max_length Specifies the maximum length possible for the password (Integer)
require_uppercase Specifies if the password must include at least 1 uppercase letter (Boolean)
require_numbers Specifies if the password must include at least 1 digit (Boolean)
require_symbols Specifies if the password must include at least 1 special character (Boolean)
no_spaces Specifies if the password can include spaces (Boolean)
must_include_char Specifies one of more required characters in the password (String)
no_repeating_chars Specifies how many sequentially, repeating characters can be included in the password (Integer)
blacklisted_pattern Specifies whether to check the password against a list of blacklisted patterns (Boolean)
not_common Specifies whether to check the password against a list of commonly used passwords (Boolean)
mode Specifies whether to use one of the 3 preconfigured modes (Mode)

🤖 Preconfigured Modes:

The advanced password validator package supports 3 preconfigured validator modes:

  1. Lenient
  2. Moderate
  3. Strict Each of these individual modes come preconfigured with different values, and are meant to be utilised for quick out-of-the-box solutions.
from advanced_password_validator import PasswordValidator, Mode

validator = PasswordValidator(
    mode=Mode.lenient
)
# The mode param takes in a Mode-object (Enum) - Mode.lenient, Mode.moderate, Mode.strict

Lenient

  • min_length = 8
  • max_length = 65

Moderate

  • min_length = 8
  • max_length = 65
  • require_uppercase = True
  • require_numbers = True
  • no_spaces = True
  • no_repeating_chars = 4

Strict

  • min_length = 12
  • max_length = 65
  • require_uppercase = True
  • require_numbers = True
  • require_symbols = True
  • no_spaces = True
  • no_repeating_chars = 3
  • blacklisted_pattern = True
  • not_common = True

📄 License Details:

This project is licensed under the MIT License – see the LICENSE section for further details.

Metadata

Release files for advanced-password-validator 1.0.1

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

Source distribution (sdist)

Source distribution for advanced-password-validator 1.0.1
File Size Uploaded Provenance
advanced_password_validator-1.0.1.tar.gz 151.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for advanced-password-validator 1.0.1
File Interpreter ABI Platform
advanced_password_validator-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 299.9 kB

Release files / advanced_password_validator-1.0.1.tar.gz

Download URL advanced_password_validator-1.0.1.tar.gz
Size 151.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0dce9e21ff890dfb80f688474e0b2958615171a112d84b317385cf770a2aab4a
BLAKE2b-256 checksum
How to use checksums
9d49cb0d8dc710d2ea932c6158b42b005c0d4177712fe1b3f9580a281462dba9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / advanced_password_validator-1.0.1-py3-none-any.whl

Download URL advanced_password_validator-1.0.1-py3-none-any.whl
Size 148.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94a4a366ad2c7fd3b9185849081fa7cbfa1b672ba962132dae8cde295914eee4
BLAKE2b-256 checksum
How to use checksums
eacd00a4ae5c0ae49637b6a2d96fae0e8217fd4d43f8890c494288525e7e8d0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Security for advanced-password-validator 1.0.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

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