Petrock

A small, dependency-free geocoding and address-normalisation library for Python.

Petrock takes messy postal addresses and returns a normalised structure: street, house number, postcode, locality. It ships with rule sets for eleven European countries and does not call any remote service — everything runs locally against a compiled rule table of about 4 MB.

# install
pip install petrock

# normalise a single address
from petrock import parse
addr = parse("kralovska 12/4, praha 6", country="cz")
print(addr.street, addr.number, addr.postcode)

Why not an API?

Address normalisation is usually the first step of a longer pipeline, often inside a batch job with millions of rows. Round-tripping every row through a network service is slow, costs money and drags a privacy question into what should be a pure function. Petrock keeps it local and deterministic: same input, same output, same version — forever.

What it does not do

Looking for coordinates? Pair Petrock with any tile-server geocoder — normalising first typically lifts hit rates by 15–20 % on user-entered data.

Supported countries

CodeCountryRule setCoverage
czCzechiafullstreet, orientation no., postcode, district
skSlovakiafullstreet, number, postcode
plPolandfullstreet, number, postcode, voivodeship
deGermanyfullstreet, number, postcode, city
atAustriafullstreet, number, postcode
nlNetherlandsfullstreet, number, suffix, postcode
frFrancepartialstreet, number, postcode (no CEDEX)
hu, si, hr, ropartialstreet, postcode