pode
Summary
Pode is a Python library that implements an algorithm of Hert, S. and Lumelsky, V., 1998 for a polygon decomposition into separate parts depending on the area requirements.
Main features are
- all calculations are robust for floating point numbers
& precise for integral numbers (like
int); - support for partition of convex/nonconvex polygons with/without holes;
- support for anchored partition, free partition, and a mixture of both where anchored polygon partition requires the resulting polygon parts to contain specified points called "anchors" or "sites", and free partition does not have any constraints on the resulting geometries;
- most of the code is covered with property-based tests.
In what follows, python is an alias for python3.11
or any later version.
Installation
Install the latest pip & setuptools packages versions
python -m pip install --upgrade pip setuptools
User
Download and install the latest stable version from PyPI repository
python -m pip install --upgrade pode
Developer
Download the latest version from GitHub repository
git clone https://github.com/GeorgySk/pode.git
cd pode
Install
poetry install
Usage
>>> from pode import divide, Contour, Point, Polygon, Requirement
>>> contour = Contour([Point(0, 0), Point(1, 0), Point(1, 1), Point(0, 1)])
>>> polygon = Polygon(contour)
>>> requirements = [Requirement(0.5), Requirement(0.5, point=Point(1, 1))]
>>> parts = divide(polygon, requirements)
>>> parts[0].area == parts[1].area < polygon.area
True
>>> Point(1, 1) in parts[1]
True
Currently, the algorithm uses constrained Delaunay triangulation to form convex
parts which are used internally for a convex-polygon partition.
This triangulation, however, affects the resulting partition. The resulting
parts can have zigzag pattern separating different parts. In this way, the
solution can be far from being optimal in sense of the number of sides of the
resulting polygons. Alternatively, we implemented a helper function that would
join neighboring triangles if they form a larger convex part. It can be
imported as from pode import joined_constrained_delaunay_triangles and used
as divide(polygon, requirements, joined_constrained_delaunay_triangles). But,
in the future, a better algorithm should be implemented, like
Greene, D.H., 1983
or Chazelle, B. and Dobkin, D., 1979.
Development
Bumping version
Preparation
Install bump-my-version.
Pre-release
Choose which version number category to bump following semver specification.
Test bumping version
bump-my-version bump --dry-run --verbose $CATEGORY
where $CATEGORY is the target version number category name, possible
values are patch/minor/major.
Bump version
bump-my-version bump --verbose $CATEGORY
This will set version to major.minor.patch-alpha.
Release
Test bumping version
bump-my-version bump --dry-run --verbose release
Bump version
bump-my-version bump --verbose release
This will set version to major.minor.patch.
Publishing
Pushing a final release tag vX.Y.Z runs the CI publish jobs, which upload
the package to PyPI and push
the prod Docker image to the GitHub container registry (GHCR).
Pre-release tags such as vX.Y.Z-alpha are not published.
bump-my-version bump release commits and tags the release, so push both:
git push --follow-tags
One-time setup:
- GitHub: on PyPI, add a
Trusted Publisher
for this repository with workflow
ci.ymland environmentpypi. - GitHub: add a
CODECOV_TOKENrepository secret from Codecov.
Linting, formatting and type checking
Ruff is used for linting
(installed with the dev dependency group).
Check code
ruff check .
Fix automatically fixable issues
ruff check --fix .
mypy checks types in strict mode
(configured in pyproject.toml)
mypy .
The package ships a py.typed marker, so projects that use it get its type
hints too.
To run these checks (Ruff and mypy) automatically on each commit,
install the pre-commit hooks
(once, after the repository has been initialized with git init)
pre-commit install
Running tests
Install the project with the dev dependency group (pytest, pytest-cov,
Hypothesis)
poetry install --with dev
Run the tests
poetry run pytest
Run the tests with a coverage report, as CI does
poetry run pytest --cov --cov-report=term
Inside the dev container, dependencies are already installed into the
container's Python, so poetry run can be dropped: pytest.
Inside a Docker container (the default IMAGE_TYPE=dev image includes the
dev group)
docker compose run --rm --entrypoint pytest pode
Updating from the template
This project was generated from the copier-pypackage template. To pull in a newer release of the template (CI, tooling and configuration fixes), commit your changes, then run
copier update --defaults
Copier merges the template's changes into the project and keeps yours.
Review them with git diff, resolve any conflict markers and commit.
CHANGES.rst and pode/__init__.py are never touched by
updates, and .copier-answers.yml must not be edited by hand.
The Template update workflow (.github/workflows/template-update.yml) does
this every Monday and opens a pull request when there is a new template
release (run it by hand from the Actions tab). Conflicting changes are
committed with conflict markers in a draft pull request: resolve them on its
branch. There is one pull request per release, so closing one skips that
release. The template must be at a URL GitHub can clone (the _src_path in
.copier-answers.yml).
With the default GITHUB_TOKEN, enable "Allow GitHub Actions to create and
approve pull requests" (Settings → Actions → General). Even then the pull
request doesn't run CI, and updates that change .github/workflows can't be
pushed. To avoid both, add a TEMPLATE_UPDATE_TOKEN repository secret: a
fine-grained personal access token for this repository with read and write
access to Contents, Pull requests and Workflows.
Metadata
Release files for pode 0.4.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pode-0.4.9.tar.gz | 21.5 kB | With provenance | Details for pode-0.4.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pode-0.4.9-py3-none-any.whl | Python 3 | none | any | Details for pode-0.4.9-py3-none-any.whl |
Total release size: 39.1 kB
Release files / pode-0.4.9.tar.gz
| Download URL | pode-0.4.9.tar.gz |
|---|---|
| Size | 21.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fda5ede71421efdf7368ebdb43ebc19cccc6973c5eb14264b3f1feb7f83d40b
|
|
BLAKE2b-256 checksum How to use checksums |
20a1be7c0ff0f22e3be18ea6d9947b6e4016418353f80b1411dfc2daf0f361a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logRelease files / pode-0.4.9-py3-none-any.whl
| Download URL | pode-0.4.9-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a45a4cef6cab69f49b0d8fc9dc5c60a1759ccaf7dd33999820b0c2c3170f781e
|
|
BLAKE2b-256 checksum How to use checksums |
95282ccafbecbdceadb56991bc83eeebcba38543dad539007006edcdf6a9daf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logSecurity for pode 0.4.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pode-0.4.9.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.