{"id":16959653,"url":"https://github.com/fabiocaccamo/python-codicefiscale","last_synced_at":"2026-01-18T00:32:31.690Z","repository":{"id":25687764,"uuid":"106271104","full_name":"fabiocaccamo/python-codicefiscale","owner":"fabiocaccamo","description":":it: :credit_card: italian fiscal codes encoding, decoding and validation - codifica, decodifica e validazione del Codice Fiscale italiano.","archived":false,"fork":false,"pushed_at":"2025-04-07T17:03:25.000Z","size":4306,"stargazers_count":78,"open_issues_count":11,"forks_count":25,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-12T14:57:33.939Z","etag":null,"topics":["anagrafe","anpr","cf","code","codice","codicefiscale","codifica","decodifica","fiscal","fiscale","interno","istat","italia","italian","italiano","italy","omocodia","python"],"latest_commit_sha":null,"homepage":"","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/fabiocaccamo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["fabiocaccamo"],"polar":"fabiocaccamo","ko_fi":"fabiocaccamo","liberapay":"fabiocaccamo","tidelift":"pypi/python-codicefiscale","custom":["https://www.buymeacoffee.com/fabiocaccamo","https://www.paypal.me/fabiocaccamo"]}},"created_at":"2017-10-09T10:45:13.000Z","updated_at":"2025-04-04T08:43:47.000Z","dependencies_parsed_at":"2023-10-01T02:46:22.971Z","dependency_job_id":"2a467c97-354c-41bb-b476-f15fd1ce9f54","html_url":"https://github.com/fabiocaccamo/python-codicefiscale","commit_stats":{"total_commits":348,"total_committers":9,"mean_commits":"38.666666666666664","dds":"0.16666666666666663","last_synced_commit":"ce0a1dc57b52d5998540e9b9c3e520a6162f9b68"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiocaccamo%2Fpython-codicefiscale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiocaccamo%2Fpython-codicefiscale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiocaccamo%2Fpython-codicefiscale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiocaccamo%2Fpython-codicefiscale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiocaccamo","download_url":"https://codeload.github.com/fabiocaccamo/python-codicefiscale/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248586249,"owners_count":21128997,"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":["anagrafe","anpr","cf","code","codice","codicefiscale","codifica","decodifica","fiscal","fiscale","interno","istat","italia","italian","italiano","italy","omocodia","python"],"created_at":"2024-10-13T22:45:40.006Z","updated_at":"2026-01-18T00:32:31.671Z","avatar_url":"https://github.com/fabiocaccamo.png","language":"Python","readme":"[![](https://img.shields.io/pypi/pyversions/python-codicefiscale.svg?logoColor=white\u0026color=blue\u0026logo=python)](https://www.python.org/)\n[![](https://img.shields.io/pypi/v/python-codicefiscale.svg?color=blue\u0026logo=pypi\u0026logoColor=white)](https://pypi.org/project/python-codicefiscale/)\n[![](https://static.pepy.tech/badge/python-codicefiscale/month)](https://pepy.tech/project/python-codicefiscale)\n[![](https://img.shields.io/github/stars/fabiocaccamo/python-codicefiscale?logo=github\u0026style=flat)](https://github.com/fabiocaccamo/python-codicefiscale/stargazers)\n[![](https://img.shields.io/pypi/l/python-codicefiscale.svg?color=blue\u0026)](https://github.com/fabiocaccamo/python-codicefiscale/blob/main/LICENSE)\n\n[![](https://results.pre-commit.ci/badge/github/fabiocaccamo/python-codicefiscale/main.svg)](https://results.pre-commit.ci/latest/github/fabiocaccamo/python-codicefiscale/main)\n[![](https://img.shields.io/github/actions/workflow/status/fabiocaccamo/python-codicefiscale/test-package.yml?branch=main\u0026label=build\u0026logo=github)](https://github.com/fabiocaccamo/python-codicefiscale)\n[![](https://img.shields.io/codecov/c/gh/fabiocaccamo/python-codicefiscale?logo=codecov)](https://codecov.io/gh/fabiocaccamo/python-codicefiscale)\n[![](https://img.shields.io/codacy/grade/8927f48c9498408f85167da9287edd86?logo=codacy)](https://www.codacy.com/app/fabiocaccamo/python-codicefiscale)\n[![](https://img.shields.io/scrutinizer/quality/g/fabiocaccamo/python-codicefiscale?logo=scrutinizer)](https://scrutinizer-ci.com/g/fabiocaccamo/python-codicefiscale/?branch=main)\n[![](https://img.shields.io/badge/code%20style-black-000000.svg?logo=python\u0026logoColor=black)](https://github.com/psf/black)\n[![](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n\n# python-codicefiscale\npython-codicefiscale is a library for encode/decode Italian fiscal code - **codifica/decodifica del Codice Fiscale**.\n\n![Codice Fiscale](https://user-images.githubusercontent.com/1035294/72058207-fa77dd80-32cf-11ea-8995-52324e7d3efe.png)\n\n## Features\n- `NEW` **Auto-updated** data (once a week) directly from **ANPR** data-source.\n- `NEW` **Command Line Interface** available.\n- **Transliteration** for name/surname\n- **Multiple** birthdate formats (date/string) *(you can see all the supported string formats [here](https://github.com/fabiocaccamo/python-codicefiscale/blob/main/tests/test_codicefiscale.py#L81-L140))*\n- **Automatic** birthplace city/foreign-country code detection from name\n- **Omocodia** support\n\n## Installation\n`pip install python-codicefiscale`\n\n## Usage\n\n### Python\n\n#### Import\n```python\nfrom codicefiscale import codicefiscale\n```\n#### Encode\n```python\ncodicefiscale.encode(\n    lastname=\"Caccamo\",\n    firstname=\"Fabio\",\n    gender=\"M\",\n    birthdate=\"03/04/1985\",\n    birthplace=\"Torino\",\n)\n\n# \"CCCFBA85D03L219P\"\n```\n#### Decode\n```python\ncodicefiscale.decode(\"CCCFBA85D03L219P\")\n\n# {\n#     \"code\": \"CCCFBA85D03L219P\",\n#     \"gender\": \"M\",\n#     \"birthdate\": datetime.datetime(1985, 4, 3, 0, 0),\n#     \"birthplace\": {\n#         \"name\": \"TORINO\"\n#         \"province\": \"TO\",\n#         \"code\": \"L219\",\n#     },\n#     \"omocodes\": [\n#         \"CCCFBA85D03L219P\",\n#         \"CCCFBA85D03L21VE\",\n#         \"CCCFBA85D03L2MVP\",\n#         \"CCCFBA85D03LNMVE\",\n#         \"CCCFBA85D0PLNMVA\",\n#         \"CCCFBA85DLPLNMVL\",\n#         \"CCCFBA8RDLPLNMVX\",\n#         \"CCCFBAURDLPLNMVU\",\n#     ],\n#     \"raw\": {\n#         \"code\": \"CCCFBA85D03L219P\",\n#         \"lastname\": \"CCC\",\n#         \"firstname\": \"FBA\",\n#         \"birthdate\": \"85D03\",\n#         \"birthdate_year\": \"85\"\n#         \"birthdate_month\": \"D\",\n#         \"birthdate_day\": \"03\",\n#         \"birthplace\": \"L219\",\n#         \"cin\": \"P\",\n#     },\n# }\n```\n\n#### Check\n```python\ncodicefiscale.is_valid(\"CCCFBA85D03L219P\")\n\n# True\n```\n```python\ncodicefiscale.is_omocode(\"CCCFBA85D03L219P\")\n\n# False\n```\n\n### Command Line\n\n\u003e [!CAUTION]\n\u003e If sensitive data is written to a log entry it could be exposed to an attacker who gains access to the logs.\n\nThis library can be used also as a CLI tool, for more info run:\n```bash\npython -m codicefiscale --help\n```\n\n#### Encode (CLI)\n```bash\npython -m codicefiscale encode --firstname Fabio --lastname Caccamo --gender M --birthdate 03/04/1985 --birthplace Torino\n```\n\n#### Decode (CLI)\n```bash\npython -m codicefiscale decode CCCFBA85D03L219P\n```\n\n## Testing\n```bash\n# clone repository\ngit clone https://github.com/fabiocaccamo/python-codicefiscale.git \u0026\u0026 cd python-codicefiscale\n\n# create virtualenv and activate it\npython -m venv venv \u0026\u0026 . venv/bin/activate\n\n# upgrade pip\npython -m pip install --upgrade pip\n\n# install requirements\npip install -r requirements.txt -r requirements-test.txt\n\n# install pre-commit to run formatters and linters\npre-commit install --install-hooks\n\n# run tests using tox\ntox\n\n# or run tests using pytest\npytest\n```\n\n## License\nReleased under [MIT License](LICENSE.txt).\n\n---\n\n## Supporting\n\n- :star: Star this project on [GitHub](https://github.com/fabiocaccamo/python-codicefiscale)\n- :octocat: Follow me on [GitHub](https://github.com/fabiocaccamo)\n- :blue_heart: Follow me on [Bluesky](https://bsky.app/profile/fabiocaccamo.bsky.social)\n- :moneybag: Sponsor me on [Github](https://github.com/sponsors/fabiocaccamo)\n\n## See also\n\n- [`python-benedict`](https://github.com/fabiocaccamo/python-benedict) - dict subclass with keylist/keypath support, I/O shortcuts (base64, csv, json, pickle, plist, query-string, toml, xml, yaml) and many utilities. 📘\n\n- [`python-fontbro`](https://github.com/fabiocaccamo/python-fontbro) - friendly font operations. 🧢\n\n- [`python-fsutil`](https://github.com/fabiocaccamo/python-fsutil) - file-system utilities for lazy devs. 🧟‍♂️\n","funding_links":["https://github.com/sponsors/fabiocaccamo","https://polar.sh/fabiocaccamo","https://ko-fi.com/fabiocaccamo","https://liberapay.com/fabiocaccamo","https://tidelift.com/funding/github/pypi/python-codicefiscale","https://www.buymeacoffee.com/fabiocaccamo","https://www.paypal.me/fabiocaccamo"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiocaccamo%2Fpython-codicefiscale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiocaccamo%2Fpython-codicefiscale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiocaccamo%2Fpython-codicefiscale/lists"}