Skip to main content

Parse ward lists from Electoral Change Orders on

Project description

ECO Parser

Build Status Coverage Status PyPI Version License Python Support Code style: black

Parse ward lists from Electoral Change Orders on

What does this package do?

This package solves a very specific problem.

Local Government electoral divisions/wards in the UK are defined by a piece of legislation called an Electoral Change Order. An Electoral Change Order (ECO) always comes into force the day before the first election which is held using the boundaries it defines. Once this first election has happened, details of the new divisions are fairly easy to get hold of. They are published as machine-readable structured data by organisations like Ordnance Survey and the Office for National Statistics. If you need information about divisions that have already been used for one or more elections, use one of these sources. In that situation, this tool is probably the least useful route to the information you want.

In the case where we need to talk about local electoral divisions which have been defined by an ECO but which have not yet been used in an election (i.e: the ECO has been made, but has not yet come into force), the only source for the division names is the ECO legislation itself.

This package provides some routines to help with parsing ward and division names from the's XML API outputs (which are semi-structured). It is early days, so there are probably going to be some formats we don't support yet. If you find one in new or recent legislation, raise an issue.


If you need the official names of electoral divisions that are already in use, get the data from OS Boundary Line, ONS Geography or a web service like mapit. This information is already published as convenient machine-readable structured data.

If you need the official names of electoral divisions that are not in use yet, this package can help you parse them from legislation.


pip install eco-parser


On the console

eco_parser "" > out.csv

As a library

from eco_parser import EcoParser, ParseError

p = EcoParser("")

    result = p.parse()
except ParseError:


The eco-parser software is made available under the MIT License.

Data Parsed from is covered by the Open Government Licence v3. Your use of the data should comply with it.


Run the tests locally:


Build package locally:


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

eco_parser-0.2.0.tar.gz (5.1 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page