Skip to content

Commit ec6990c

Browse files
authored
Merge pull request #150 from precice/python-bindings-v2.5.0.0
Release v2.5.0.0
2 parents f6828eb + 417b7bf commit ec6990c

File tree

13 files changed

+72
-43
lines changed

13 files changed

+72
-43
lines changed

.github/workflows/build-and-test.yml

+21-13
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Install & upgrade pip3
2020
run: |
2121
apt-get -yy update
22-
apt-get install -y python3-pip
22+
apt-get install -y python3-pip pkg-config
2323
rm -rf /var/lib/apt/lists/*
2424
pip3 install --upgrade --user pip
2525
- name: Install dependencies
@@ -38,10 +38,10 @@ jobs:
3838
steps:
3939
- name: Checkout Repository
4040
uses: actions/checkout@v2
41-
- name: Install & upgrade pip3
41+
- name: Install pip3, pkgconfig and upgrade pip3
4242
run: |
4343
apt-get -yy update
44-
apt-get install -y python3-pip
44+
apt-get install -y python3-pip pkg-config
4545
rm -rf /var/lib/apt/lists/*
4646
pip3 install --upgrade --user pip
4747
- name: Install dependencies
@@ -61,10 +61,10 @@ jobs:
6161
steps:
6262
- name: Checkout Repository
6363
uses: actions/checkout@v2
64-
- name: Install & upgrade pip3
64+
- name: Install pip3, pkgconfig and upgrade pip3
6565
run: |
6666
apt-get -yy update
67-
apt-get install -y python3-pip
67+
apt-get install -y python3-pip pkg-config
6868
rm -rf /var/lib/apt/lists/*
6969
pip3 install --upgrade --user pip
7070
- name: Install dependencies
@@ -80,22 +80,30 @@ jobs:
8080
steps:
8181
- name: Checkout Repository
8282
uses: actions/checkout@v2
83-
- name: Install & upgrade pip3 and install OpenMPI
83+
- uses: actions/setup-python@v1
84+
- name: Install OpenMPI, CMake, Boost library, Eigen and pkg-config
8485
run: |
8586
sudo apt-get -yy update
86-
sudo apt-get install -y python3-pip libopenmpi-dev
87+
sudo apt-get install -y libopenmpi-dev cmake libboost-all-dev libeigen3-dev pkg-config
8788
sudo rm -rf /var/lib/apt/lists/*
88-
pip3 install --upgrade --user pip
89+
- uses: BSFishy/pip-action@v1
90+
with:
91+
packages: toml
8992
- name: Checkout precice and make required files discoverable
9093
run: |
9194
git clone https://github.com/precice/precice.git precice-core
9295
mkdir -p precice
9396
cp precice-core/src/precice/SolverInterface.hpp precice/SolverInterface.hpp
97+
cd precice-core
98+
mkdir build && cd build
99+
cmake .. -DPRECICE_MPICommunication=OFF -DPRECICE_PETScMapping=OFF -DPRECICE_PythonActions=OFF -DBUILD_TESTING=OFF
94100
- name: Install dependencies
95101
run: |
96-
pip3 install --user toml
97102
python3 -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | pip3 install -r /dev/stdin
98103
- name: Run setup test
104+
env:
105+
PKG_CONFIG_PATH: "precice-core/build"
106+
PKG_CONFIG_SYSTEM_INCLUDE_PATH: 1
99107
run: |
100108
export CFLAGS=-I$GITHUB_WORKSPACE
101109
python3 setup.py test
@@ -108,10 +116,10 @@ jobs:
108116
steps:
109117
- name: Checkout Repository
110118
uses: actions/checkout@v2
111-
- name: Install & upgrade pip3
119+
- name: Install pip3, pkgconfig and upgrade pip3
112120
run: |
113121
apt-get -yy update
114-
apt-get install -y python3-pip
122+
apt-get install -y python3-pip pkg-config
115123
rm -rf /var/lib/apt/lists/*
116124
pip3 install --upgrade --user pip
117125
- name: Run pip install
@@ -127,10 +135,10 @@ jobs:
127135
steps:
128136
- name: Checkout Repository
129137
uses: actions/checkout@v2
130-
- name: Install & upgrade pip3
138+
- name: Install pip3, pkgconfig and upgrade pip3
131139
run: |
132140
apt-get -yy update
133-
apt-get install -y python3-pip
141+
apt-get install -y python3-pip pkg-config
134142
rm -rf /var/lib/apt/lists/*
135143
pip3 install --upgrade --user pip
136144
- name: Run pip install

.github/workflows/build-env.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ jobs:
2424
with:
2525
push: true
2626
context: .
27-
file: spack/ci-spack-pyprecice-deps-1804.dockerfile
28-
tags: precice/ci-spack-pyprecice-deps-1804
27+
file: spack/ci-spack-pyprecice-deps-2204.dockerfile
28+
tags: precice/ci-spack-pyprecice-deps-2204

.github/workflows/build-spack.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
name: build_spack
1515
runs-on: ubuntu-latest
1616
timeout-minutes: 15
17-
container: precice/ci-spack-pyprecice-deps-1804
17+
container: precice/ci-spack-pyprecice-deps-2204
1818
defaults:
1919
run:
2020
shell: "bash --login -eo pipefail {0}"
@@ -26,4 +26,10 @@ jobs:
2626
cp -r spack/repo/packages/py-pyprecice/ /py-pyprecice-repo/packages/
2727
- name: Try to build py-pyprecice with spack and test it
2828
run: |
29-
. /opt/spack/share/spack/setup-env.sh && spack env activate ci && spack arch && spack find && spack dev-build pyprecice.test.py-pyprecice@develop target=x86_64 && spack load precice py-numpy py-mpi4py py-cython openssh openmpi && export PYTHONPATH=${PWD}/build/$(ls build | grep lib.):${PYTHONPATH} && mkdir runner && cd runner && BINDINGS_VERSION=$(python3 -c "import precice; print(precice.__version__)") && echo "Installed version of bindings is ${BINDINGS_VERSION}"
29+
. /opt/spack/share/spack/setup-env.sh
30+
spack env activate ci && spack arch
31+
spack remove py-pyprecice
32+
spack add pyprecice.test.py-pyprecice@develop && spack develop pyprecice.test.py-pyprecice@develop
33+
spack install && spack find
34+
spack load py-pyprecice
35+
BINDINGS_VERSION=$(python3 -c "import precice; print(precice.__version__)") && echo "Installed version of bindings is ${BINDINGS_VERSION}"

.github/workflows/pythonpublish.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@ jobs:
1515
with:
1616
python-version: '3.x'
1717
- name: Install dependencies
18-
run: |
19-
python -m pip install --upgrade pip
20-
pip install setuptools wheel twine cython packaging numpy
18+
uses: BSFishy/pip-action@v1
19+
with:
20+
packages: |
21+
setuptools
22+
wheel
23+
twine
24+
cython
25+
packaging
26+
numpy
2127
- name: Build and publish
2228
env:
2329
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}

.github/workflows/run-solverdummy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Install Dependencies
1818
run: |
1919
apt-get -qq update
20-
apt-get -qq install software-properties-common python3-dev python3-pip git apt-utils
20+
apt-get -qq install software-properties-common python3-dev python3-pip git apt-utils pkg-config
2121
rm -rf /var/lib/apt/lists/*
2222
- name: Install bindings
2323
run: pip3 install --user .

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
## latest
66

7+
## 2.5.0.0
8+
9+
* Bindings now use pkgconfig to determine flags and link to preCICE. https://github.com/precice/python-bindings/pull/149
10+
711
## 2.4.0.0
812

913
* Move solverdummy into examples/ folder and remove MeshName from its input arguments. https://github.com/precice/python-bindings/pull/141

cyprecice/cyprecice.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ cdef class Interface:
12071207
>>> vertex_id = 5
12081208
>>> value = interface.read_scalar_data(data_id, vertex_id)
12091209
"""
1210-
cdef double _value
1210+
cdef double _value = 0
12111211
self.thisptr.readScalarData (data_id, vertex_id, _value)
12121212
return _value
12131213

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[build-system]
22
# PEP 518 - minimum build system requirements
3-
requires = ["setuptools", "wheel", "Cython>=0.29", "packaging", "pip>=19.0.0", "numpy", "mpi4py"]
3+
requires = ["setuptools", "wheel", "Cython>=0.29", "packaging", "pip>=19.0.0", "numpy", "mpi4py", "pkgconfig"]

setup.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
from Cython.Distutils.build_ext import new_build_ext as build_ext
5353
from Cython.Build import cythonize
5454
import numpy
55+
import pkgconfig
5556

5657

5758
# name of Interfacing API
@@ -69,8 +70,10 @@ def get_extensions(is_test):
6970
bindings_sources = [os.path.join(PYTHON_BINDINGS_PATH, "cyprecice",
7071
"cyprecice" + ".pyx")]
7172

73+
compile_args += pkgconfig.cflags('libprecice').split()
74+
7275
if not is_test:
73-
link_args.append("-lprecice")
76+
link_args += pkgconfig.libs('libprecice').split()
7477
if is_test:
7578
bindings_sources.append(os.path.join(PYTHON_BINDINGS_PATH, "test",
7679
"SolverInterface.cpp"))

spack/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
The Spack package `py-pyprecice` provides the python bindings via Spack and was submitted via [pull request 19558](https://github.com/spack/spack/pull/19558) in the Spack repository. This folder contains the Spack package script that can be used for testing whether the Spack installation works.
44

5-
## Docker image `precice/ci-spack-pyprecice-deps-1804`
5+
## Docker image `precice/ci-spack-pyprecice-deps-2204`
66

7-
The workflow `build-spack-pyprecice-deps` in `.github/workflows/build-env.yml` creates the image `precice/ci-spack-pyprecice-deps-1804`. This image contains all dependencies of `py-pyprecice@develop`.
7+
The workflow `build-spack-pyprecice-deps` in `.github/workflows/build-env.yml` creates the image `precice/ci-spack-pyprecice-deps-2204`. This image contains all dependencies of `py-pyprecice@develop`.
88

9-
The workflow `build_spack` in `.github/workflows/build-spack.yml` uses the image `precice/ci-spack-pyprecice-deps-1804` to reduce build time. The workflow uses the `package.py` from this repository to build the latest version of the bindings and run a small test on this version.
9+
The workflow `build_spack` in `.github/workflows/build-spack.yml` uses the image `precice/ci-spack-pyprecice-deps-2204` to reduce build time. The workflow uses the `package.py` from this repository to build the latest version of the bindings and run a small test on this version.
1010

1111
## When a new Spack release is necessary
1212

@@ -62,4 +62,4 @@ The workflow `build_spack` in `.github/workflows/build-spack.yml` uses the image
6262
7. Ideally one runs the solverdummy with the freshly installed Python bindings.
6363
6464
* Use `package.py` together with the patches provided in `python-bindings/spack/repo/packages/py-pyprecice` to [create a pull request for Spack](https://github.com/spack/spack/compare) and submit the new release.
65-
* After the pull request in the Spack repository is merged, merge the current package configuration into the repository of the Python bindings if necessery.
65+
* After the pull request in the Spack repository is merged, merge the current package configuration into the repository of the Python bindings if necessery.

spack/ci-spack-pyprecice-deps-1804.dockerfile renamed to spack/ci-spack-pyprecice-deps-2204.dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build stage with Spack pre-installed and ready to be used
2-
FROM spack/ubuntu-bionic:latest
2+
FROM spack/ubuntu-jammy:latest
33

44
# Mount the current sources into the build container
55
# and build the default environment
+14-13
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
1+
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
22
# Spack Project Developers. See the top-level COPYRIGHT file for details.
33
#
44
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
55

6-
from spack import *
6+
from spack.package import *
77

88

99
class PyPyprecice(PythonPackage):
@@ -14,16 +14,17 @@ class PyPyprecice(PythonPackage):
1414

1515
homepage = "https://precice.org"
1616
git = "https://github.com/precice/python-bindings.git"
17-
url = "https://github.com/precice/python-bindings/archive/v2.0.0.1.tar.gz"
17+
url = "https://github.com/precice/python-bindings/archive/v2.4.0.0.tar.gz"
1818
maintainers = ["ajaust", "BenjaminRodenberg", "IshaanDesai"]
1919

2020
# Always prefer final version of release candidate
2121
version("develop", branch="develop")
22-
version('2.3.0.1', sha256='ed4e48729b662680beaa4ee2a9aff724a79e760534c6c58181be739988da2789')
23-
version('2.2.1.1', sha256='139bac5077c3807e1b7b83d8d0da5ca0fc8c17393fd0df4bc5999cd63a351b78')
24-
version('2.2.0.2', sha256='2287185f9ad7500dced53459543d27bb66bd2438c2e4bf81ee3317e6a00513d5')
25-
version('2.2.0.1', sha256='229625e2e6df03987ababce5abe2021b0974cbe5a588b936a9cba653f4908d4b')
26-
version('2.1.1.2', sha256='363eb3eeccf964fd5ee87012c1032353dd1518662868f2b51f04a6d8a7154045')
22+
version("2.4.0.0", sha256="8877da85df97d66966892440c7e777b667d8e6a33747304ed3762f4c33b729ec")
23+
version("2.3.0.1", sha256="ed4e48729b662680beaa4ee2a9aff724a79e760534c6c58181be739988da2789")
24+
version("2.2.1.1", sha256="139bac5077c3807e1b7b83d8d0da5ca0fc8c17393fd0df4bc5999cd63a351b78")
25+
version("2.2.0.2", sha256="2287185f9ad7500dced53459543d27bb66bd2438c2e4bf81ee3317e6a00513d5")
26+
version("2.2.0.1", sha256="229625e2e6df03987ababce5abe2021b0974cbe5a588b936a9cba653f4908d4b")
27+
version("2.1.1.2", sha256="363eb3eeccf964fd5ee87012c1032353dd1518662868f2b51f04a6d8a7154045")
2728
version("2.1.1.1", sha256="972f574549344b6155a8dd415b6d82512e00fa154ca25ae7e36b68d4d2ed2cf4")
2829
version("2.1.0.1", sha256="ac5cb7412c6b96b08a04fa86ea38e52d91ea739a3bd1c209baa93a8275e4e01a")
2930
version("2.0.2.1", sha256="c6fca26332316de041f559aecbf23122a85d6348baa5d3252be4ddcd5e94c09a")
@@ -32,6 +33,7 @@ class PyPyprecice(PythonPackage):
3233
version("2.0.0.1", sha256="96eafdf421ec61ad6fcf0ab1d3cf210831a815272984c470b2aea57d4d0c9e0e")
3334

3435
depends_on("precice@develop", when="@develop")
36+
depends_on("[email protected]", when="@2.4.0.1:2.4.0")
3537
depends_on("[email protected]", when="@2.3.0.1:2.3.1")
3638
depends_on("[email protected]", when="@2.2.1.1:2.2.1")
3739
depends_on("[email protected]", when="@2.2.0.1:2.2.0")
@@ -46,11 +48,10 @@ class PyPyprecice(PythonPackage):
4648
depends_on("py-numpy", type=("build", "link", "run"))
4749
depends_on("py-mpi4py", type=("build", "run"))
4850
depends_on("[email protected]:", type="build")
49-
depends_on("py-packaging", when="@:2.1", type="build")
50-
depends_on("py-pip", when="@:2.1", type="build")
51+
depends_on("py-packaging", type="build")
52+
depends_on("[email protected]:", type="build")
53+
depends_on("py-pkgconfig", type="build")
5154

5255
@when("@:2.1")
5356
def patch(self):
54-
filter_file(
55-
"distutils.command.install", "setuptools.command.install", "setup.py"
56-
)
57+
filter_file("distutils.command.install", "setuptools.command.install", "setup.py")

tools/releasing/packaging/docker/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ RUN apt-get -qq update && apt-get -qq install \
1212
git \
1313
sudo \
1414
python3-dev \
15-
python3-pip && \
15+
python3-pip \
16+
pkg-config && \
1617
rm -rf /var/lib/apt/lists/*
1718

1819
## Needed, because precice/precice:latest does not create a user? See also https://github.com/precice/precice/pull/1090

0 commit comments

Comments
 (0)