Skip to main content

A package to check username safety.

Project description

Username Safety

A Python package to check username safety and validity.

Features

  • Length Check: Ensures username is within min/max length.
  • Character Check: Ensures username contains only allowed characters (alphanumeric, underscore, hyphen).
  • Profanity Check: Checks against a list of profane words.
  • Similarity Check: Checks if the username is too similar to the user's real name.

Installation

pip install username-safety

Usage

from username_safety import UsernameChecker

checker = UsernameChecker()

# Basic validation
is_valid, messages = checker.validate("cool_user_123")
if is_valid:
    print("Username is valid!")
else:
    print("Errors:", messages)

# Check with real name similarity
is_valid, messages = checker.validate("johndoe", real_name="John Doe")
# Returns False, ["Username is too similar to real name (similarity: 1.00)"]

Development

To run tests:

python -m unittest discover tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

username_safety-0.1.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

username_safety-0.1.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file username_safety-0.1.1.tar.gz.

File metadata

  • Download URL: username_safety-0.1.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for username_safety-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d4bafbd97f52e6fdaaa0af99dbd5fc7fa9e8dc3837f224d8150517acc936b326
MD5 16aa3caddbb91dd8c481a157f9dd4e7c
BLAKE2b-256 cc812ec4d241bfa06d1c6701ef0d29d053395e970a21cef703a33e088ea4bc47

See more details on using hashes here.

File details

Details for the file username_safety-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for username_safety-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d1317ebb35773989b63b6c7a0a20245707ccf1781395e3d48d03a3fc120f0ba6
MD5 b8c7b1050d594ff9a0716f5c75b8e7c3
BLAKE2b-256 aad91ef9755fef63492cac178ea93e66d5dfa3184a5072b1879f9faf989c431e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page