--- id: pyap2 version: "0.2.17" license: MIT license_treatment: permissive maintenance: active --- # pyap2 — Pyap2 is a maintained fork of pyap, a regex-based library for parsing US, CA, and UK addresses. The fork adds typing support, handles more address formats and edge cases. License: permissive · Maintenance: active · Downloads: 245.5K/mo ## What it is and what it does Pyap2 is a maintained fork of the original Pyap library that uses regular expressions to find and parse postal addresses embedded in unstructured text. It extracts address components (street, city, state, zip) and returns them as structured objects or dictionaries. The library is designed for quick detection when you don't know whether text contains addresses at all, making it useful in web scraping and data extraction workflows. Because it relies on regex patterns rather than city lists or street databases, it's fast but can produce false positives on strings that happen to match address-like patterns. The maintainers note that such errors are rare in practice. The fork adds type hints and handles more edge cases than the original, including partial addresses with only street information. Use it for: - Extract shipping or mailing addresses from user-submitted forms or scraped web content. - Parse addresses from unstructured documents like emails or PDFs before geocoding or validation. - Detect whether a text block contains an address as a preprocessing step in data pipelines. - Normalize address components (street, city, state, zip) into structured fields for database storage. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Pyap2 detects and parses postal addresses from unstructured text using regex patterns, currently supporting US, Canadian, and British address formats. Yes, if you need lightweight regex-based address detection in US, Canadian, or British text and can tolerate occasional false positives. The low install friction, active maintenance, MIT license, and zero security vulnerabilities make it a safe choice. Not suitable if you require high accuracy on non-English addresses or need validation against authoritative address databases. ## Install pip install pyap2 uv add pyap2 poetry add pyap2 ## Installing pyap2 Before you install: Low install friction with no runtime dependencies. Actively maintained as of 2026-07-10 with recent releases; repository shows minimal activity (4 stars) but is not archived. License in practice: MIT license permits commercial and private use with minimal restrictions; you must retain the license notice in distributions. Quickstart: pip install pyap2 import pyap test_address = "225 E. John Carpenter Freeway, Suite 1500 Irving, Texas 75062" addresses = pyap.parse(test_address, country='US') for address in addresses: print(address.as_dict()) Requires Python 3.9 or later (supports 3.9, 3.10, 3.11). Verify before relying: - Whether the library's regex-based approach performs adequately on your specific address formats and edge cases beyond the documented US, Canadian, and British support. - Performance characteristics when parsing large volumes of text or addresses. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 245.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags address parser regex, extract addresses from text, postal address detection, US address parsing, address extraction library, parse street addresses, address recognition, text-extraction, regex-based, web-scraping [View on SkillFed](https://skillfed.io/packages/pyap2) · [View on PyPI](https://pypi.org/project/pyap2/)