clabe
Validate and generate the control digit of a CLABE in Mexico
What it is and what it does
clabe is a Python library for working with CLABE numbers, Mexico's standardized bank account identifiers used in the SPEI payment system. It provides validation, control digit computation, bank name lookup from the bank code, and generation of new valid CLABE numbers. The package integrates directly with pydantic as a custom type, allowing you to use CLABE as a validated field in pydantic models with automatic error reporting for invalid bank codes or malformed numbers.
The library maintains an internal registry of Mexican bank codes and names, with tooling to detect and track changes against the official Banxico participant list. As of version 2.0.0, the package requires pydantic v2 and drops support for earlier versions. You can add or remove banks programmatically, though the maintainers recommend keeping the official bank list synchronized via pull requests rather than runtime modifications.
Use it for:
- Validate CLABE account numbers in financial transaction forms or APIs before processing payments.
- Use CLABE as a pydantic field type to automatically validate bank account input in data models.
- Look up the bank name from a bank code for display or reconciliation purposes.
- Generate test CLABE numbers for unit tests or sandbox environments.
- Compute the correct control digit for a partial CLABE to verify or reconstruct account identifiers.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Validates and generates CLABE numbers, Mexico's standard bank account identifier, with built-in bank code lookup and Pydantic integration.
Yes. The package is actively maintained, has no security vulnerabilities, installs with minimal friction (one lightweight dependency), and directly solves a specific problem for anyone working with Mexican banking data. The pydantic integration is particularly valuable if you're already using pydantic for data validation.
Install
clabe on PyPI
pip
pip install clabeuv
uv add clabepoetry
poetry add clabeInstalling clabe
Before you install
Low friction: pure Python wheel with only pydantic as a runtime dependency. Actively maintained with a commit as recent as 2026-08-05 and no known vulnerabilities.
License in practice
MIT license (permissive) means you can use, modify, and distribute this package freely in commercial or private projects with minimal restrictions.
Quickstart
pip install clabe
from clabe import Clabe
from pydantic import BaseModel
class Account(BaseModel):
clabe: Clabe
account = Account(clabe='723010123456789019')
print(account.clabe)
Requires Python 3.8 or higher.
Verify before relying
- Whether the bank registry is kept in sync with official Banxico SPEI participant list in practice.
- Performance characteristics when validating large batches of CLABE numbers.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pydantic |
| Maintenance | actively maintained — 9 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 138,258/month — #11,334 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: clabe-2.1.11-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
python-stdnumParses, validates, and reformats standard…
copyleft · top 5,000 on PyPI
validate-docbrValidates and generates Brazilian identity and…
permissive · top 15,000 on PyPI
python-bcbStructured Python interface to fetch Brazilian…
unclear · top 15,000 on PyPI
pyjokesProvides one-liner programmer jokes accessible…
permissive · top 15,000 on PyPI
fintsA pure-Python implementation of the FinTS 3.0…
copyleft · top 15,000 on PyPI
bump-pydanticA CLI tool that automatically refactors…
permissive · top 15,000 on PyPI
gcld3Identifies the language of input text using a…
unclear · top 15,000 on PyPI
country-converterConverts and matches country names across…
copyleft · top 5,000 on PyPI
workadaysCalculates working days, calendar days, and…
permissive · top 15,000 on PyPI
luhnGenerates and verifies Luhn check digits for…
permissive · top 15,000 on PyPI