Skip to content

Commit 814f5d9

Browse files
Merge pull request #1027 from tlestang/develop
Automated release process
2 parents 2ac166e + 93bb50d commit 814f5d9

File tree

9 files changed

+218
-30
lines changed

9 files changed

+218
-30
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Build and deployment
2+
3+
on:
4+
push:
5+
branches: master
6+
7+
jobs:
8+
build-wheels:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
os: [macos-latest]
13+
python-version: [3.6, 3.7]
14+
include:
15+
- os: ubuntu-latest
16+
python-version: 3.8
17+
- os: windows-latest
18+
python-version: 3.6
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set up Python
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Build manylinux Python wheels
27+
if: matrix.os == 'ubuntu-latest'
28+
uses: './build_manylinux_wheels'
29+
30+
- name: Install standard python dependencies
31+
if: matrix.os != 'ubuntu-latest'
32+
run: |
33+
python -m pip install --upgrade pip wheel setuptools
34+
35+
- name: Install build-time deps for MacOS
36+
if: matrix.os == 'macos-latest'
37+
run: |
38+
brew update
39+
brew install graphviz
40+
brew install sundials
41+
git clone https://github.com/pybind/pybind11.git
42+
43+
- name: Build wheels for MacOS and Windows
44+
if: matrix.os != 'ubuntu-latest'
45+
run: |
46+
python -m pip wheel . -w dist/ --no-deps
47+
48+
- name: Upload wheels
49+
uses: actions/upload-artifact@v1
50+
with:
51+
name: dist
52+
path: dist
53+
54+
55+
publish-pyi:
56+
name: Upload wheels to PyPI
57+
needs: build-wheels
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Download wheels
61+
uses: actions/download-artifact@v1
62+
with:
63+
name: dist
64+
65+
- name: Publish wheels
66+
uses: pypa/gh-action-pypi-publish@master
67+
with:
68+
user: __token__
69+
password: ${{ secrets.TESTPYPI_TOKEN }}
70+
repository_url: https://test.pypi.org/legacy/

.gitignore

+6-2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ sundials4
8080
sundials-*
8181
SuiteSparse-*
8282
build_sundials
83+
KLU_module_deps
8384

8485
# downloads
8586
*.gz
@@ -96,6 +97,9 @@ cmake_install.cmake
9697

9798

9899
third-party/pybind11
100+
pybind11/
101+
102+
setup.log
103+
104+
99105

100-
# Build dependencies/
101-
KLU_module_deps

build_manylinux_wheels/Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM quay.io/pypa/manylinux2010_x86_64:2020-05-29-c06f15c
2+
3+
ENV PLAT manylinux2010_x86_64
4+
5+
RUN yum -y remove cmake
6+
RUN yum -y install wget openblas-devel
7+
RUN /opt/python/cp37-cp37m/bin/pip install --upgrade pip cmake
8+
RUN ln -s /opt/python/cp37-cp37m/bin/cmake /usr/bin/cmake
9+
10+
COPY install_sundials.sh /install_sundials.sh
11+
RUN chmod +x /install_sundials.sh
12+
COPY entrypoint.sh /entrypoint.sh
13+
RUN chmod +x /entrypoint.sh
14+
15+
RUN ./install_sundials.sh
16+
17+
ENTRYPOINT ["/entrypoint.sh"]

build_manylinux_wheels/action.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# action.yml
2+
# Based on RalfG/python-wheels-manylinux-build/action.yml by Ralf Gabriels
3+
4+
name: 'Python wheels manylinux build'
5+
author: 'Thibault Lestang'
6+
description: 'Build manylinux wheels for PyBaMM'
7+
inputs:
8+
python-versions:
9+
description: 'Python versions to target, space-separated'
10+
required: true
11+
default: 'cp36-cp36m cp37-cp37m'
12+
13+
runs:
14+
using: 'docker'
15+
image: 'Dockerfile'
16+
args:
17+
- ${{ inputs.python-versions }}

build_manylinux_wheels/entrypoint.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
set -e -x
3+
4+
# CLI arguments
5+
PY_VERSIONS=$1
6+
7+
git clone https://github.com/pybind/pybind11.git /github/workspace/pybind11
8+
# Compile wheels
9+
arrPY_VERSIONS=(${PY_VERSIONS// / })
10+
for PY_VER in "${arrPY_VERSIONS[@]}"; do
11+
# Update pip
12+
/opt/python/"${PY_VER}"/bin/pip install --upgrade --no-cache-dir pip
13+
14+
# Build wheels
15+
/opt/python/"${PY_VER}"/bin/pip wheel /github/workspace/ -w /github/workspace/wheelhouse/ --no-deps || { echo "Building wheels failed."; exit 1; }
16+
done
17+
ls -l /github/workspace/wheelhouse/
18+
19+
# Bundle external shared libraries into the wheels
20+
for whl in /github/workspace/wheelhouse/*-linux*.whl; do
21+
auditwheel repair "$whl" --plat "${PLAT}" -w /github/workspace/dist/ || { echo "Repairing wheels failed."; auditwheel show "$whl"; exit 1; }
22+
done
23+
24+
echo "Succesfully built wheels:"
25+
ls -l /github/workspace/dist/
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
mkdir /deps
4+
wget https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/v5.7.2.tar.gz .
5+
wget https://computing.llnl.gov/projects/sundials/download/sundials-5.3.0.tar.gz .
6+
tar -xf v5.7.2.tar.gz --directory /deps
7+
tar -xf sundials-5.3.0.tar.gz --directory /deps
8+
rm v5.7.2.tar.gz
9+
rm sundials-5.3.0.tar.gz
10+
11+
SUITESPARSE_DIR=/deps/SuiteSparse-5.7.2
12+
SUNDIALS_DIR=/deps/sundials-5.3.0
13+
14+
for dir in SuiteSparse_config AMD COLAMD BTF KLU
15+
do
16+
cd $SUITESPARSE_DIR/$dir;
17+
make library
18+
make install INSTALL=/usr
19+
cd ../
20+
done
21+
22+
KLU_INCLUDE_DIR=/usr/include
23+
KLU_LIBRARY_DIR=/usr/lib
24+
mkdir -p /deps/build_sundials
25+
cd /deps/build_sundials
26+
cmake -DLAPACK_ENABLE=ON\
27+
-DSUNDIALS_INDEX_SIZE=32\
28+
-DEXAMPLES_ENABLE:BOOL=OFF\
29+
-DKLU_ENABLE=ON\
30+
-DKLU_INCLUDE_DIR=$KLU_INCLUDE_DIR\
31+
-DKLU_LIBRARY_DIR=$KLU_LIBRARY_DIR\
32+
-DCMAKE_INSTALL_PREFIX=/usr\
33+
$SUNDIALS_DIR
34+
make install
35+

docs/index.rst

+10
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,20 @@ PyBaMM is available on GNU/Linux, MacOS and Windows.
2222
Using pip
2323
----------
2424

25+
GNU/Linux and Windows
26+
~~~~~~~~~~~~~~~~~~~~~~
27+
2528
.. code:: bash
2629
2730
pip install pybamm
2831
32+
macOS
33+
~~~~~~~~~~~~~~~~~~~~~~
34+
35+
.. code:: bash
36+
37+
brew install sundials && pip install pybamm
38+
2939
Using conda
3040
-------------
3141
PyBaMM is available as a conda package through the conda-forge channel.

docs/install/GNU-linux.rst

+37-27
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
GNU-Linux & MacOS
2-
======================
1+
===================
2+
GNU-Linux & MacOS
3+
===================
34

45
.. contents::
56

67
Prerequisites
7-
---------------
8+
=============
89

910
To use and/or contribute to PyBaMM, you must have Python 3.6 or 3.7
1011
installed (note that 3.8 is not yet supported).
@@ -37,10 +38,12 @@ then follow instructions in link on adding brew to path, and run
3738
brew install python3
3839
3940
Install PyBaMM
40-
-----------------
41+
==============
42+
43+
.. _user-install-label:
4144

4245
User install
43-
~~~~~~~~~~~~
46+
------------
4447

4548
We recommend to install PyBaMM within a virtual environment, in order
4649
not to alter any distribution python files. To create a virtual
@@ -64,10 +67,20 @@ the environment and go back to your original system, just type:
6467
6568
deactivate
6669
67-
PyBaMM can be installed via pip:
70+
PyBaMM can be installed via pip. On macOS, it is necessary to install the `SUNDIALS <https://computing.llnl.gov/projects/sundials/>`__
71+
library beforehand.
72+
73+
GNU/Linux and Windows
74+
~~~~~~~~~~~~~~~~~~~~~
75+
.. code:: bash
76+
77+
pip install pybamm
6878
79+
macOS
80+
~~~~~
6981
.. code:: bash
7082
83+
brew install sundials
7184
pip install pybamm
7285
7386
PyBaMM’s dependencies (such as ``numpy``, ``scipy``, etc) will be
@@ -79,38 +92,35 @@ For an introduction to virtual environments, see
7992
.. _scikits.odes-label:
8093

8194
Optional - scikits.odes solver
82-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
95+
------------------------------
8396

8497
Users can install `scikits.odes <https://github.com/bmcage/odes>`__ in
8598
order to use the wrapped SUNDIALS ODE and DAE
8699
`solvers <https://pybamm.readthedocs.io/en/latest/source/solvers/scikits_solvers.html>`__.
100+
Currently, only GNU/Linux and macOS are supported.
87101

88-
**A pre-requisite** is the installation of a BLAS library (such as
89-
`openblas <https://www.openblas.net/>`__). On Ubuntu/debian
90-
91-
::
102+
GNU/Linux
103+
~~~~~~~~~
92104

93-
sudo apt install libopenblas-dev
94-
95-
and on Mac OS
105+
.. code:: bash
96106
97-
::
107+
apt install libopenblas-dev
108+
pybamm_install_odes --install-sundials
98109
99-
brew install openblas
110+
The ``pybamm_install_odes`` command is installed with PyBaMM. It automatically downloads and installs the SUNDIALS library on your
111+
system (under ``~/.local``), before installing ``sckits.odes`` (by running ``pip install scikits.odes``).
100112

101-
After installing PyBaMM, the following command can be used to
102-
automatically install ``scikits.odes`` and its dependencies
113+
macOS
114+
~~~~~
103115

104-
::
105-
106-
$ pybamm_install_odes --install-sundials
116+
.. code:: bash
107117
108-
The ``--install-sundials`` option is used to activate automatic
109-
downloads and installation of the sundials library, which is required by
110-
``scikits.odes``.
118+
pip install scikits.odes
119+
120+
Assuming that the SUNDIALS were installed as described :ref:`above<user-install-label>`.
111121

112122
Developer install
113-
~~~~~~~~~~~~~~~~~~
123+
-----------------
114124

115125
If you wish to contribute to PyBaMM, you should get the latest version
116126
from the GitHub repository. To do so, you must have Git and graphviz
@@ -159,7 +169,7 @@ Before you start contributing to PyBaMM, please read the `contributing
159169
guidelines <CONTRIBUTING.md>`__.
160170

161171
Uninstall PyBaMM
162-
--------------------
172+
================
163173

164174
PyBaMM can be uninstalled by running
165175

@@ -170,7 +180,7 @@ PyBaMM can be uninstalled by running
170180
in your virtual environment.
171181

172182
Troubleshooting
173-
-------------------
183+
===============
174184

175185
**Problem:** I’ve made edits to source files in PyBaMM, but these are
176186
not being used when I run my Python script.

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def compile_KLU():
160160

161161
setup(
162162
name="pybamm",
163-
version=load_version() + ".post3",
163+
version=load_version() + ".post7",
164164
description="Python Battery Mathematical Modelling.",
165165
long_description="description",
166166
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)