Metadata-Version: 2.4
Name: polyshell
Version: 0.2.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Requires-Dist: pytest>=8.3.5 ; extra == 'dev'
Requires-Dist: pytest-cases>=3.9.1 ; extra == 'dev'
Requires-Dist: pre-commit ; extra == 'dev'
Requires-Dist: numpy>=2.2.6 ; extra == 'dev'
Requires-Dist: shapely>=2.0.7 ; extra == 'dev'
Requires-Dist: pytest>=8.3.5 ; extra == 'tests'
Requires-Dist: pytest-cases>=3.9.1 ; extra == 'tests'
Requires-Dist: numpy>=2.2.6 ; extra == 'tests'
Requires-Dist: shapely>=2.0.7 ; extra == 'tests'
Requires-Dist: numpy>=2.2.6 ; extra == 'readers'
Requires-Dist: shapely>=2.0.7 ; extra == 'readers'
Requires-Dist: matplotlib>=3.10.5 ; extra == 'cli'
Requires-Dist: typer>=0.17.4 ; extra == 'cli'
Provides-Extra: dev
Provides-Extra: tests
Provides-Extra: readers
Provides-Extra: cli
License-File: LICENSE
Summary: A high-performance coverage-preserving polygon reduction library for Python, written in Rust
Author-email: Niall Oswald <niall.oswald20@imperial.ac.uk>, Kenneth Martin <k.martin24@imperial.ac.uk>, Jo Wayne Tan <jo.tan17@imperial.ac.uk>
License: Apache License Version 2.0
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: repository, https://github.com/ecmwf/polyshell
Project-URL: documentation, https://ecmwf.github.io/PolyShell/
Project-URL: issues, https://github.com/ecmwf/polyshell/issues

# PolyShell

<div align="center">

[![Static Badge](https://github.com/ecmwf/codex/raw/refs/heads/main/ESEE/foundation_badge.svg)](https://github.com/ecmwf/codex/raw/refs/heads/main/ESEE)
[![Static Badge](https://github.com/ecmwf/codex/raw/refs/heads/main/Project%20Maturity/emerging_badge.svg)](https://github.com/ecmwf/codex/raw/refs/heads/main/Project%20Maturity)
[![PyPI - Version](https://img.shields.io/pypi/v/polyshell.svg)](https://pypi.org/project/polyshell/)
![Build Status](https://img.shields.io/github/actions/workflow/status/ECMWFCode4Earth/PolyShell/CI.yml)
![Docs Build Status](https://img.shields.io/github/actions/workflow/status/ECMWFCode4Earth/PolyShell/publish-docs.yml?label=docs)
</div>

A high-performance coverage-preserving polygon reduction library for Python, written in Rust.

> \[!IMPORTANT\]
> This software is **Emerging** and subject to ECMWF's guidelines on [Software Maturity](https://github.com/ecmwf/codex/raw/refs/heads/main/Project%20Maturity).

<p align="center">
  <picture align="center">
    <source media="(prefers-color-scheme: dark)" srcset="docs/assets/Benchmark-Dark.svg">
    <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ecmwf/PolyShell/refs/heads/main/docs/assets/Benchmark-Dark.svg">
    <img alt="Shows a bar chart with benchmark results." src="https://raw.githubusercontent.com/ecmwf/PolyShell/refs/heads/main/docs/assets/Benchmark-Light.svg">
  </picture>
</p>

<p align="center">
  <i>Time to reduce a 50,000 point polygon by 90%.</i>
</p>

_This project was developed as part of ECMWF's Code4Earth initiative by Niall Oswald, Kenneth Martin and Jo Wayne Tan._

---

## Highlights

- ✅ Guarantees encapsulation of the initial polygon.
- 🔥 Rust-powered performance.
- 🧩 A simple Python API to access all reduction methods and modes.
- 🌍 Seamlessly integration with [NumPy](https://numpy.org/) and [Shapely](https://shapely.readthedocs.io/).
- 📏 Tunable accuracy and reduction rates.
- 🐍 Python and [PyPy](https://pypy.org/) compatible.

PolyShell is supported by the [ECMWF](https://www.ecmwf.int/) through
the [Code for Earth programme](https://codeforearth.ecmwf.int/).

---

## Installation

PolyShell is available on [PyPI](https://pypi.org/) for easy installation:

```console
$ pip install polyshell
```

PolyShell can also be built from source using [maturin](https://www.maturin.rs/). See the
guide [here](https://ecmwf.github.io/PolyShell/user-guide/installation/).

---

## Example

All of PolyShell's reduction algorithms are accessible through `reduce_polygon`.

```python
from polyshell import reduce_polygon

original = [
    (0.0, 0.0),
    (0.0, 1.0),
    (0.5, 0.5),
    (1.0, 1.0),
    (1.0, 0.0),
    (0.0, 0.0),
]

reduced = reduce_polygon(original, "auto", method="vw")
```

For all the available options, see
the [full list of features](https://ecmwf.github.io/PolyShell/user-guide/features/).

---

## Learn more

For more information see the [guide](https://ecmwf.github.io/PolyShell/user-guide/).

