{"id":49225373,"url":"https://github.com/jayeshmepani/libpostal-ffi-python","last_synced_at":"2026-04-24T07:00:35.664Z","repository":{"id":353330046,"uuid":"1218939919","full_name":"jayeshmepani/libpostal-ffi-python","owner":"jayeshmepani","description":"Zero-setup, 1:1 C-FFI Python wrapper for libpostal. Cross-platform, automatic prebuilt binaries, no C compilation required.","archived":false,"fork":false,"pushed_at":"2026-04-23T12:04:20.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-23T13:29:27.004Z","etag":null,"topics":["address-normalization","address-parser","address-standardization","c-binding","cross-platform","ctypes","ffi","geocoding","gis","libpostal","libpostal-python","machine-learning","nlp","openvenues","parser","postalkit","pypi","python","python3","zero-setup"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/postalkit/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jayeshmepani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-23T11:17:40.000Z","updated_at":"2026-04-23T12:04:24.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jayeshmepani/libpostal-ffi-python","commit_stats":null,"previous_names":["jayeshmepani/libpostal-ffi-python"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/jayeshmepani/libpostal-ffi-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayeshmepani%2Flibpostal-ffi-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayeshmepani%2Flibpostal-ffi-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayeshmepani%2Flibpostal-ffi-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayeshmepani%2Flibpostal-ffi-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jayeshmepani","download_url":"https://codeload.github.com/jayeshmepani/libpostal-ffi-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayeshmepani%2Flibpostal-ffi-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32212808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T03:15:14.334Z","status":"ssl_error","status_checked_at":"2026-04-24T03:15:11.608Z","response_time":64,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["address-normalization","address-parser","address-standardization","c-binding","cross-platform","ctypes","ffi","geocoding","gis","libpostal","libpostal-python","machine-learning","nlp","openvenues","parser","postalkit","pypi","python","python3","zero-setup"],"created_at":"2026-04-24T07:00:33.973Z","updated_at":"2026-04-24T07:00:35.647Z","avatar_url":"https://github.com/jayeshmepani.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PostalKit\n\n**Zero-setup, one-command install Python package for libpostal. Designed as a strict 1:1 C-FFI wrapper.**\n\nParsing international street addresses shouldn't require a Ph.D. in C compilation. `postalkit` provides the ultimate zero-friction environment to run the amazing [libpostal](https://github.com/openvenues/libpostal) C library natively in Python, without abstracting away its raw power. \n\nLike `FFI` implementations in PHP, this exposes the exact C structs, constants, and functions so that you can port C logic directly to Python.\n\n## ✨ Why PostalKit?\n\nThe standard `postal` package requires you to manually compile C code, install `autoconf`, `make`, `pkg-config`, and manually download a ~2GB machine learning model.\n\n**PostalKit handles everything automatically:**\n- ✅ **Zero C compilation:** Downloads pre-compiled `libpostal` shared binaries for your OS and architecture.\n- ✅ **Auto-downloads models:** Fetches the required libpostal ML models transparently on first use.\n- ✅ **Strict 1:1 C Mapping:** Exposes `libpostal_parse_address`, `libpostal_expand_address`, and all `ctypes` structs exactly as defined in `libpostal.h`.\n- ✅ **Cross-platform:** Works on Linux (x86_64, arm64), macOS (Intel, Apple Silicon), and Windows.\n\n## 📦 Installation\n\n```bash\npip install postalkit\n```\n\n## 🚀 Quickstart\n\nBecause this is a **true 1:1 FFI wrapper**, you use the exact function names and C-structs defined in the upstream libpostal C headers. Memory is managed precisely as it is in C.\n\n```python\nimport ctypes\nimport postalkit\n\n# 1. Get the C-struct for parser options\noptions = postalkit.libpostal_get_address_parser_default_options()\n\n# 2. Call the C-function directly (strings must be passed as bytes)\naddress = b\"221B Baker St London\"\nresponse_ptr = postalkit.libpostal_parse_address(address, options)\n\n# 3. Access the raw C-arrays\nresponse = response_ptr.contents\nfor i in range(response.num_components):\n    component = response.components[i].decode('utf-8')\n    label = response.labels[i].decode('utf-8')\n    print(f\"{label}: {component}\")\n\n# 4. Manually destroy the C pointer to free memory, exactly as in C!\npostalkit.libpostal_address_parser_response_destroy(response_ptr)\n```\n\n## 🧠 True 1:1 FFI Coverage\n\nThis package leaves absolutely nothing behind. It natively exposes:\n- **All 46 C functions** (`libpostal_tokenize`, `libpostal_classify_language`, `libpostal_is_name_duplicate_fuzzy`, etc.)\n- **All 10 C Structs** (`libpostal_normalize_options_t`, `libpostal_duplicate_options_t`, etc.)\n- **All 42 C Constants \u0026 Bitwise Flags** (`LIBPOSTAL_ADDRESS_HOUSE_NUMBER`, `LIBPOSTAL_NORMALIZE_TOKEN_DELETE_HYPHENS`, etc.)\n\nYou can directly port any libpostal C/C++ tutorial code into Python line-by-line.\n\n## 🛠️ Advanced Usage\n\n**Pre-downloading assets (e.g., for Docker images or CI):**\n```python\nfrom postalkit.data.manager import ensure_all_assets\nensure_all_assets()\n```\n\n## 📄 License\n\nMIT License. Developed with 💙 by [Jayesh Mepani](https://github.com/jayeshmepani).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjayeshmepani%2Flibpostal-ffi-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjayeshmepani%2Flibpostal-ffi-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjayeshmepani%2Flibpostal-ffi-python/lists"}