{"id":18679965,"url":"https://github.com/effeix/pybr","last_synced_at":"2026-01-30T16:52:22.479Z","repository":{"id":230282096,"uuid":"778987619","full_name":"effeix/pybr","owner":"effeix","description":"Collection of utilities for handling Brazilian data, documents and formats","archived":false,"fork":false,"pushed_at":"2025-11-27T15:27:27.000Z","size":57,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-29T18:47:05.331Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pybr/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/effeix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-28T20:09:07.000Z","updated_at":"2025-11-27T15:27:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"b84e72bd-bfb3-4b91-82ae-2786b73d3e40","html_url":"https://github.com/effeix/pybr","commit_stats":null,"previous_names":["effeix/pybr"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/effeix/pybr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effeix%2Fpybr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effeix%2Fpybr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effeix%2Fpybr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effeix%2Fpybr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/effeix","download_url":"https://codeload.github.com/effeix/pybr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effeix%2Fpybr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28915938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T16:37:38.804Z","status":"ssl_error","status_checked_at":"2026-01-30T16:37:37.878Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T09:47:24.191Z","updated_at":"2026-01-30T16:52:22.465Z","avatar_url":"https://github.com/effeix.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pybr\n\nCollection of utilities for handling Brazilian data, documents and formats.\n\n## Overview\n\n`pybr` is a collection of utilities designed to handle common Brazilian data formats and standards. It provides a clean, simple, and reliable interface for validating, formatting, and cleaning various types of data specific to Brazil.\n\nThis library is aimed at developers who need to work with Brazilian data and want to ensure correctness and proper formatting according to local standards. While it currently includes robust support for document numbers, the long-term goal is to cover a wider range of data types, such as dates, currency, and more.\n\n## Features\n\n- **Brazilian Documents**: Tools for validating, formatting, and cleaning taxpayer registry numbers.\n  - **CPF**: Support for individual taxpayer numbers.\n  - **CNPJ**: Support for company taxpayer numbers, including 2026 alphanumeric format.\n- **Extensible**: Designed with a base structure to easily support other Brazilian data types in the future (e.g., dates, phone numbers).\n- **Type-hinted**: Fully type-hinted for better editor support and code quality.\n- **No Dependencies**: Lightweight and dependency-free.\n\n## Installation\n\nYou can install `pybr` from PyPI:\n\n```bash\npip install pybr\n```\n\n## Usage\n\nHere are a few examples of how you can use `pybr`.\n\n### Example: CPF\n\nThe `CPF` class provides methods to handle CPF numbers.\n\n```python\nfrom pybr import CPF\n\n# --- Validation ---\n# Note: Replace with a valid CPF for actual testing\ncpf_valid = \"123.456.789-00\" \ncpf_invalid = \"111.111.111-11\"\n\nprint(f\"Is {cpf_valid} valid? {CPF.is_valid(cpf_valid)}\")\n# Is 123.456.789-00 valid? True\n\nprint(f\"Is {cpf_invalid} valid? {CPF.is_valid(cpf_invalid)}\")\n# Is 111.111.111-11 valid? False\n\n# By default, repeated digit sequences are invalid. You can allow them:\nprint(f\"Is {cpf_invalid} valid (allowing repeated)? {CPF.is_valid(cpf_invalid, allow_repeated=True)}\")\n# Is 111.111.111-11 valid (allowing repeated)? True (but checksum is still checked)\n\n\n# --- Formatting ---\nunformatted_cpf = \"12345678900\"\nformatted_cpf = CPF.format(unformatted_cpf)\nprint(f\"Formatted CPF: {formatted_cpf}\")\n# Formatted CPF: 123.456.789-00\n\n\n# --- Cleaning ---\ndirty_cpf = \"123.456.789///00\"\nclean_cpf = CPF.clean(dirty_cpf)\nprint(f\"Cleaned CPF: {clean_cpf}\")\n# Cleaned CPF: 12345678900\n\n\n# --- Enforcement ---\n# The `validate` method raises a ValueError for invalid CPFs.\ntry:\n    CPF.validate(cpf_invalid)\nexcept ValueError as e:\n    print(e)\n    # \"Invalid CPF\"\n```\n\n### Example: CNPJ\n\nThe `CNPJ` class provides methods to handle CNPJ numbers.\n\n```python\nfrom pybr import CNPJ\n\n# --- Validation ---\n# Note: Replace with a valid CNPJ for actual testing\ncnpj_valid = \"06.990.590/0001-23\" \ncnpj_invalid = \"11.111.111/1111-11\"\n\nprint(f\"Is {cnpj_valid} valid? {CNPJ.is_valid(cnpj_valid)}\")\n# Is 00.000.000/0001-91 valid? True\n\nprint(f\"Is {cnpj_invalid} valid? {CNPJ.is_valid(cnpj_invalid)}\")\n# Is 11.111.111/1111-11 valid? False\n\n\n# --- Formatting ---\nunformatted_cnpj = \"06990590000123\"\nformatted_cnpj = CNPJ.format(unformatted_cnpj)\nprint(f\"Formatted CNPJ: {formatted_cnpj}\")\n# Formatted CNPJ: 06.990.590/0001-23\n\n\n# --- Cleaning ---\ndirty_cnpj = \"06.990.590/0001-23\"\nclean_cnpj = CNPJ.clean(dirty_cnpj)\nprint(f\"Cleaned CNPJ: {clean_cnpj}\")\n# Cleaned CNPJ: 06990590000123\n\n\n# --- Enforcement ---\n# The `validate` method raises a ValueError for invalid CNPJs.\ntry:\n    CNPJ.validate(cnpj_invalid)\nexcept ValueError as e:\n    print(e)\n    # \"Invalid CNPJ\"\n```\n\n## Contributing\n\nContributions are welcome! If you have a feature request, bug report, or want to add support for another Brazilian data type (like dates, phone numbers, etc.), please feel free to:\n\n1. Fork the repository.\n2. Create a new branch (`git checkout -b feature/my-new-feature`).\n3. Make your changes and add tests.\n4. Ensure the test suite passes (`pytest`).\n5. Open a pull request.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](https://github.com/effeix/pybr/blob/main/LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feffeix%2Fpybr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feffeix%2Fpybr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feffeix%2Fpybr/lists"}