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.
- Muhammad Khubaib Ahmad (
khubaib.ahmad@inference-lab.org) - Original creator offaker-pk - INFERENCE Lab (
contact@inference-lab.org) - Organization
- Ayesha Anwar (
hayesha1744@gmail.com) - Lead developer offaker-pkv0.2.0 - INFERENCE Lab (
contact@inference-lab.org) - Project organization
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.
pip install faker-pkTo upgrade to the latest version:
pip install --upgrade faker-pkfrom 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"))| 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" |
| 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" |
| 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 |
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)
| 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" |
| 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} |
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")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())-
Clone the repository:
git clone https://github.com/Inference-LAB/faker-pk.git cd faker-pk -
Install in editable mode:
pip install -e . -
Run the test suite:
pytest
We welcome contributions from the community! Whether you are expanding datasets, adding validation rules, or improving performance, here is how you can help:
- Fork & Clone: Fork
Inference-LAB/faker-pkon GitHub and clone your fork locally. - Feature Branches: Create a dedicated feature branch for your changes (
git checkout -b feat/add-new-dataset). - Database Updates: If adding new dataset records, update
faker_pk/initialize_db.pyso the SQLite database re-seeds cleanly. - Write Unit Tests: Add tests under
tests/for any new functions or parameters. Ensurepytestpasses with 100% success. - Submit a Pull Request: Push your branch and open a PR against
mainwith a clear summary of your changes.
- Email: khubaib.ahmad@inference-lab.org
- GitHub: Khubaib8281
- PyPI: Khubaib_01
- LinkedIn: Muhammad Khubaib Ahmad
- Email: hayesha1744@gmail.com
- GitHub: Ayesha-Anwar607
- LinkedIn: Ayesha Anwar
Distributed under the MIT License. See LICENSE for more information.
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