Zero-dependency Brazilian document utils — CPF, CNPJ (alphanumeric-ready), CEP, phone, currency, dates. Mirrored TypeScript + Python APIs.
Project description
br-kit (Python)
Validação, formatação, parsing e geração de documentos brasileiros — zero dependências, pronto para o CNPJ alfanumérico (julho/2026).
Validation, formatting, parsing and generation of Brazilian documents — zero dependencies, ready for the alphanumeric CNPJ (July 2026).
API espelhada com o pacote npm br-kit
(TS camelCase ↔ Py snake_case), com comportamento travado por uma suíte de
vetores de conformidade compartilhada.
Instalação
pip install br-kit
Uso
from br_kit import cpf, cnpj, currency
cpf.is_valid("390.533.447-05") # True
cpf.format("39053344705") # "390.533.447-05"
cpf.validate_detailed("111.111.111-11") # ValidationResult(valid=False, reason="repeated-digits")
cnpj.is_valid("12.ABC.345/01DE-35") # True ← alfanumérico
cnpj.is_alphanumeric("12ABC34501DE35") # True
currency.format_brl(1234.56) # "R$ 1.234,56"
currency.parse_brl("R$ 1.234,56") # 1234.56
Import granular: from br_kit.cpf import is_valid.
API (v0.1)
| Módulo | Funções |
|---|---|
cpf |
is_valid · validate_detailed · format · strip · generate |
cnpj |
is_valid · is_alphanumeric · validate_detailed · format · strip · generate |
cep |
is_valid · format · strip |
phone |
is_valid · parse · format · strip |
currency |
format_brl · parse_brl |
dates |
parse_pt_br · format_pt_br |
Contrato (idêntico ao pacote npm, em snake_case):
is_valid(value)→bool, nunca levanta exceção.validate_detailed(value)→ValidationResult(valid, reason).reasoné estável:invalid-characters·invalid-length·repeated-digits·invalid-check-digit.format(value)/parse(value)levantamValueErrorem input inválido (em TypeScript:RangeError).strip(value)remove a máscara;generate()é só para testes/fixtures — nunca trate o resultado como documento real.
Totalmente tipado (py.typed incluído). Documentação do algoritmo do CNPJ
alfanumérico: docs/cnpj-alphanumeric.md.
✅ Pronto para o CNPJ alfanumérico (julho/2026)
A partir de julho de 2026 a Receita Federal emite CNPJs com letras (A–Z) nos 12
primeiros caracteres (IN RFB 2.229/2024). br-kit.cnpj valida ambos os formatos
de forma transparente — \d{14} quebra, br-kit não.
Licença MIT. Documentação completa e suíte de conformidade: https://github.com/victorhurchella/br-kit
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file br_kit-0.1.0.tar.gz.
File metadata
- Download URL: br_kit-0.1.0.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb9b40d83f1fbe6a25ed1d691c447c0ea6ec6ab7966e69a2c5053cd2d01f879b
|
|
| MD5 |
37fc6c06e3792601e58a1d15c9249c8b
|
|
| BLAKE2b-256 |
29c8ce57c3bd4c2965cbcf3cc54e7d44e5f1d6a6e3ffd82a89c57b1a017e0210
|
Provenance
The following attestation bundles were made for br_kit-0.1.0.tar.gz:
Publisher:
release.yml on victorhurchella/br-kit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
br_kit-0.1.0.tar.gz -
Subject digest:
cb9b40d83f1fbe6a25ed1d691c447c0ea6ec6ab7966e69a2c5053cd2d01f879b - Sigstore transparency entry: 1753368853
- Sigstore integration time:
-
Permalink:
victorhurchella/br-kit@50f18600127ede9821af875526cae0991e18aa3d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/victorhurchella
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@50f18600127ede9821af875526cae0991e18aa3d -
Trigger Event:
push
-
Statement type:
File details
Details for the file br_kit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: br_kit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d86611583772b49051e8c25c3d797d5a371afd2b3eea4f9f6c3d903360890dbd
|
|
| MD5 |
0f2d43f6b7f9ab6a9920e9e524eb88e3
|
|
| BLAKE2b-256 |
0044ca369dbaeb0953197dfc2fdae9f774304aac7cb6cb66f58f2807c40cd18b
|
Provenance
The following attestation bundles were made for br_kit-0.1.0-py3-none-any.whl:
Publisher:
release.yml on victorhurchella/br-kit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
br_kit-0.1.0-py3-none-any.whl -
Subject digest:
d86611583772b49051e8c25c3d797d5a371afd2b3eea4f9f6c3d903360890dbd - Sigstore transparency entry: 1753368876
- Sigstore integration time:
-
Permalink:
victorhurchella/br-kit@50f18600127ede9821af875526cae0991e18aa3d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/victorhurchella
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@50f18600127ede9821af875526cae0991e18aa3d -
Trigger Event:
push
-
Statement type: