Skip to main content

faker-pk

PyPI Version PyPI downloads Python Version

faker-pk is a Python package that generates realistic Pakistani data for testing, software demos, synthetic datasets, and application development.

It supports generating localized Pakistani names, CNICs, mobile numbers, network providers, complete addresses, bank info, IBANs, company details, industry-aware job titles, clean salary figures, and educational institutions with student profiles.

It also fully integrates as a Faker Provider so you can seamlessly use it inside the standard faker library ecosystem.


Authors

  • Muhammad Khubaib Ahmad (khubaib.ahmad@inference-lab.org) - Original creator of faker-pk
  • INFERENCE Lab (contact@inference-lab.org) - Organization

Maintainers

  • Ayesha Anwar (hayesha1744@gmail.com) - Lead developer of faker-pk v2.0
  • INFERENCE Lab (contact@inference-lab.org) - Project organization

Why Use faker-pk?

Developers building Pakistani software applications often encounter issues with:

  • Generating realistic, localized user profiles (CNIC, phone numbers, addresses)
  • Validating Pakistani identity formats (CNIC last-digit gender checks)
  • Populating development databases with real-world company, industry, and banking data
  • Simulating student datasets filtered by city, province, or institution level
  • Running software demonstrations safely without exposing real personal data

faker-pk resolves this by utilizing an optimized, local SQLite database backend for reliable and realistic Pakistani data generation.


Installation

pip install faker-pk

To upgrade to the latest version:

pip install --upgrade faker-pk

Quick Start (Standalone FakerPK Class)

from faker_pk import FakerPK

fake = FakerPK()

print("Male Name:", fake.male_name())
print("CNIC:", fake.cnic(gender="male"))
print("Phone Number:", fake.phone_number(provider="Jazz"))
print("Full Address:", fake.full_address(province="Punjab"))
print("Company:", fake.company_name(industry="IT"))
print("Salary (PKR):", fake.salary(industry="IT"))
print("University:", fake.institution(level="university", city="Lahore"))

Complete API Reference

Personal Information

Function Description Options / Filters Example Output
male_name(count=1) Realistic Pakistani male names count "Kamran Qureshi"
female_name(count=1) Realistic Pakistani female names count "Laraib Javed"
cnic(count=1, gender=None) Valid formatted CNIC xxxxx-xxxxxxx-x gender='male'/'female' "35201-6543210-7"
phone_number(count=1, provider=None) Pakistani mobile number format provider='Jazz'/'Zong'/... "+923001234567"
sim_provider(count=1) Pakistani mobile network operator count "Jazz"
caste(count=1) Pakistani castes & surnames count "Zehri"
sect(count=1) Religious sects count "Sunni"
dob(count=1) Random date of birth count "1998-05-14"

Address Information

Function Description Options / Filters Example Output
city(count=1, province=None) Pakistani cities province='Punjab'/... "Lahore"
province(count=1, city=None) Pakistani provinces city='Karachi'/... "Sindh"
full_address(count=1, city=None, province=None) Complete street address with postal code city, province "House No. 454, Street No. 11, Lahore, Punjab, 54000"

Company & Financial Information

Function Description Options / Filters Example Output
company_name(count=1, industry=None) Registered Pakistani business names industry='IT'/... "Lucky Cement Limited"
industry_name(count=1) Industry sector names count "Information Technology"
bank_name(count=1) Registered commercial banks in Pakistan count "Meezan Bank"
iban(count=1, bank=None) Valid Pakistani IBAN format bank='HBL'/... "PK27UNIL8060952103358359"
salary(count=1, industry=None) Realistic salary in PKR industry='IT'/... 115500

Supported Industry Codes & Names:

When filtering company_name(), job_title(), or salary(), you can pass any of the following codes or full names:

  • IT (Information Technology)
  • Finance (Finance & Banking)
  • Healthcare (Healthcare & Pharmaceuticals)
  • Education (Education & Academics)
  • Marketing (Marketing & Media)
  • Government (Government & Public Sector)
  • Engineering (Engineering & Manufacturing)
  • Retail (Hospitality & Retail)
  • Entrepreneur (Entrepreneur & Startups)
  • Consulting (Legal & Consulting)
  • Art (Art & Entertainment)
  • Politics (Politics & Public Policy)
  • Agriculture (Agriculture & Farming)
  • Services (Domestic & Personal Services)
  • Defense (Defense & Public Safety)

Job Information

Function Description Options / Filters Example Output
job_title(count=1, industry=None) Industry-specific job titles industry='IT'/... "Software Engineer"
job_title_with_industry(count=1) Combined job title and industry code count "Data Scientist - IT"

Education & Student Profiles

Function Description Options / Filters Example Output
institution(count=1, level=None, city=None, province=None) Pakistani school, college, or university level='school'/'college'/'university', city, province "LUMS"
student_dob(count=1, level='university') Age-appropriate student DOB level='school'/'college'/'university' 2002-05-24
student_profile(count=1, level=None, province=None) Complete, coherent student dict profile level, province {'name': 'Shahzaib Mirwani', 'gender': 'male', 'cnic': '36836-2572000-5', 'institution': 'University of Karachi', 'level': 'university', 'city': 'Karachi', 'province': 'Sindh', 'dob': 2002-05-24}

Generating Multiple Records

Passing count > 1 returns a list of items:

from faker_pk import FakerPK

fake = FakerPK()

# Generate 3 cities in Sindh
print(fake.city(count=3, province="Sindh"))
# Output: ['Karachi', 'Hyderabad', 'Sukkur']

# Generate 5 realistic student profiles
profiles = fake.student_profile(count=5, level="university")

Standard faker Integration (FakerPKProvider)

You can register FakerPKProvider with Python's standard faker library. All methods are available prefixed with pk_ (or as alias methods):

from faker import Faker
from faker_pk import FakerPKProvider

fake = Faker()
fake.add_provider(FakerPKProvider)

print(fake.pk_male_name())
print(fake.pk_cnic(gender="male"))
print(fake.pk_full_address(province="Punjab"))
print(fake.pk_institution(level="university"))
print(fake.pk_student_profile())

Local Development & Testing

  1. Clone the repository:

    git clone https://github.com/Inference-LAB/faker-pk.git
    cd faker-pk
    
  2. Install in editable mode:

    pip install -e .
    
  3. Run the test suite:

    pytest
    

Contributing

We welcome contributions from the community! Whether you are expanding datasets, adding validation rules, or improving performance, here is how you can help:

How to Contribute:

  1. Fork & Clone: Fork Inference-LAB/faker-pk on GitHub and clone your fork locally.
  2. Feature Branches: Create a dedicated feature branch for your changes (git checkout -b feat/add-new-dataset).
  3. Database Updates: If adding new dataset records, update faker_pk/initialize_db.py so the SQLite database re-seeds cleanly.
  4. Write Unit Tests: Add tests under tests/ for any new functions or parameters. Ensure pytest passes with 100% success.
  5. Submit a Pull Request: Push your branch and open a PR against main with a clear summary of your changes.

Authors & Contact Info

Muhammad Khubaib Ahmad

Ayesha Anwar


License

Distributed under the MIT License. See LICENSE for more information.


Support

If faker-pk was helpful for your project or application, please consider giving the repository a star on GitHub!
https://github.com/Inference-LAB/faker-pk

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

faker_pk-0.2.0.tar.gz (51.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

faker_pk-0.2.0-py3-none-any.whl (45.3 kB view details)

Uploaded Python 3

File details

Details for the file faker_pk-0.2.0.tar.gz.

File metadata

  • Download URL: faker_pk-0.2.0.tar.gz
  • Upload date:
  • Size: 51.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for faker_pk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 eb592727a34cc5919c43c05b2be1143d9cfa557158177e6d289e34871fcbb742
MD5 2cd7140f9b10454110072f3d65c4240a
BLAKE2b-256 0915acdf39303b38bf08802685a70bf47c7fdfdbe25f7f42aa112592259f9f9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for faker_pk-0.2.0.tar.gz:

Publisher: publish.yml on Inference-LAB/faker-pk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file faker_pk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: faker_pk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 45.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for faker_pk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c875decca39523bbc22c0722086972da9379c2a3c5f47a31d444c9fb6e53f55
MD5 1297fe4664a931a695386af3534c88e4
BLAKE2b-256 6a3310dd0d272717d975dfb9db60c304d9108d82d942223c3d01eed2f11f513a

See more details on using hashes here.

Provenance

The following attestation bundles were made for faker_pk-0.2.0-py3-none-any.whl:

Publisher: publish.yml on Inference-LAB/faker-pk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page