Metadata-Version: 2.4
Name: pk_address_checker
Version: 1.0.0
Summary: Lenient Pakistan business address checker with bundled registry data
License: Proprietary
Keywords: pakistan,address,validation
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: pdfplumber

# pk-address-checker

Lenient, deterministic Pakistan business-address checker. The registry database
(CSVs) ships **inside** this package — install and check offline, no downloads,
no update run required.

```bash
pip install .        # or a release wheel
```

```python
from pk_address_checker import check_address, is_valid_address

result = check_address("Shop 12, Tehsil Mankera, Rahim Yar Khan")
print(result["valid"])          # False
print(result["reason_codes"])   # ['tehsil_city_conflict']

is_valid_address("Street 5, Gulistan-e-Johar, Karachi")  # True
```

- Stdlib only for checking addresses (`re`, `csv`, `difflib`); Python 3.8+.
  `pdfplumber` (installed automatically as a dependency) powers the data-update
  pipeline's PDF parsers.
- Ambiguity never causes rejection — only stated contradictions reject.
- Refresh the bundled data later with `python -m pk_address_checker update`.
  Set `PK_ADMIN_DATA_DIR` to point the data folder somewhere writable if needed.

## Using a different data folder

Set the `PK_ADMIN_DATA_DIR` environment variable before importing `pk_address_checker`.
It is read once, at import time. You only need it if the installed data folder is
not writable for `update`, or to share data between projects — when set, both address
checking and `update` use that folder.

- PowerShell: `$env:PK_ADMIN_DATA_DIR = "C:\pkdata"`
- Python, before the import: `os.environ["PK_ADMIN_DATA_DIR"] = r"C:\pkdata"`
