{"id":15009004,"url":"https://github.com/matheuscas/pycpfcnpj","last_synced_at":"2025-04-04T13:09:36.730Z","repository":{"id":10495086,"uuid":"12677403","full_name":"matheuscas/pycpfcnpj","owner":"matheuscas","description":"Python module for brazilian register numbers for persons (CPF) and companies (CNPJ).","archived":false,"fork":false,"pushed_at":"2024-07-05T23:31:39.000Z","size":150,"stargazers_count":143,"open_issues_count":10,"forks_count":44,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-28T12:05:45.506Z","etag":null,"topics":["cnpj","cpf","generation","python","python-2","python-3","python-library","validation"],"latest_commit_sha":null,"homepage":null,"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/matheuscas.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":"2013-09-08T07:03:58.000Z","updated_at":"2024-12-30T22:21:32.000Z","dependencies_parsed_at":"2024-06-18T17:24:47.030Z","dependency_job_id":"cd5df857-5815-4260-b6e5-10ad7aea60a5","html_url":"https://github.com/matheuscas/pycpfcnpj","commit_stats":{"total_commits":149,"total_committers":15,"mean_commits":9.933333333333334,"dds":0.3422818791946308,"last_synced_commit":"f4da0157589518b22507bc28d8c2af6ae050218a"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheuscas%2Fpycpfcnpj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheuscas%2Fpycpfcnpj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheuscas%2Fpycpfcnpj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheuscas%2Fpycpfcnpj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matheuscas","download_url":"https://codeload.github.com/matheuscas/pycpfcnpj/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247182334,"owners_count":20897379,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cnpj","cpf","generation","python","python-2","python-3","python-library","validation"],"created_at":"2024-09-24T19:22:19.814Z","updated_at":"2025-04-04T13:09:36.708Z","avatar_url":"https://github.com/matheuscas.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Pycpfcnpj\n=======\n\nDescription\n-----------\nPython module for brazilian register numbers for persons (CPF) and companies (CNPJ). If want this validation in your web application, please check [my tiny web component](https://github.com/matheuscas/wc-input-cpf-cnpj) that does exactly that. ;)\n\n![Testing](https://github.com/matheuscas/pycpfcnpj/actions/workflows/testing.yaml/badge.svg)\n[![codecov](https://codecov.io/gh/matheuscas/pycpfcnpj/branch/master/graph/badge.svg)](https://codecov.io/gh/matheuscas/pycpfcnpj)\n[![PyPI version](https://badge.fury.io/py/pycpfcnpj.svg)](https://badge.fury.io/py/pycpfcnpj)\n![Python versions](https://img.shields.io/pypi/pyversions/pycpfcnpj)\n\n#### Related projects\n- [Pycnpj-crawler](https://github.com/matheuscas/pycnpj-crawler): Python module that crawls data for a given CNPJ on the government website of each state (please check the supported states).\n\n\n### How to install\nNow you can install this module with pip! Yeah! :D\n\n```\npip install pycpfcnpj\n```\n\n### Quick Start\nTo use pycpfcnpj is simples like as every python module should be!\n\n```python\nfrom pycpfcnpj import cpfcnpj\ncpf_number = '11144477735'\nmasked_cpf_number = '111.444.777-35'\ncnpj_number = '11444777000161'\nmasked_cnpj_number = '11.444.777/0001-61'\n\nprint(cpfcnpj.validate(cpf_number))\nprint(cpfcnpj.validate(masked_cpf_number))\nprint(cpfcnpj.validate(cnpj_number))\nprint(cpfcnpj.validate(masked_cnpj_number))\n\nExpected output:\n\u003e\u003e\u003eTrue\n\u003e\u003e\u003eTrue\n\u003e\u003e\u003eTrue\n\u003e\u003e\u003eTrue\n```\nSimple like that. =)\n\nYou can use, as well, the cpf and cnpj packages. The cpfcnpj is like a Facade to the other modules. Make yourself confortable.\n\nOh, fork and contribute either if you want to.\n\nObs.: There is no dependencies.\n\nOh, and before I forget, you can generate, only and only for test purposes, a CPF or CNPJ number using the 'gen' module. Easy like above:\n\n```python\nfrom pycpfcnpj import gen\ngen.cpf()\ngen.cnpj()\n\nExpected output:\n\u003e\u003e\u003e 49384063495\n\u003e\u003e\u003e 20788274885880\n```\n\nAlso, you can generate CPF or CǸPJ with punctuation marks. :)\n\n```python\nfrom pycpfcnpj import gen\ngen.cpf_with_punctuation()\ngen.cnpj_with_punctuation()\n\nExpected output:\n\u003e\u003e\u003e 048.891.866-97\n\u003e\u003e\u003e 63.212.638/0361-35\n```\n\nHave fun!\n\nIn portuguese:\n--------------\n\nMódulo python para validar números de CPF e CNPJ.\n\n### Como instalar:\nAgora você pode instalar o pycpfcnpj usando o pip!\\m/\n\n```\npip install pycpfcnpj\n```\n\n#### Projetos relacionados\n- [Pycnpj-crawler](https://github.com/matheuscas/pycnpj-crawler)\n\n### Como usar\n```python\nfrom pycpfcnpj import cpfcnpj\ncpf_number = '11144477735'\nmasked_cpf_number = '111.444.777-35'\ncnpj_number = '11444777000161'\nmasked_cnpj_number = '11.444.777/0001-61'\n\nprint(cpfcnpj.validate(cpf_number))\nprint(cpfcnpj.validate(masked_cpf_number))\nprint(cpfcnpj.validate(cnpj_number))\nprint(cpfcnpj.validate(masked_cnpj_number))\n\nExpected output:\n\u003e\u003e\u003eTrue\n\u003e\u003e\u003eTrue\n\u003e\u003e\u003eTrue\n\u003e\u003e\u003eTrue\n```\n\nSimples assim! Você também pode usar os pacotes internos que tratam em separado os números de CPF e CNPJ. \nO módulo 'cpfcnpj' é um tipo de interface para os módulos mais específicos e se encarrega de saber quando você está passando um CPF ou um CNPJ.\n\nFique à vontade em contribuir com o projeto ou da maneira que quiser. Ah, sim: pure python (sem dependências ;) ).\n\nAh, e antes que eu me esqueça, você pode gerar, só e apenas somente para fins de teste, um número de CPF ou CNPJ utilizando o módulo 'gen'. Fácil como acima:\n\n```python\nfrom pycpfcnpj import gen\ngen.cpf()\ngen.cnpj()\n\nExpected output:\n\u003e\u003e\u003e 49384063495\n\u003e\u003e\u003e 20788274885880\n```\n\nE você também pode gerar CPF ou CNPJ com pontuação :)\n\n```python\nfrom pycpfcnpj import gen\ngen.cpf_with_punctuation()\ngen.cnpj_with_punctuation()\n\nExpected output:\n\u003e\u003e\u003e 048.891.866-97\n\u003e\u003e\u003e 63.212.638/0361-35\n```\n\n\nDivirta-se!\n\nChangelog\n-----------\n1.8\n- Dropped travis and python versions under 3.8\n\n1.7.2\n- Use poetry to handle dev/test dependencies, building and publishing\n\n1.7.1\n- Fix for cpf/cnpjs containing special characters.\n\n1.7.0\n- Invalidates cpf/cnpjs containing non-numeric characters and spaces.\n\n1.6.0\n- Remove python 2.7 support\n- Add python 3.8 support\n\n1.1\n- Handles CPF and CNPJ numbers with punctuation marks.\n\n1.2\n- Use `sys` rather than `six` to check python's version and keeps this project 100% free of dependencies.\n\n1.3\n- Generate CPF and CNPJ numbers with punctuation marks.\n\n1.4\n- Adding support to unicode values.\n\n1.5\n- Better CPF and CNPJ generation\n\n1.5.1\n- Use regex to remove punctuation\n\n\nLog de mudanças\n-----------\n1,8\n- Travis fora e versões do Python abaixo de 3.8 não são mais suportadas\n\n1.7.2\n- Use Poetry para lidar com dependências de desenvolvimento/teste, construção e publicação\n\n1.7.1\n- Correção para cpf/cnpjs que contém caracteres especials.\n\n1.7.0\n- Invalida cpf/cnpjs que contém caracteres não numéricos e espaços.\n\n1.6.0\n- Remove suporte para python 2.7\n- Adiciona suporte para python 3.8\n\n1.1\n- Trata números de CPF e CPNJ com sinais de pontuação\n\n1.2\n- Uso do `sys` em vez do `six` para verificar a versão do Python e evitando o uso de libs terceiras\n\n1.3\n- Gera números de CPF e CNPJ com pontuação.\n\n1.4\n- Suporte a unicode.\n\n1.5\n- Geração de CPF e CNPJ mais eficiente.\n\n1.5.1\n- Regex para remover a pontuação.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatheuscas%2Fpycpfcnpj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatheuscas%2Fpycpfcnpj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatheuscas%2Fpycpfcnpj/lists"}