PakDataKit for Python
Utilities for Pakistani data: CNIC, mobile numbers and networks, WhatsApp links, IBAN, postal codes, cities and districts, address parsing, Roman Urdu, Hijri dates, public holidays, rupee formatting, amounts in words, NTN/STRN, landlines and Raast QR codes.
This is the Python port of the pakdatakit npm package.
It ships the same datasets and is tested against shared test vectors
generated from the TypeScript library, so both give identical results.
Pure Python, no dependencies, Python 3.9+.
Install
pip install pakdatakit
Examples
import datetime as dt
import pakdatakit as pdk
pdk.validate_cnic("35202-1234567-1") # True
pdk.get_cnic_info("35202-1234567-1")
# CNICInfo(digits='3520212345671', formatted='35202-1234567-1', province='Punjab', gender='male')
pdk.format_phone("0300 1234567") # '+923001234567'
pdk.get_network("0345-1234567") # 'Telenor'
pdk.create_whatsapp_link("03001234567", "Salam!")
pdk.validate_iban("PK36 SCBL 0000 0011 2345 6702") # True
pdk.get_bank_from_iban("PK36SCBL0000001123456702") # 'Standard Chartered Bank (Pakistan) Limited'
pdk.get_bank_info("MEZN").type # 'islamic'
pdk.get_province("Lahore") # 'Punjab'
pdk.parse_address("House 12, Street 5, Model Town Lahore 54000")
pdk.format_pkr(150000) # 'Rs. 150,000'
pdk.format_lakh(2500000) # '25 Lakh'
pdk.amount_in_words(125000, cheque=True) # 'Rupees One Lakh Twenty-Five Thousand Only'
pdk.number_to_words(125000, language="ur") # 'ایک لاکھ پچیس ہزار'
pdk.format_hijri(dt.date(2026, 3, 1)) # '12 Ramadan 1447'
pdk.get_pakistan_holidays(2026)[0] # Holiday(id='kashmir-day', ...)
payload = pdk.create_raast_p2p_qr("PK36SCBL0000001123456702", amount=1500, expires_in="1d")
pdk.validate_raast_qr(payload).valid # True
pdk.format_cnic_input("3520212") # '35202-12'
pdk.check_phone_input("0300 12") # 'incomplete'
API
Every function of the npm package is available under its snake_case name
(validateCNIC → validate_cnic, createRaastP2PQr → create_raast_p2p_qr).
Option objects become keyword arguments ({ expiresIn: '1d' } →
expires_in="1d"), structured results are frozen dataclasses with snake_case
fields, null is None, and a RangeError is a ValueError. Dates are
datetime.date / naive local datetime.datetime.
DATA_VERSION gives the date the datasets were last checked, and
__version__ the package version.
See the main README for the full API reference and DATA.md for where each dataset comes from.
Development
From python/:
uv run --with pytest pytest -q
The data files in src/pakdatakit/data/ and the vectors in ../test-vectors/
are generated from the TypeScript package; don't edit them by hand. From the
repository root:
npm run build && node scripts/generate-test-vectors.mjs
License
MIT
Metadata
Release files for pakdatakit 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pakdatakit-2.2.0.tar.gz | 42.4 kB | With provenance | Details for pakdatakit-2.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pakdatakit-2.2.0-py3-none-any.whl | Python 3 | none | any | Details for pakdatakit-2.2.0-py3-none-any.whl |
Total release size: 92.0 kB
Release files / pakdatakit-2.2.0.tar.gz
| Download URL | pakdatakit-2.2.0.tar.gz |
|---|---|
| Size | 42.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9b7fef7592913c05f41ed36e6c68ab2e4bcc62ded9158823954c3c435c14e1b
|
|
BLAKE2b-256 checksum How to use checksums |
c403bf8d6832b3bcac6971bca0f7cb3873bc852952c32bfd628dc6df20e44c6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logRelease files / pakdatakit-2.2.0-py3-none-any.whl
| Download URL | pakdatakit-2.2.0-py3-none-any.whl |
|---|---|
| Size | 49.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
37b7069274943b1c129c3f41e3bab7b5c634a1e98471cf6b44f9b91680133634
|
|
BLAKE2b-256 checksum How to use checksums |
0c6c41b0657456c49e496b97b7ace7f92140b5aa4602d999ce571a9e2bd7184f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logSecurity for pakdatakit 2.2.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for pakdatakit-2.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logA 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.