From 0f9f5e1bb4ad0f9364310be6fad8fc74f96cf604 Mon Sep 17 00:00:00 2001 From: ViktorC Date: Tue, 1 Mar 2022 18:22:00 +0000 Subject: [PATCH] Add support for publishing to PyPI --- .github/workflows/build.yml | 56 ++++++++++++++++++++----------------- MANIFEST.in | 4 +++ Makefile | 9 ++++++ README.md | 35 +++++++++++++---------- setup.cfg | 3 +- setup.py | 45 ++++++++++++++++++++++++----- 6 files changed, 103 insertions(+), 49 deletions(-) create mode 100644 MANIFEST.in diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dfe6f41a..66aea68d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,30 +5,34 @@ on: [push] jobs: build-linux: runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ '3.8', '3.9', '3.10' ] + name: Python ${{ matrix.python-version }} steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - name: Install MPI - run: | - sudo apt install -y -q mpich libmpich-dev - - name: Install dependencies - run: | - python -m pip install --upgrade pip - make install - - name: Lint - run: | - make lint - - name: Type-check - run: | - make type-check - - name: Test - run: | - make coverage - - name: Scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install MPI + run: | + sudo apt install -y -q mpich libmpich-dev + - name: Install dependencies + run: | + python -m pip install --upgrade pip + make install + - name: Lint + run: | + make lint + - name: Type-check + run: | + make type-check + - name: Test + run: | + make coverage + - name: Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..45a98a49 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +include README.md +include LICENSE +include MANIFEST.in +include requirements.txt \ No newline at end of file diff --git a/Makefile b/Makefile index 4e48a032..96dd630c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,15 @@ setup: python setup.py install +package: + python setup.py sdist bdist_wheel + +publish-test: + python -m twine upload --repository testpypi dist/* + +publish: + python -m twine upload dist/* + install: pip3 install -r requirements.txt diff --git a/README.md b/README.md index f8fb9d1b..a39a018e 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,18 @@ -# PararealML [![Build Status](https://github.com/ViktorC/PararealML/actions/workflows/build.yml/badge.svg)](https://github.com/ViktorC/PararealML/actions/workflows/build.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=net.viktorc%3Apararealml&metric=alert_status)](https://sonarcloud.io/dashboard?id=net.viktorc%3Apararealml) [![Docs](https://img.shields.io/badge/docs-latest-blue.svg)](https://pararealml.readthedocs.io/en/latest/index.html) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) +# PararealML + +[![Build Status](https://github.com/ViktorC/PararealML/actions/workflows/build.yml/badge.svg)](https://github.com/ViktorC/PararealML/actions/workflows/build.yml) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=net.viktorc%3Apararealml&metric=alert_status)](https://sonarcloud.io/dashboard?id=net.viktorc%3Apararealml) +[![PyPI Version](https://badge.fury.io/py/pararealml.svg)](https://badge.fury.io/py/pararealml) +[![Docs](https://img.shields.io/badge/docs-latest-blue.svg)](https://pararealml.readthedocs.io/en/latest/index.html) +[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) PararealML is a differential equation solver library featuring a [Parareal](https://en.wikipedia.org/wiki/Parareal) framework based on a unified interface for initial value problems and various solvers including a number of machine learning accelerated ones. The library's main purpose is to provide a toolset to investigate the properties of the Parareal algorithm, especially when using machine learning accelerated coarse operators, across various problems. The library's implementation of the Parareal algorithm uses [MPI](https://en.wikipedia.org/wiki/Message_Passing_Interface) via [mpi4py](https://mpi4py.readthedocs.io/en/stable/). ## Main components The library has a modular design to allow for easy extensibility. The main components that enable this are described below. +pararealml + ### Differential equation Differential equations extend the `DifferentialEquation` base class. In PararealML, all differential equations are time-dependent. Moreover, the unknown variables of differential equations are by definition vector-valued to support systems of differential equations. Both ordinary and partial differential equations are supported. @@ -81,15 +89,15 @@ Visualizing the solutions of differential equations is supported by PararealML t A few examples of plots generated by PararealML can be seen below. -

+

lorenz lorenz phase space

-

+

n-body wave 2d surface

-

+

cahn hilliard 3d navier stokes stream

@@ -97,15 +105,12 @@ A few examples of plots generated by PararealML can be seen below. ## Examples The [examples](https://git.ecdf.ed.ac.uk/msc-19-20/s1984842/tree/master/code/python/examples) folder contains a range of different examples of using the library for solving various differential equations both in serial and parallel. The scripts also include examples of using machine learning operators. -## Setup -To use the Parareal operator, an implementation of the MPI standard must be installed and the `mpicc` program must be on the search path as per the [installation guide](https://mpi4py.readthedocs.io/en/stable/install.html#using-pip) of mpi4py. With that set up, the dependencies of the library may be installed by running `make install`. - -## Testing -To perform linting, execute `make lint`. - -The library uses type-hints throughout. For type checking, use the command `make type-check`. - -To run the unit tests, execute `make test`. +## Installation +To install PararealML, an implementation of the MPI standard must be pre-installed and the `mpicc` program must be on the search path as per the [installation guide](https://mpi4py.readthedocs.io/en/stable/install.html#using-pip) of mpi4py. With that set up, the library can be installed by running `pip install pararealml`. -## Running -To run any of the examples from the [examples](https://git.ecdf.ed.ac.uk/msc-19-20/s1984842/tree/master/code/python/examples) folder using an arbitrary number of MPI processes, run `make run p={number of processes} example={name of example file without extension}` (e.g. `make run p=4 example=lorenz_parareal`). +## Development + * To install the dependencies of the library, run `make install` (this requires an existing MPI installation and `mpicc`). + * To perform linting, execute `make lint`. + * The library uses type-hints throughout. For type checking, use the command `make type-check`. + * To run the unit tests, execute `make test`. + * To run any of the examples from the [examples](https://git.ecdf.ed.ac.uk/msc-19-20/s1984842/tree/master/code/python/examples) folder using an arbitrary number of MPI processes, run `make run p={number of processes} example={name of example file without extension}` (e.g. `make run p=4 example=lorenz_parareal`). diff --git a/setup.cfg b/setup.cfg index 0f94f377..1155c2a1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,3 @@ [metadata] -description_file = README.md \ No newline at end of file +long_description = file: README.md +long_description_content_type = text/markdown \ No newline at end of file diff --git a/setup.py b/setup.py index 84d82442..5363bc60 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,45 @@ from setuptools import setup, find_packages setup( - name='PararealML', - version='0.0.1', - description='A parallel-in-time differential equation solver framework ' - 'with machine learning acceleration', + name='pararealml', + version='0.1.0', + description='A machine learning boosted parallel-in-time differential ' + 'equation solver framework', url='https://github.com/ViktorC/PararealML', author='Viktor Csomor', author_email='viktor.csomor@gmail.com', license='MIT', - packages=find_packages(), - include_package_data=True, - zip_safe=False) + install_requires=[ + 'numpy>=1.21', + 'scipy>=1.7.0', + 'matplotlib>=3.5.0', + 'sympy>=1.6', + 'mpi4py>=3.0.0', + 'scikit-learn>=0.24.0', + 'tensorflow>=2.0.0', + 'tensorflow-probability>=0.10.0', + ], + packages=find_packages(exclude=('tests',)), + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: MIT License', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Topic :: Scientific/Engineering', + 'Topic :: Scientific/Engineering :: Artificial Intelligence', + 'Topic :: Scientific/Engineering :: Mathematics', + ], + keywords=[ + 'differential equations', + 'finite difference', + 'parallel-in-time', + 'parareal', + 'machine learning', + 'deep learning', + 'physics-informed neural networks', + 'scientific computing', + ], + include_package_data=True)