This release is a pre-release and may not be stable for production use.
gerrytools
A companion to GerryChain, GerryTools provides tools for retrieving redistricting data, recording and scoring ensembles, comparing districting plans, and producing publication-ready figures and tables. It is developed by the Data and Democracy Research Initiative and distributed under the 3-Clause BSD License.
Installation
GerryTools requires Python 3.11 or newer. Published wheels include the compiled scoring engine; building from source requires a stable Rust toolchain and a C++ compiler.
To install GerryTools from PyPI, run:
pip install gerrytools
The gerrytools.ben API is included in the base installation. To use the Docker-backed ensemble
runners in gerrytools.mgrp, install the optional dependency:
pip install "gerrytools[mgrp]"
The runners also require Docker Desktop, Docker Engine, or another compatible daemon. See the Docker documentation for platform requirements and setup instructions.
Usage
GerryTools is organized into public modules that can be used independently or together:
-
gerrytools.dataretrieves decennial Census and American Community Survey tables, estimates block-level citizen voting-age population, and downloads processed 2020 geographic products. -
gerrytools.plan_comparisoncompares plans by population or area, finds optimal district relabelings, and measures population dispersion. -
gerrytools.plottingprovides composable statistical and geographic plot builders that work with Matplotlib figures and axes. -
gerrytools.colorsprovides named colors, district palettes, color conversion, and Matplotlib and seaborn colormaps. -
gerrytools.mgrpruns Rust ReCom, Forest ReCom, Sequential Monte Carlo, and optimization workflows through a versioned Docker image. -
gerrytools.benrecords GerryChain runs as self-describing BENDL files and reconstructs recorded partitions for lookup, subsampling, and analysis. -
gerrytools.scoringprepares graph and geometry resources once, evaluates plans with the compiled Rust scoring engine, and provides one-shot functions and array formulas. -
gerrytools.latexbuilds LaTeX documents and tables plus TikZ-native paintball and seats-votes figures.
See the module guides for examples and the API reference for signatures and parameters.
Contributing
GerryTools is an active project, and has multiple contributors. If you'd like to contribute, here are a few house rules:
-
Install
taskanduv, then runtask setupfrom the repository root. Usetask --list-allto see the available development workflows. -
Run
task checkbefore opening a pull request. Usetask formatfor Ruff formatting and import sorting,task lintfor Ruff linting,task testfor the test suite, andtask docsto build the documentation locally. -
Write tests. All changes, major or minor, must be accompanied by testing code. Code and tests will be immediately reviewed by Lab maintainers.
-
Test coverage must stay at least the same; this can be checked by running
uv run pytest --cov=gerrytools --cov-report=term-missingafter the tests are added totests/. -
Write documentation. Document public APIs and non-obvious invariants. Prefer clear names and focused functions over comments that merely restate the code.
We look forward to your contributions!
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gerrytools-2.0.0rc1.tar.gz.
File metadata
- Download URL: gerrytools-2.0.0rc1.tar.gz
- Upload date:
- Size: 520.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e624ce6b0efea4f12247d382c88093ef0a421b049f96118ecb5c3e168687a895
|
|
| MD5 |
4adb02907964c19d4724baf2872b27fb
|
|
| BLAKE2b-256 |
bd3a9b0b0529613a49400b5e1b30f520fdea058301fdbdd3d8a7a5c9b5376a10
|
Provenance
The following attestation bundles were made for gerrytools-2.0.0rc1.tar.gz:
Publisher:
release.yml on mggg/gerrytools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gerrytools-2.0.0rc1.tar.gz -
Subject digest:
e624ce6b0efea4f12247d382c88093ef0a421b049f96118ecb5c3e168687a895 - Sigstore transparency entry: 2339728065
- Sigstore integration time:
-
Permalink:
mggg/gerrytools@8b3ab27ba01e39b071082fe35c98e1ffde53340a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mggg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8b3ab27ba01e39b071082fe35c98e1ffde53340a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file gerrytools-2.0.0rc1-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: gerrytools-2.0.0rc1-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
148ada2087a5e578ea72829a1359ae8a7d8b3375712e84c74589c38f66b7adee
|
|
| MD5 |
5c541948e5c7779c5d580495c13af73f
|
|
| BLAKE2b-256 |
cad977eec1f0a69164a2cb9a06e72e0c926ec99c703f5ac0d1056e536275b5ba
|
Provenance
The following attestation bundles were made for gerrytools-2.0.0rc1-cp311-abi3-win_amd64.whl:
Publisher:
release.yml on mggg/gerrytools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gerrytools-2.0.0rc1-cp311-abi3-win_amd64.whl -
Subject digest:
148ada2087a5e578ea72829a1359ae8a7d8b3375712e84c74589c38f66b7adee - Sigstore transparency entry: 2339728074
- Sigstore integration time:
-
Permalink:
mggg/gerrytools@8b3ab27ba01e39b071082fe35c98e1ffde53340a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mggg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8b3ab27ba01e39b071082fe35c98e1ffde53340a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file gerrytools-2.0.0rc1-cp311-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: gerrytools-2.0.0rc1-cp311-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.11+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bb4c8b64be7596919b095a60fe75296c5c765267bd2509201fcc531c34ee8c7
|
|
| MD5 |
f059382cc1bfb5d08459b1a94777158a
|
|
| BLAKE2b-256 |
530141cb224686d446999f96c781bca8743c7f0e8cb69265171c88db8b961577
|
Provenance
The following attestation bundles were made for gerrytools-2.0.0rc1-cp311-abi3-manylinux_2_28_x86_64.whl:
Publisher:
release.yml on mggg/gerrytools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gerrytools-2.0.0rc1-cp311-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
5bb4c8b64be7596919b095a60fe75296c5c765267bd2509201fcc531c34ee8c7 - Sigstore transparency entry: 2339728090
- Sigstore integration time:
-
Permalink:
mggg/gerrytools@8b3ab27ba01e39b071082fe35c98e1ffde53340a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mggg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8b3ab27ba01e39b071082fe35c98e1ffde53340a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file gerrytools-2.0.0rc1-cp311-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: gerrytools-2.0.0rc1-cp311-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.11+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f24b77b8380e6479f70a2234406cf5fbdf5975a8c00830e8786da69a38f66a77
|
|
| MD5 |
1ab3924879aeceb6fcaa05b168cb05ac
|
|
| BLAKE2b-256 |
3ae67754a416018ea00f80de562c105d9c7174b09a0994aca91004d4040b9a26
|
Provenance
The following attestation bundles were made for gerrytools-2.0.0rc1-cp311-abi3-manylinux_2_28_aarch64.whl:
Publisher:
release.yml on mggg/gerrytools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gerrytools-2.0.0rc1-cp311-abi3-manylinux_2_28_aarch64.whl -
Subject digest:
f24b77b8380e6479f70a2234406cf5fbdf5975a8c00830e8786da69a38f66a77 - Sigstore transparency entry: 2339728081
- Sigstore integration time:
-
Permalink:
mggg/gerrytools@8b3ab27ba01e39b071082fe35c98e1ffde53340a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mggg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8b3ab27ba01e39b071082fe35c98e1ffde53340a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file gerrytools-2.0.0rc1-cp311-abi3-macosx_10_13_x86_64.macosx_11_0_arm64.macosx_10_13_universal2.whl.
File metadata
- Download URL: gerrytools-2.0.0rc1-cp311-abi3-macosx_10_13_x86_64.macosx_11_0_arm64.macosx_10_13_universal2.whl
- Upload date:
- Size: 7.3 MB
- Tags: CPython 3.11+, macOS 10.13+ universal2 (ARM64, x86-64), macOS 10.13+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
390b8e8efdddc2bd0bfb1ac0d5daba74abbf471d97ac1c36d1225f83783ab6ad
|
|
| MD5 |
779d85aca3d157ce50093ddad10b6e41
|
|
| BLAKE2b-256 |
c9ceed443bc50bbdef2ab52682de61591b28227e3b85ede5af250a3a15e1f66b
|
Provenance
The following attestation bundles were made for gerrytools-2.0.0rc1-cp311-abi3-macosx_10_13_x86_64.macosx_11_0_arm64.macosx_10_13_universal2.whl:
Publisher:
release.yml on mggg/gerrytools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gerrytools-2.0.0rc1-cp311-abi3-macosx_10_13_x86_64.macosx_11_0_arm64.macosx_10_13_universal2.whl -
Subject digest:
390b8e8efdddc2bd0bfb1ac0d5daba74abbf471d97ac1c36d1225f83783ab6ad - Sigstore transparency entry: 2339728100
- Sigstore integration time:
-
Permalink:
mggg/gerrytools@8b3ab27ba01e39b071082fe35c98e1ffde53340a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mggg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8b3ab27ba01e39b071082fe35c98e1ffde53340a -
Trigger Event:
workflow_dispatch
-
Statement type: