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
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.2MB
glibcpy 3.10–3.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.fixBe 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.fixRely 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.fixTest 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.