Skip to content
forked from pywr/pywr-next

An experimental repository exploring ideas for a major revision to Pywr using Rust as a backend.

License

Notifications You must be signed in to change notification settings

Jmiguel17/pywr-next

 
 

Repository files navigation

Pywr-next

This repository is an experimental repository exploring ideas for a major revision to Pywr using Rust as a backend. It is currently not ready for use beyond development and experimentation. Comments and discussions are welcome.

Motivation

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.

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.

Development installation instructions

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. To create a development installation requires first compiling the Rust library and then installing the Python package in editable model.

maturin develop
pip install -e .

Alternatively use the develop.sh script to run the above two commands.

Once this is complete the following will run a simple test script of some basic models via Python.

python -m pywr

Copyright (C) 2020 James Tomlinson Associates Ltd.

About

An experimental repository exploring ideas for a major revision to Pywr using Rust as a backend.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 82.7%
  • Python 17.3%