Registry / data / pyap2
library0.2.14pypypi✓ verified 85d ago

Pyap2 is a maintained fork of pyap, a regex-based library for parsing US, CA, and UK addresses. It provides a robust way to extract structured address data from unstructured text. The fork adds typing support, handles more address formats and edge cases, and is actively developed. The current version is 0.2.12, with frequent minor releases addressing new formats and edge cases.

pip install pyap2
INSTALL
IMPORT
SIG · PYAP2
P
pyap2
datapythonv0.2.14
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.14 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Address
from pyap import Address
from pyap2 import parse_address
parse
from pyap import parse
from pyap2 import parse_address
findall
from pyap import findall
from pyap2 import parse_address

This quickstart demonstrates how to use `parse_address` with a sample US address. It's crucial to specify the `country` parameter for accurate parsing. The function returns a list of `Address` objects, from which you can extract various components or get a dictionary representation.

import pyap2 address_text = """ 6162 E. Mockingbird Ln Dallas, TX 75214 """ # parse_address returns a list of Address objects addresses = pyap2.parse_address(address_text, country='US') if addresses: for addr in addresses: print(f"Parsed Address: {addr.full_address}") print(f" Street: {addr.street_number} {addr.street_name} {addr.street_type}") print(f" City: {addr.city}") print(f" Region: {addr.region1}") print(f" Postcode: {addr.postcode}") print(f" As Dictionary: {addr.as_dict()}") else: print("No address found or parsed.")
Debug
Known issues
breakingPyap2 is a maintained fork of the original `pyap` library. If migrating from `pyap`, you must change your package installation (`pip install pyap2`) and all import statements from `from pyap import ...` to `from pyap2 import ...`.
fix
Ensure you install `pyap2` and update your import statements to `from pyap2 import parse_address`.
affects: All versions
gotchaThe `parse_address` function relies on regex and is highly sensitive to the input address format. For multiple addresses within a single string, each address must be separated by a newline to be parsed correctly. Otherwise, they might be treated as a single, malformed address.
fix
When processing text with multiple addresses, ensure each distinct address is on its own line or separated by newlines.
affects: All versions
gotchaThe `country` parameter in `parse_address` is critical for accurate results. Failing to specify it, or providing an incorrect country, can lead to no addresses being found or incorrect parsing, as the regex patterns are country-specific.
fix
Always pass the appropriate `country` parameter (e.g., 'US', 'CA', 'UK') to `parse_address`.
affects: All versions
gotchaPyap2 currently only supports address parsing for the United States (US), Canada (CA), and the United Kingdom (UK). Addresses from other countries will not be parsed correctly, or at all.
fix
Verify that the addresses you intend to parse are from one of the supported countries. For other regions, consider alternative libraries.
affects: All versions
Upgrade
Version history
0.2.14latest on PyPI · released Jun 15, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
26 hits · last 30 days
node
24
Bingbot
1
Resources
pyap2 — pip install pyap2 · libregistry