Registry / security / python-codicefiscale

python-codicefiscale

JSON →
library0.12.1pypypi✓ verified 82d ago

A Python library to encode and decode Italian fiscal codes (Codice Fiscale). Current version 0.12.1, with regular maintenance and updates.

pip install python-codicefiscale
INSTALL
IMPORT
SIG · PYTHON-CODICEFISCA
P
python-codicefiscale
securitypythonv0.12.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

encode
from codicefiscale import encode
from codicefiscale import CodiceFiscale
decode
from codicefiscale import decode
is_valid
from codicefiscale import is_valid

Create a CodiceFiscale instance and decode the fiscal code.

from codicefiscale import CodiceFiscale cf = CodiceFiscale( firstname='Mario', lastname='Rossi', birthdate='1990-01-01', birthplace='Roma', gender='M' ) print(cf.decode())
Debug
Known issues
gotchaThe 'birthplace' parameter must be the official Italian comune name (e.g., 'Roma', not 'Rome'). Incorrect birthplace will produce an invalid code.
fix
Use the Italian name as per official ISTAT code.
affects: all
gotchaThe 'gender' parameter expects 'M' or 'F' as a string, not boolean or integer. Passing 'male' or 1 will raise an error or produce unexpected behavior.
fix
Always use 'M' or 'F'.
affects: all
gotchaBirthdate must be a string in 'YYYY-MM-DD' format. Passing a datetime.date object without converting may cause a TypeError.
fix
Convert dates to string using .strftime('%Y-%m-%d') before passing.
affects: all
Upgrade
Version history
0.12.1latest on PyPI · released May 8, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
14
Resources
python-codicefiscale — pip install python-codicefiscale · libregistry