Skip to main content

Build Status codecov Code Health PyPI version Py versions License

python-codicefiscale

python-codicefiscale is a tiny library for encode/decode Italian fiscal code - codifica/decodifica del Codice Fiscale.

Features

  • Transliteration for name/surname

  • Multiple birthdate formats (datetime/string) (you can see all the supported string formats in tests/tests.py )

  • Automatic birthplace city/foreign-country code detection from name

  • Omocodia support

Installation

pip install python-codicefiscale

Usage

Import

from codicefiscale import codicefiscale

Encode

codicefiscale.encode(surname='Caccamo', name='Fabio', sex='M', birthdate='03/04/1985', birthplace='Torino')

# 'CCCFBA85D03L219P'

Decode

codicefiscale.decode('CCCFBA85D03L219P')

# {
#     'surname': 'CCC',
#     'name': 'FBA',
#     'sex': 'M',
#     'birthdate': datetime.datetime(1985, 4, 3, 0, 0),
#     'birthplace': {
#         'province': 'TO',
#         'code': 'L219',
#         'name': 'TORINO'
#     },
#     'cin': 'P',
#     'code': 'CCCFBA85D03L219P',
#     'omocodes': [
#         'CCCFBA85D03L219P',
#         'CCCFBA85D03L21VE',
#         'CCCFBA85D03L2MVP',
#         'CCCFBA85D03LNMVE',
#         'CCCFBA85D0PLNMVA',
#         'CCCFBA85DLPLNMVL',
#         'CCCFBA8RDLPLNMVX',
#         'CCCFBAURDLPLNMVU'
#     ],
# }

Check

codicefiscale.is_valid('CCCFBA85D03L219P')

# True
codicefiscale.is_omocode('CCCFBA85D03L219P')

# False
codicefiscale.is_omocode('CCCFBA85D03L21VE')

# True

Test

tox / python setup.py test / python -m unittest tests.tests


License

Released under MIT License.

Metadata

Release files for python-codicefiscale 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-codicefiscale 0.2.1
File Size Uploaded Provenance Actions
python-codicefiscale-0.2.1.tar.gz 91.0 kB Without provenance Details for python-codicefiscale-0.2.1.tar.gz

Release files / python-codicefiscale-0.2.1.tar.gz

Download URL python-codicefiscale-0.2.1.tar.gz
Size 91.0 kB
Tags Source
SHA-256 checksum
How to use checksums
25d8b0ecb4981bde8634e71303f925bfe23bc3272cc67970847f951ea607ffd2
BLAKE2b-256 checksum
How to use checksums
2bc4f20e4e5e70296a5c42359667c76c175d55cf7c53a787b119ac944cde3aad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for python-codicefiscale 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page