validators

A Python library for validating strings — emails, URLs, IPs, and more — without defining a schema.

Library
PyPI
v0.35.0
1,125 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
47 /100 Fair
Development Activity 4
Maintenance 20
Community 76
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
77 /100 Good
Architecture 72
Code Quality 80
Innovation 65
Learning Curve 90

Validators is a Python library built around a single idea: checking whether one value is valid shouldn’t require defining a form or a schema. Each validator is a small, focused function — validators.email('someone@example.com') returns True or a ValidationError object that is falsy but carries the failure reason, so failed checks can be used directly in conditionals or inspected for detail.

The library covers a wide surface of everyday validation needs: emails, URLs, domains, hostnames, IP addresses, MAC addresses, UUIDs, IBANs, credit card numbers, cron expressions, hashes, slugs, and country/finance codes, plus a growing set of internationalized checks (Spanish CIF/DOI/NIF, Finnish business IDs and SSNs, French department codes and SSNs, Indian Aadhar and PAN numbers, Russian INN). An optional extra adds cryptocurrency address validation for Bitcoin, Ethereum, BSC, and Tron.

Because every validator is a plain function rather than part of a schema object, the library slots into existing code without ceremony — call the function you need, check the boolean-like result, and move on. It has no runtime dependencies of its own (only an opt-in extra for crypto address hashing), keeping it lightweight for scripts, APIs, and form-processing code alike.

What You Get

  • Dozens of ready-made validators for common formats — email, URL, domain, hostname, IP/MAC address, UUID, IBAN, credit card numbers, cron expressions, hashes, and slugs
  • Internationalized validators for country-specific identifiers (Spanish CIF/NIF/NIE/DOI, Finnish business ID/SSN, French department/SSN, Indian Aadhar/PAN, Russian INN)
  • Optional cryptocurrency address validation (BTC, ETH, BSC, TRX) via the crypto-eth-addresses extra
  • A @validator decorator that turns any boolean-returning function into a validator with consistent ValidationError semantics
  • A ValidationError object that is falsy in boolean context but retains the offending arguments and failure reason for inspection
  • An opt-in RAISE_VALIDATION_ERROR mode (env var or r_ve kwarg) for callers who prefer exceptions over falsy return values

Common Use Cases

  • Form and API input checks - validating email addresses, URLs, or phone-adjacent fields submitted through a web form or JSON API without writing a full schema
  • Data cleaning pipelines - filtering or flagging malformed IBANs, card numbers, or IP addresses before they reach downstream processing
  • CLI and script argument validation - quick sanity checks on user-supplied strings (domains, UUIDs, slugs) in one-off scripts and tools
  • Localized identity verification - confirming country-specific identifiers such as Indian Aadhar/PAN or Spanish NIF numbers in region-specific applications
  • Custom validator composition - using the @validator decorator to wrap project-specific boolean checks with the same ValidationError contract the built-ins use

Under The Hood

Architecture The codebase is organized as one flat package (src/validators/) with one module per validation domain — email.py, url.py, domain.py, iban.py, card.py, ip_address.py, and so on — plus an i18n/ and crypto_addresses/ subpackage for the internationalized and crypto-specific checks. Every validator function is wrapped with the @validator decorator defined in utils.py, which is the one piece of shared machinery in the whole library: it catches ValueError/TypeError/UnicodeError, converts a falsy return into a ValidationError carrying the original call’s arguments, and optionally re-raises when RAISE_VALIDATION_ERROR is set. Because each validator is a standalone function with no shared state or class hierarchy, adding a new validator means adding a new module and re-exporting it from __init__.py — a design that scales linearly and keeps blast radius from any one change extremely small.

Tech Stack The library targets Python 3.9+ and declares zero runtime dependencies in pyproject.toml, with a single optional extra (crypto-eth-addresses, pulling in eth-hash[pycryptodome]) for cryptocurrency address checks. It builds via setuptools with a src/-layout package, and development tooling is managed through PDM dependency groups covering docs (mkdocs/sphinx), linting (ruff, pyright in strict mode), testing (pytest), and security scanning (bandit). Tox orchestrates lint/type/format/sast/test matrices across Python 3.9-3.13.

Code Quality Every validation module has a matching test file under tests/, exercised with pytest using heavily parametrized valid/invalid input tables (seen directly in tests/test_email.py). The suite also runs with --doctest-modules, so the Examples: blocks embedded in each function’s docstring double as executable tests. Type checking runs under pyright in strict mode, and ruff enforces both style and pydocstyle (Google convention) docstring rules, with bandit running as a separate SAST pass in CI (.github/workflows/pycqa.yaml, sast.yaml). Docstrings consistently document Args, Returns, and often Raises, which is unusually thorough for a library this size.

API Design The public surface is deliberately minimal and uniform: import a name from validators, call it with the value to check, and get back True or an object that evaluates falsy. There is no configuration object, registry, or class to instantiate — the @validator decorator is the only abstraction a user of the library needs to understand, and it’s optional (users can apply it to their own functions too). This buys very low ceremony for the common case at the cost of some flexibility that a schema-based validator (e.g. Pydantic) would offer for validating whole structured objects rather than one value at a time.

Used by 8 apps in this directory

Python
97%
MIT

auto-news

AI Assistants · Productivity

908

An AI-powered personal news aggregator that filters multi-source feeds through LLMs and delivers curated, noise-free summaries to your Notion workspace.

View details
43
Repo Health
53
Technical
66
Dependency
Built with
Python 97%
Updated 1 years ago
Python
68%
Other

Baserow

Databases · No Code Platforms

6,012

Open-source no-code platform to build databases, apps, automations, and AI agents — self-hosted or cloud, with full data ownership.

View details
89
Repo Health
84
Technical
68
Dependency
Built with
Python 68%
JavaScript 16%
Vue 11%
Updated 5 days ago
Python
79%
Apache 2.0

changedetection.io

Monitoring

34,605

Self-hosted website change detection with AI-powered smart alerts, browser automation, price tracking, and 85+ notification channels.

View details
91
Repo Health
80
Technical
68
Dependency
Built with
Python 79%
Updated 1 weeks ago
Python
64%
Other

Keep

Automation · Devops · Monitoring

12,359

The open-source AIOps and alert management platform that unifies 130+ monitoring tools into a single pane of glass with AI-powered correlation, deduplication, and workflow automation.

View details
89
Repo Health
79
Technical
66
Dependency
Built with
Python 64%
TypeScript 36%
Updated 1 weeks ago
Python
69%
MIT

Langflow

AI Agents · AI Development

155,319

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
65
Dependency
Built with
Python 69%
TypeScript 22%
Updated 4 days ago
Python
37%
Other

Open WebUI

AI Agents · AI Assistants

153,390

The extensible, privacy-first AI platform that runs Ollama, OpenAI, and any LLM backend behind a polished, feature-packed web interface.

View details
91
Repo Health
75
Technical
66
Dependency
Built with
Python 37%
Svelte 34%
JavaScript 21%
Updated 4 days ago
JavaScript
50%
AGPL 3.0

QRev

AI Agents · CRM

363

Open source AI-first sales platform that replaces Salesforce with autonomous agents handling prospecting, outreach, and lead management at scale.

View details
38
Repo Health
68
Technical
63
Dependency
Built with
JavaScript 50%
Python 28%
TypeScript 14%
Updated 7 months ago
Python
67%
Apache 2.0

SurfSense

AI Assistants · Search

16,270

The open-source, unlimited NotebookLM alternative with real-time collaboration, a desktop app, and no vendor lock-in.

View details
87
Repo Health
71
Technical
66
Dependency
Built with
Python 67%
TypeScript 30%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers