Skip to main content

A comprehensive library for Indian Identity and Financial data validation.

Project description

indpy 🇮🇳

Python Version License Status

indpy is a Python library for validating and generating Indian government documents and financial identifiers. It uses the official checksum algorithms (GSTIN Mod-36, Aadhaar Verhoeff) where applicable.

🚀 Features

✅ Validation

  • PAN: Structure validation.
  • GSTIN: Structure + Mod-36 checksum.
  • Aadhaar: Regex + Verhoeff checksum.
  • Voter ID (EPIC): 3 letters + 7 digits.
  • Passport: 1 letter + 7 digits.
  • Mobile: Indian 10-digit format (starts with 6–9).
  • IFSC: Bank branch code validation.
  • Vehicle (RC): Standard RTO formats (e.g., DL01CA1234).
  • UPI: Standard handle validation.

🎲 Data Generation (Mock Data)

  • Generate valid PAN numbers.
  • Generate valid mobile numbers.
  • Generate valid Aadhaar numbers (with Verhoeff checksum).
  • Generate Voter ID numbers.
  • Generate Passport numbers.
  • Generate random vehicle registration numbers.

📦 Installation

Install from PyPI:

pip install indpy_core

Note: The package name on PyPI is indpy_core, but you import it in Python as indpy.

Install for local development:

# Clone the repository
git clone https://github.com/harshgupta2125/Indpy.git
cd Indpy
pip install -e .

💻 Usage

  1. Python — Validation
from indpy import is_pan, is_gstin, is_vehicle, is_aadhaar, is_voterid, is_passport

# Validate PAN
if is_pan("ABCDE1234F"):
    print("Valid PAN")
else:
    print("Invalid PAN")

# Validate GSTIN (includes checksum)
if is_gstin("29ABCDE1234F1Z5"):
    print("Valid GSTIN")
else:
    print("Invalid GSTIN or checksum mismatch")

# Validate Vehicle registration
print(is_vehicle("UP16Z5555"))  # True or False

# Validate Aadhaar (Regex + Verhoeff)
print(is_aadhaar("379980670385"))  # True or False

# Validate Voter ID
print(is_voterid("ABC1234567"))  # True or False

# Validate Passport
print(is_passport("A1234567"))  # True or False
  1. Python — Generating Mock Data
from indpy import Generate

# Random PAN
print(Generate.pan())     # e.g. "BPLPZ5821K"

# Random Mobile
print(Generate.mobile())  # e.g. "9876123450"

# Random Aadhaar (with valid checksum)
print(Generate.aadhaar()) # e.g. "379980670385"

# Random Voter ID
print(Generate.voterid()) # e.g. "ABC1234567"

# Random Passport
print(Generate.passport()) # e.g. "A1234567"

# Random Vehicle
print(Generate.vehicle()) # e.g. "DL04CA9921"
  1. Command Line Interface

Check version:

indpy --version

Validate a document:

indpy check pan ABCDE1234F
# Output: ✅ PAN Validation Result: True

indpy check aadhaar 379980670385
# Output: ✅ AADHAAR Validation Result: True

indpy check voterid ABC1234567
# Output: ✅ VOTERID Validation Result: True

indpy check passport A1234567
# Output: ✅ PASSPORT Validation Result: True

Generate fake data:

indpy gen pan
# Output: ABCDE1234F

indpy gen vehicle
# Output: DL04CA9921

indpy gen aadhaar
# Output: 379980670385

indpy gen voterid
# Output: ABC1234567

indpy gen passport
# Output: A1234567

🛠️ Supported Documents

Document Regex / Logic (approx.) Checksum implemented?
PAN ^[A-Z]{5}[0-9]{4}[A-Z]$ Structure only
GSTIN ^\d{2}[A-Z]{5}[0-9A-Z]{9}$ Yes (Modulo-36)
Aadhaar ^[2-9]\d{11}$ Yes (Verhoeff)
Voter ID ^[A-Z]{3}[0-9]{7}$ N/A
Passport ^[A-Z][0-9]{7}$ N/A
Mobile ^[6-9]\d{9}$ N/A
IFSC ^[A-Z]{4}0[A-Z0-9]{6}$ N/A
Vehicle ^[A-Z]{2}\d{1,2}[A-Z]{1,2}\d{1,4}$ N/A

Note: Regex shown are illustrative and may be refined in code. GSTIN validation includes official Modulo-36 checksum verification.

🤝 Contributing

Contributions are welcome! Typical workflow:

  1. Fork the repository.
  2. Create a feature branch:
    git checkout -b feature/NewValidation
    
  3. Commit your changes:
    git commit -m "Add Aadhaar support"
    
  4. Push and open a pull request.

Please follow the existing code style and include tests for new validations.

📄 License

Distributed under the MIT License. See LICENSE for details.


⚠️ Don't forget

  1. Replace YOUR_USERNAME in the git clone link with your actual GitHub username.
  2. Push this change to GitHub so the front page updates immediately:
git add README.md
git commit -m "Update README formatting"
git push origin main

Project details


Download files

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

Source Distribution

indpy_core-0.1.4.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

indpy_core-0.1.4-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file indpy_core-0.1.4.tar.gz.

File metadata

  • Download URL: indpy_core-0.1.4.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for indpy_core-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d4c9ad8c5ebbdc7486400f71aae7440f60311566381b7e0827058c5ddfe034f7
MD5 e3ca621f306404954156136208fdd783
BLAKE2b-256 233014f477f39778dbc68fc034e161e7b56b55e8c5a2e373cd29702fdbd092cd

See more details on using hashes here.

File details

Details for the file indpy_core-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: indpy_core-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for indpy_core-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b53d91440d9057fd48dfc0995dc1436c03bb75b7ae5e483b87a433e91a089c8b
MD5 a8aab8f337dadbea83913543c77bd888
BLAKE2b-256 f01e333988c3bb508e4e2bb204a42052b37324bc11eb38b1fa5b4344344796e3

See more details on using hashes here.

Supported by

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