Skip to main content

Parse, normalize and render postal addresses.

Project description

Postal Address

Python module to parse, normalize and render postal addresses.

Last release Unit-tests status Coverage Status Requirements freshness Software license Popularity

Motivation

« What ties us to territory is tax. » – Kevin Deldycke, 2014-11-07

The reason above is why we need fine-grained and meticulous territory management and normalization. This project aims to solve this problem once for all.

Don’t get me wrong, this work is a huge undertaking. Postal address parsing, normalization and rendering is hard. Much harder than you think. Please read the famous Falsehoods programmers believe about addresses pamphlet.

This library is still in its early stages, but is good enough to implement the new European Directives on VAT, which requires all e-commerce shops to guess the locality of their EU customers depending on their billing address.

Stability policy

Here is a bunch of rules we’re trying to follow regarding stability:

  • Patch releases (0.x.n0.x.(n+1) upgrades) are bug-fix only. These releases must not break anything and keeps backward-compatibility with 0.x.* and 0.(x-1).* series.

  • Minor releases (0.n.*0.(n+1).0 upgrades) includes any non-bugfix changes. These releases must be backward-compatible with any 0.n.* version but are allowed to drop compatibility with the 0.(n-1).* series and below.

  • Major releases (n.*.*(n+1).0.0 upgrades) are not planned yet: we’re still in beta and the final feature set of the 1.0.0 release is not decided yet.

Release process

Start from the develop branch:

git clone git@github.com:scaleway/postal-address.git
git checkout develop

Update revision to its release number and update change log:

vi ./postal_address/__init__.py
vi ./CHANGES.rst

Create a release commit, tag it and merge it back to master branch:

git add ./postal_address/__init__.py ./CHANGES.rst
git commit -m "Release vXX.XX.XX"
git tag "vXX.XX.XX"
git push
git push --tags
git checkout master
git pull
git merge "vXX.XX.XX"
git push

Push packaging to the test cheeseshop:

python setup.py register -r testpypi
pip install wheel
rm -rf ./build ./dist
python setup.py sdist bdist_egg bdist_wheel upload -r testpypi

Publish packaging to PyPi:

python setup.py register -r pypi
rm -rf ./build ./dist
python setup.py sdist bdist_egg bdist_wheel upload -r pypi

Bump revision back to its development state:

git checkout develop
vi ./postal_address/__init__.py
vi ./CHANGES.rst
git add ./postal_address/__init__.py ./CHANGES.rst
git commit -m "Post release version bump."

License

This software is licensed under the GNU General Public License v2 or later (GPLv2+).

ChangeLog

0.6.1 (2015-04-07)

  • Update all Online Labs references to Scaleway.

0.6.0 (2015-04-02)

  • Add an option to bypass Address’ strict normalization.

0.5.2 (2015-03-30)

  • Always sort fields in error messages to improve reproducibility when unit testing.

  • Deduplicate inconsistent field entries in custom address exception.

0.5.1 (2015-03-30)

  • Fix bad released version.

0.5.0 (2015-03-30)

  • Increase capabilities of alias resolution by country_aliases() method, which in turns increase address normalization efficiency.

  • Remove backward compatibility with 0.3 series.

  • Remove deprecated territory.territory_tree() method which provided backward compatibilityi with the 0.1 series. It should have been removed in the 0.3.0 release.

  • Split-up supported_territory_codes() into supported_country_codes() and supported_subdivision_codes().

0.4.3 (2015-03-26)

  • Fix rendering of subdivision-less addresses.

0.4.2 (2015-03-26)

  • Fix country_code to subdivision_code validation if the latter is not set.

0.4.1 (2015-03-26)

  • Base our custom InvalidAddress exception on ValueError to increase backward compatibility.

0.4.0 (2015-03-25)

  • Show subdivision as-is in rendered address if not already printed by state, country or city.

  • Document stability policy. Closes #8.

  • Change internals to refer to address components as fields.

  • Raise custom exception on address validation a detailed list of invalid fields in one go. Closes #7.

0.3.3 (2015-03-25)

  • Fix bad released version.

0.3.2 (2015-03-25)

  • Add backward compatibility to the 0.2 series following territory utils split out of the address module. See #8 and #9.

0.3.1 (2015-03-05)

  • Fix rendering of state in address.

0.3.0 (2015-03-04)

  • Remove backward compatibility with the 0.1 series.

  • Allow direct import of classes from module root.

  • Split territory utils out to their own file. See #3.

  • Rename normalize_country_code to country_from_subdivision. Mark the former as deprecated.

  • Address normalization is now non-blocking. It simply reset invalid components to None. Only a call to validate method check data consistency.

0.2.1 (2014-12-22)

  • Push a new release to fix cached desynced packages on cheeseshops and clones.

0.2.0 (2014-12-18)

  • Package the whole module for proper distribution.

0.1.1 (2014-12-16)

  • Restore partial backward compatibility with address module from the 0.1 series.

0.1.0 (2014-12-15)

  • First public release.

0.0.0 (2013-12-06)

  • First commit.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

postal-address-0.6.1.tar.gz (27.9 kB view details)

Uploaded Source

Built Distributions

postal_address-0.6.1-py2.7.egg (21.8 kB view details)

Uploaded Source

postal_address-0.6.1-py2-none-any.whl (25.7 kB view details)

Uploaded Python 2

File details

Details for the file postal-address-0.6.1.tar.gz.

File metadata

File hashes

Hashes for postal-address-0.6.1.tar.gz
Algorithm Hash digest
SHA256 c38f5b19bc8e495b24816c5f72e9446c130b2076999ecdc91abb61509f27c67f
MD5 13ab2b95ae2fba81ec345972479bc24b
BLAKE2b-256 4f92077be81309d20c04a2299274f5c1031d1c1447c57de713d543cd2e02f1d7

See more details on using hashes here.

File details

Details for the file postal_address-0.6.1-py2.7.egg.

File metadata

File hashes

Hashes for postal_address-0.6.1-py2.7.egg
Algorithm Hash digest
SHA256 0a2d20b42e148e5fbdede3d22f429d6c5d63c769f4a51d2be81d6c73707b05af
MD5 815574e4484aea9909611a7f96610ca0
BLAKE2b-256 6f732f94a6e30adb3e30a3d8236a2418eb67584cc3623712f1a39cb94e43c1b4

See more details on using hashes here.

File details

Details for the file postal_address-0.6.1-py2-none-any.whl.

File metadata

File hashes

Hashes for postal_address-0.6.1-py2-none-any.whl
Algorithm Hash digest
SHA256 ba2eb6f0fda3d41f7762c735e806da97d73f73a31324a6217d41ec201e9d9733
MD5 f1848fcbbb03208fbdc9b5b5bc7f7535
BLAKE2b-256 0f85fdc99fc5492114fab71698e2099de1088a254bf7ed7cc5daa66fa91284e7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page