Registry / serialization / brazilnum

brazilnum

JSON →
library0.8.8pypypiunverified

brazilnum is a Python library (version 0.8.8) designed for validating and working with various Brazilian identification numbers. It provides functions to validate CNPJ, CEI, CPF, PIS/PASEP, CEP, and municipal codes, which are essential for identifying firms, people, and places in Brazil. While the latest release was in October 2016, it remains a functional tool for these specific validation tasks.

pip install brazilnum
INSTALL
IMPORT
SIG · BRAZILNUM
B
brazilnum
serializationpythonv0.8.8
Install
2.4s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.8.8 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.2MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.4s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

is_cnpj
from brazilnum import is_cnpj
from brazilnum.cnpj import is_cnpj

This quickstart demonstrates how to import and use the `is_cnpj`, `is_cpf`, and `is_cep` functions to validate common Brazilian identification numbers.

from brazilnum.cnpj import is_cnpj from brazilnum.cpf import is_cpf from brazilnum.cep import is_cep # Example CNPJ validation cnpj_number = '00.000.000/0001-91' print(f"Is '{cnpj_number}' a valid CNPJ? {is_cnpj(cnpj_number)}") # Example CPF validation cpf_number = '111.444.777-00' print(f"Is '{cpf_number}' a valid CPF? {is_cpf(cpf_number)}") # Example CEP validation cep_number = '01001-000' print(f"Is '{cep_number}' a valid CEP? {is_cep(cep_number)}")
Debug
Known issues
gotchaThe project is classified with a 'Development Status :: 4 - Beta' on PyPI. While functional, this indicates it might not be considered fully stable or actively developed for critical production environments.
fix
Be aware of its beta status and thoroughly test in your environment. Consider the lack of recent updates.
affects: 0.8.8 and earlier
gotchaSome true municipal (município) codes do not strictly follow the standard verification pattern. The library is designed to correctly handle these known exceptions, but it's important for users to be aware of this nuance rather than expecting all valid codes to conform to a simple mathematical rule.
fix
Rely on the library's `is_muni` function for accurate validation, understanding that internal logic accounts for exceptions.
affects: All versions
gotchaThe library was last updated in 2016 and explicitly states compatibility with Python 2.7 and 3. While PyPI also lists Python 3 support, users on very recent Python 3 versions (e.g., 3.10+) should perform compatibility testing, as issues might arise with newer language features or dependencies not present at the time of the last release.
fix
Test thoroughly with your target Python 3 version before deploying. Consider forking or contributing updates if compatibility issues are found.
affects: All versions on Python 3.9+
Upgrade
Version history
0.8.8latest on PyPI · released Oct 14, 2016
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
brazilnum — pip install brazilnum · libregistry