--- id: validate-docbr version: "2.0.0" license: MIT license_treatment: permissive maintenance: active --- # validate-docbr — Validate brazilian documents. License: permissive · Maintenance: active · Downloads: 255.7K/mo ## What it is and what it does validate-docbr is a Python package for validating and generating Brazilian official documents. It provides a unified interface for eight document types: CPF (individual taxpayer ID), CNPJ (business registration), CNH (driver's license), CNS (health card), PIS (social security), electoral registration, RENAVAM (vehicle registration), and civil registry certificates. Each document type is implemented as a class with consistent methods for validation, batch validation, generation, and formatting. The package is designed for use in Brazilian applications that need to verify user-supplied document numbers or generate test data. It has no external dependencies, making it lightweight to integrate. All document classes follow the same API: validate() checks a single document, validate_list() processes multiple documents, generate() creates new valid documents optionally with formatting masks, and mask() applies standard Brazilian formatting to a document string. Use it for: - Validate user-submitted CPF or CNPJ during account registration or payment processing. - Generate realistic test data for Brazilian-focused applications during development and QA. - Batch-validate document lists imported from external sources or databases. - Format document numbers with standard Brazilian punctuation for display in user interfaces. - Verify multiple different document types in a single operation using the package-level validate_docs function. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Validates and generates Brazilian identity and registration documents including CPF, CNPJ, CNH, CNS, PIS, electoral registration, RENAVAM, and birth/marriage/death certificates. Yes. The package is actively maintained, has no dependencies, supports current Python versions, carries a permissive MIT license, and fills a clear need for Brazilian document validation in Portuguese-language applications. No known vulnerabilities. Install if you work with Brazilian identity or registration documents. ## Install pip install validate-docbr uv add validate-docbr poetry add validate-docbr ## Installing validate-docbr Before you install: Low install friction with no runtime dependencies. Actively maintained with recent releases and a stable repository; supports current Python versions. License in practice: MIT license permits unrestricted use, modification, and distribution with minimal restrictions, making it suitable for commercial and open-source projects. Quickstart: pip install validate-docbr from validate_docbr import CPF cpf = CPF() print(cpf.validate("012.345.678-90")) # True print(cpf.generate(mask=True)) Requires Python 3.10 or later. Verify before relying: - Whether all document types support all four methods (validate, validate_list, generate, mask) equally. - Performance characteristics when validating large lists of documents. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 255.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags brazilian document validation, cpf cnpj validator, validate brazilian id, brazilian document generator, brazilian registry documents, document mask formatter, brazilian identity verification, brazilian-documents, validation, data-generation [View on SkillFed](https://skillfed.io/packages/validate-docbr) · [View on PyPI](https://pypi.org/project/validate-docbr/)