Registry / serialization / pyap
library0.3.1pypypi✓ verified 87d ago

Pyap is an MIT Licensed text processing library, written in Python, for detecting and parsing addresses using regular expressions. It currently supports US, Canadian, and British address formats. The library is at version 0.3.1, with its last release in September 2020, indicating a slow release cadence or maintenance status for the original package, though forks exist.

pip install pyap
INSTALL
IMPORT
SIG · PYAP
P
pyap
serializationpythonv0.3.1
Install
1.5s avg
Import
10ms
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.3.1 · 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.010s · 18MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.5s · import 0.008s · 19MB
16MB installed
● package 16MB
Code
Verified usage

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

pyap
import pyap

The quickstart demonstrates how to import the `pyap` library and use its `parse` function to extract addresses from a given text string. It highlights specifying the `country` parameter for accurate parsing and iterating through the results to access both the full address string and its parsed components as a dictionary.

import pyap text_with_address = """This is some sample text containing an address: 225 E. John Carpenter Freeway, Suite 1500 Irving, Texas 75062. And more text.""" # Parse addresses for the US addresses = pyap.parse(text_with_address, country='US') for address in addresses: print(f"Found Address: {address}") print(f"Parsed Components: {address.as_dict()}") # Example with a different country (Canada) canada_address_text = """Meeting at 4998 Stairstep Lane Toronto ON, tomorrow.""" canada_addresses = pyap.parse(canada_address_text, country='CA') for address in canada_addresses: print(f"Found Canadian Address: {address}")
Debug
Known issues
deprecatedThe original `pyap` library (v0.3.1) has not been updated since September 2020. For more active maintenance, typing support, and handling of additional address formats/edge cases, consider using community-maintained forks like `pyap2` (`pip install pyap2`).
fix
For new projects or enhanced capabilities, evaluate `pyap2` (or other forks) instead of the original `pyap` package. If staying with `pyap`, be aware of potential lack of updates.
affects: <=0.3.1
gotchaPyap is solely based on regular expressions and does not validate addresses against external databases or lists of cities/street names. This can lead to false positives where strings that *look* like addresses are parsed, even if they are not real-world locations (e.g., '1 SPIRITUAL HEALER DR SHARIF NSAMBU SPECIALISING IN' might be detected).
fix
Always post-validate parsed addresses, especially for critical applications. Consider integrating with a geocoding service to verify the existence and accuracy of detected addresses.
affects: All
gotchaThe `country` parameter in `pyap.parse()` is mandatory. Failing to provide a supported country code will result in an exception.
fix
Ensure you always pass a `country` argument (e.g., `country='US'`, `country='CA'`, `country='GB'`) to `pyap.parse()`. Consult the documentation or source code for the exact list of supported country codes.
affects: All
Errors
Common errors & fixes
pyap.exceptions.NoCountrySelected: No country specified during library initialization.
The `pyap.parse()` function was called without the required `country` argument.
fix
Always specify the `country` parameter, e.g., `pyap.parse(text, country='US')`.
pyap.exceptions.CountryDetectionMissing: Detection rules for country "XX" not found.
An unsupported or incorrect country code was provided to `pyap.parse()`.
fix
Use one of the supported country codes: 'US' (United States), 'CA' (Canada), or 'GB' (Great Britain). For other countries, this library does not provide support.
AttributeError: 'list' object has no attribute 'as_dict'
The `pyap.parse()` function returns a list of `Address` objects, not a single `Address` object. The `as_dict()` method is available on individual `Address` objects, not on the list itself.
fix
Iterate through the list of addresses or access a specific element by index before calling `as_dict()`. For example: `addresses = pyap.parse(text, country='US')` followed by `for address in addresses: print(address.as_dict())` or `if addresses: print(addresses[0].as_dict())`.
Upgrade
Version history
0.3.1latest on PyPI · released Sep 30, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
8
Resources
pyap — pip install pyap · libregistry