Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Contributors Forks Stargazers Issues MIT License Apache License LinkedIn


Pywr-next

This is repository contains the current work-in-progress for the next major revision to Pywr. It uses Rust as a backend instead of Cython. It is currently not ready for use beyond development and experimentation. Comments and discussions are welcome.

User Guide · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Pywr-1.x is a Python library which utilises Cython for performance. Over time this has resulted in a "core" set of data structures and objects that are written in Cython to gain maximum performance. Cython has the nice benefit of making it easy to extend that core functionality using regular Python. However, the border between what is Python and what is Cython is a bit blurred and not well designed in certain places.

One option for the future development of Pywr (e.g. Pywr-2.x) would be a more explicit separation between the compute "core" and higher level functionality. Rust is a candidate for writing that core largely independent of Python, and possibly offers the benefits of (1) greater performance than Cython, and (2) easier maintenance in the future.

(back to top)

Requirements

Any major revision to Pywr will have the following feature requirements:

  • Retain the "Parameter" system from Pywr-1.x - this is core functionality that makes Pywr really flexible.
  • Extendable in Python space.
  • An improved approach for outputting data and metrics.
  • Better error handling.
  • Cross-platform.
  • Faster!
  • Strong input file (JSON) schema.

Built With

Rust Python

(back to top)

Getting started

Installing pre-compiled wheels

See instructions in the Pywr book.

Compiling from source

This repository contains a version of Clp using Git submodules. In order to build those submodules must be initialised first.

git submodule init
git submodule update

Rust is required for installation of the Python extension. To create a Python development installation requires first compiling the Rust library and then the Python extension. The following example uses a virtual environment to install the Python dependencies, compile the Pywr extension and run the Pywr Python CLI.

python -m venv .venv # create a new virtual environment
source .venv/bin/activate # activate the virtual environment (linux)
# .venv\Scripts\activate # activate the virtual environment (windows)
pip install maturin  # install maturin for building the Python extension
maturin develop # compile the Pywr Python extension
python -m pywr  # run the Pywr Python CLI

(back to top)

Usage

Rust CLI

A basic command line interface is included such that you can use this version of Pywr without Python. This CLI is in the pywr-cli crate.

To see the CLI commands available run the following:

cargo run -p pywr-cli -- --help

To run a Pywr v2 model use the following:

cargo run -p pywr-cli -- run tests/models/simple1.json

Python CLI

If the Python extension has been compiled using the above instructions a model can be run using the basic Python CLI.

python -m pywr run tests/models/simple1.json

Porting a Pywr v1.x model to v2.x

This version of Pywr is not backward compatible with Pywr v1.x. One of the major reasons for this version is the lack of a strong schema in the Pywr v1.x JSON files. Pywr v2.x uses an updated JSON schema that is defined in this repository. Therefore, v1.x JSON files must be converted to the v2.x JSON schema. This conversion can be undertaken manually, but there is also a work-in-progress conversion tool. The conversion tool uses a v1.x schema defined in the pywr-schema project.

Please note that conversion from Pywr v1.x to v2.x is experimental and not all features of Pywr are implemented in pywr-schema or have been implemented in Pywr v2.x yet. Due to the changes between these versions it is very likely an automatic conversion will not completely convert your model, and it WILL require manual testing and checking.

cargo run --no-default-features -- convert /path/to/my/v1.x/model.json

Feedback on porting models is very welcome, so please open an issue with any questions or problems.

(back to top)

Crates

This repository contains the following crates:

Pywr-core

A low-level Rust library for constructing network models. This crate interfaces with linear program solvers.

Feature flags:

Feature Description Default
pyo3 Enable the Python bindings. True
highs Enable the HiGHS LP solver. False
ipm-ocl Enable the OpenCL IPM solver (requires nightly). False
ipm-simd Enable the AVX IPM solver (requires nightly). False
cbc Enable the CBC MILP solver. False

Pywr-schema

A Rust library for validating Pywr JSON files against a schema, and then building a model from the schema using pywr-core.

Feature flags:

Feature Description Default
core Enable building models from the schema with pywr-core. This feature is enabled by default, but requires a lot of dependencies. If you only require schema validation and manipulation consider building this crate with default-features = false True
pyo3 Enable the Python bindings. True
highs Enable the HiGHS LP solver. False
ipm-ocl Enable the OpenCL IPM solver (requires nightly). False
ipm-simd Enable the AVX IPM solver (requires nightly). False
cbc Enable the CBC MILP solver. False

Pywr-cli

A command line interface for running Pywr models.

Pywr-python

A Python extension (and package) for constructing and running Pywr models.

Roadmap

  • Proof-of-concept - demonstrate the benefits of the RIIR approach.
  • Redesign of outputs & metrics.
  • Redesign of variable API for integration with external optimisation algorithms.
  • Implement outstanding Parameters from Pywr v1.x
  • Design & implement Python API using Rust extension.
  • Release Pywr v2.x beta

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the Apache 2.0 or MIT License. See LICENSE.txt for more information.

(back to top)

Contact

James Tomlinson - tomo.bbe@gmail.com

Project Link: https://github.com/pywr/pywr-next

(back to top)

Copyright (C) 2020-2023 James Tomlinson Associates Ltd.

Metadata

Release files for pywr 2.0.0b11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pywr 2.0.0b11
File Size Uploaded
pywr-2.0.0b11.tar.gz 8.1 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for pywr 2.0.0b11
File
pywr-2.0.0b11-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
pywr-2.0.0b11-cp314-cp314t-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64 Details
pywr-2.0.0b11-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details
pywr-2.0.0b11-cp314-cp314t-macosx_10_12_x86_64.whl CPython 3.14 CPython 3.14 free-threading macOS 10.12+ x86-64 Details
pywr-2.0.0b11-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
pywr-2.0.0b11-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details
pywr-2.0.0b11-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
pywr-2.0.0b11-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 143.9 MB

Release files / pywr-2.0.0b11.tar.gz

Download URL pywr-2.0.0b11.tar.gz
Size 8.1 MB
Tags Source
SHA-256 checksum
How to use checksums
63debee98ee61c4e2114fdc52afe7f6dbb8b284487e2e5fbc858e7485f8d4417
BLAKE2b-256 checksum
How to use checksums
675d60454c37702cc0ec965e569a282b7f9f7239d3b40caedfb3837a753e360a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 30, 2026.

Transparency log

Release files / pywr-2.0.0b11-cp314-cp314t-win_amd64.whl

Download URL pywr-2.0.0b11-cp314-cp314t-win_amd64.whl
Size 17.4 MB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
5e96979c00d346dce27a9c75918fcf0a08f5481f3e245cd4a6f1e071d9f8a377
BLAKE2b-256 checksum
How to use checksums
270bd8e57fdb859351b8abdd495f2c1162f0b366b4d9fd18cd36fdba17967653
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 30, 2026.

Transparency log

Release files / pywr-2.0.0b11-cp314-cp314t-manylinux_2_28_x86_64.whl

Download URL pywr-2.0.0b11-cp314-cp314t-manylinux_2_28_x86_64.whl
Size 18.5 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
dfedf3ec026244191cdc405d7b5943ffce4fd57dd46a69b98687f73ced2715ca
BLAKE2b-256 checksum
How to use checksums
1c84dec8878edcedd409197f2b2a8d2fa589a7f2606eef9ee7c7b0481c8dc22d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 30, 2026.

Transparency log

Release files / pywr-2.0.0b11-cp314-cp314t-macosx_11_0_arm64.whl

Download URL pywr-2.0.0b11-cp314-cp314t-macosx_11_0_arm64.whl
Size 15.5 MB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bab5310ce7f438815a48ee1a6b21c3add8edb746a9fd1527e3c37da7b9dd364d
BLAKE2b-256 checksum
How to use checksums
84ff79472fca581c173ef63c2d124a8f5d822fcc6f5671b859b7871a1b3400de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 30, 2026.

Transparency log

Release files / pywr-2.0.0b11-cp314-cp314t-macosx_10_12_x86_64.whl

Download URL pywr-2.0.0b11-cp314-cp314t-macosx_10_12_x86_64.whl
Size 16.5 MB
Tags CPython 3.14 CPython 3.14 free-threading macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
f89dbe61929e1abcb4017f30f397e6a0ccdca0a97df1bab86402b7230e49298b
BLAKE2b-256 checksum
How to use checksums
3ab402c1e9a1e031f68a5c83f43976bedc76d9cbee37dbc5c38b2064976d1a59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 30, 2026.

Transparency log

Release files / pywr-2.0.0b11-cp310-abi3-win_amd64.whl

Download URL pywr-2.0.0b11-cp310-abi3-win_amd64.whl
Size 17.4 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
7bb55c3c46085469e4002ae4ec1ab379f375a986c56069d915d9bdb9a2eaecad
BLAKE2b-256 checksum
How to use checksums
52554c0142d45d70e80071249cbaa42a800e5b8bb882653f6196766ddce7d283
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 30, 2026.

Transparency log

Release files / pywr-2.0.0b11-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL pywr-2.0.0b11-cp310-abi3-manylinux_2_28_x86_64.whl
Size 18.5 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
225eeb1d6a6604a002421ea8d5bfc7b3d4b8fe0861c3e5b6a6a3204bd863f41a
BLAKE2b-256 checksum
How to use checksums
a48fd1fe90c36ad66d39c8bf0749714b5032e20d1000cc9c18e874459191935a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 30, 2026.

Transparency log

Release files / pywr-2.0.0b11-cp310-abi3-macosx_11_0_arm64.whl

Download URL pywr-2.0.0b11-cp310-abi3-macosx_11_0_arm64.whl
Size 15.6 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d20091af77a6ac7c4b26a3b905c322bb05e2f8bbe4b64b4a276f30a8ccb5c90a
BLAKE2b-256 checksum
How to use checksums
2ac7e1a247f4318b7b5dbf9cd95c7320e33e4765ecaef152a6b5a3d975e581b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 30, 2026.

Transparency log

Release files / pywr-2.0.0b11-cp310-abi3-macosx_10_12_x86_64.whl

Download URL pywr-2.0.0b11-cp310-abi3-macosx_10_12_x86_64.whl
Size 16.5 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
bec3846f56ccdb7f96dd60ad7665fd09e1232be21757b0af00cab6e818f151ee
BLAKE2b-256 checksum
How to use checksums
3a73ebd4ef3d7139b035d01ba4aa15284f9954b359fc0691ba5e3f6ebd0599b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.0b11 This release

9 release files

1.29.0

9 release files

1.28.0

9 release files

1.27.4

9 release files

1.27.2

7 release files

1.27.1

7 release files

1.26.0

9 release files

1.25.0

9 release files

1.24.0

9 release files

1.23.0

9 release files

1.22.1

9 release files

1.19.0

9 release files

1.17.2

9 release files

1.17.0

6 release files

1.15.1

6 release files

1.15.0

6 release files

1.14.0

6 release files

1.13.1

6 release files

1.13.0

6 release files

1.12.0

5 release files

1.9.0

7 release files

1.8.0

7 release files

1.7.2

7 release files

1.7.1

4 release files

1.7.0

7 release files

1.6.0

7 release files

1.5.0

7 release files

1.4.0

5 release files

1.3.0

5 release files

1.2.0

5 release files

1.1.0

2 release files

1.0.0

3 release files

0.5.1

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page