Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 2.0.1 instead.
Reason given by maintainers: Some last-minute, breaking API changes were not merged into the release. Version 2.0.1 has the intended API

gerrytools

tests PyPI version docs website Code style: Ruff

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.data retrieves decennial Census and American Community Survey tables, estimates block-level citizen voting-age population, and downloads processed 2020 geographic products.

  • gerrytools.plan_comparison compares plans by population or area, finds optimal district relabelings, and measures population dispersion.

  • gerrytools.plotting provides composable statistical and geographic plot builders that work with Matplotlib figures and axes.

  • gerrytools.colors provides named colors, district palettes, color conversion, and Matplotlib and seaborn colormaps.

  • gerrytools.mgrp runs Rust ReCom, Forest ReCom, Sequential Monte Carlo, and optimization workflows through a versioned Docker image.

  • gerrytools.ben records GerryChain runs as self-describing BENDL files and reconstructs recorded partitions for lookup, subsampling, and analysis.

  • gerrytools.scoring prepares graph and geometry resources once, evaluates plans with the compiled Rust scoring engine, and provides one-shot functions and array formulas.

  • gerrytools.latex builds 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:

  1. Install task and uv, then run task setup from the repository root. Use task --list-all to see the available development workflows.

  2. Run task check before opening a pull request. Use task format for Ruff formatting and import sorting, task lint for Ruff linting, task test for the test suite, and task docs to build the documentation locally.

  3. Write tests. All changes, major or minor, must be accompanied by testing code. Code and tests will be immediately reviewed by Lab maintainers.

  4. Test coverage must stay at least the same; this can be checked by running uv run pytest --cov=gerrytools --cov-report=term-missing after the tests are added to tests/.

  5. 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

gerrytools-2.0.0.tar.gz (520.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

gerrytools-2.0.0-cp311-abi3-win_amd64.whl (3.7 MB view details)

Uploaded CPython 3.11+Windows x86-64

gerrytools-2.0.0-cp311-abi3-manylinux_2_28_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ x86-64

gerrytools-2.0.0-cp311-abi3-manylinux_2_28_aarch64.whl (4.2 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

gerrytools-2.0.0-cp311-abi3-macosx_10_13_x86_64.macosx_11_0_arm64.macosx_10_13_universal2.whl (7.3 MB view details)

Uploaded CPython 3.11+macOS 10.13+ universal2 (ARM64, x86-64)macOS 10.13+ x86-64macOS 11.0+ ARM64

File details

Details for the file gerrytools-2.0.0.tar.gz.

File metadata

  • Download URL: gerrytools-2.0.0.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

Hashes for gerrytools-2.0.0.tar.gz
Algorithm Hash digest
SHA256 94ece822781585171ed7a1fcf9d83b9e143c8672204fb668a8a06be1c05c8ff8
MD5 1e7a05b095e5aa9f8718f924be23a5b7
BLAKE2b-256 63e547f06bba0150374dbd14bab6af7d9b2e53a85b9b0458d60eb069bd64134b

See more details on using hashes here.

Provenance

The following attestation bundles were made for gerrytools-2.0.0.tar.gz:

Publisher: release.yml on mggg/gerrytools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gerrytools-2.0.0-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: gerrytools-2.0.0-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

Hashes for gerrytools-2.0.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a2e7d8370944df54a684786118f25e6fba7367d6a2669967fb31bc5905f0e100
MD5 4cacb137cf09cc37222291235c58fb56
BLAKE2b-256 2b120403733d19f296bdb7ce1282cdd002ce0f324d2bb268909a984b659b4773

See more details on using hashes here.

Provenance

The following attestation bundles were made for gerrytools-2.0.0-cp311-abi3-win_amd64.whl:

Publisher: release.yml on mggg/gerrytools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gerrytools-2.0.0-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for gerrytools-2.0.0-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4f5e04e128fce46bc61e11c9079448a4ff161e3e3d02d0092609bcffe8331700
MD5 98d08597105251dcfae4766ea9dc701a
BLAKE2b-256 79705c76302ab200e2c98c6bc73923840fdb55d13723b6ad05ee00ed525b9464

See more details on using hashes here.

Provenance

The following attestation bundles were made for gerrytools-2.0.0-cp311-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on mggg/gerrytools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gerrytools-2.0.0-cp311-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for gerrytools-2.0.0-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 54c3647ac9091655ab1e92bded883036c2a5f4f329736596a924b1a02ed75f23
MD5 c956db85a5c5043788558f444ebc7120
BLAKE2b-256 bf13cfa609e8d1144caf1f18cbf490ffb7fffc737abc2af1a5a32a25bbae6dec

See more details on using hashes here.

Provenance

The following attestation bundles were made for gerrytools-2.0.0-cp311-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on mggg/gerrytools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gerrytools-2.0.0-cp311-abi3-macosx_10_13_x86_64.macosx_11_0_arm64.macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for gerrytools-2.0.0-cp311-abi3-macosx_10_13_x86_64.macosx_11_0_arm64.macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 e50f9c8ae1c765f37b722d1c1415ee7e97f3025b57cd37e98797d3f2fcf5ab58
MD5 4b5eff35ed8e8e18734662a46aa6e17a
BLAKE2b-256 9355ef02e5cb179c84f4866e27fc5bd028163b52f674bc6b27f52c4ef946a59d

See more details on using hashes here.

Provenance

The following attestation bundles were made for gerrytools-2.0.0-cp311-abi3-macosx_10_13_x86_64.macosx_11_0_arm64.macosx_10_13_universal2.whl:

Publisher: release.yml on mggg/gerrytools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2.0.1

5 files

This release

2.0.0 This release

5 files

1.2.1

2 files

1.2.0

2 files

1.1.1

2 files

1.1.0

2 files

1.0.2

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page