Skip to content

Commit 6c6f9b6

Browse files
authored
Merge pull request #245 from precice/python-bindings-v3.3.0
Release v3.3.0
2 parents b86bc70 + cbbdbcf commit 6c6f9b6

24 files changed

+638
-3619
lines changed

.codespellrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[codespell]
2+
ignore-words-list = precice

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

Lines changed: 67 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,28 @@ on:
66
pull_request:
77
branches:
88
- "*"
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: ${ {github.event_name }}-${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: ${{github.event_name == 'pull_request'}}
914

1015
jobs:
11-
setup_install:
12-
name: Run setup install
16+
pre-commit:
17+
name: pre-commit checks
1318
runs-on: ubuntu-latest
14-
container:
15-
image: precice/precice:nightly
16-
options: --user root
1719
steps:
18-
- name: Checkout Repository
19-
uses: actions/checkout@v2
20-
- name: Install pip3, pkgconfig and upgrade pip3
21-
run: |
22-
apt-get -yy update
23-
apt-get install -y python3-pip python3.12-venv pkg-config
24-
rm -rf /var/lib/apt/lists/*
25-
- name: Create venv
26-
run: python3 -m venv .venv
27-
- name: Activate venv
28-
# see https://stackoverflow.com/a/74669486
29-
run: |
30-
. .venv/bin/activate
31-
echo PATH=$PATH >> $GITHUB_ENV
32-
- name: Install dependencies
33-
run: |
34-
pip3 install toml
35-
python3 -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | pip3 install -r /dev/stdin
36-
- name: Run setup install
37-
run: python3 setup.py install
38-
- name: Test install
39-
run: |
40-
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
41-
python3 -c "import precice"
20+
- uses: actions/checkout@v4
21+
- name: Setup python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.x'
25+
- name: Run pre-commit
26+
uses: pre-commit/action@v3.0.1
4227

43-
setup_test:
44-
name: Run setup test
28+
run_tox:
29+
name: mocked tests
30+
needs: [pre-commit]
4531
runs-on: ubuntu-latest
4632
steps:
4733
- name: Checkout Repository
@@ -52,9 +38,6 @@ jobs:
5238
sudo apt-get -yy update
5339
sudo apt-get install -y libopenmpi-dev cmake libboost-all-dev libeigen3-dev pkg-config
5440
sudo rm -rf /var/lib/apt/lists/*
55-
- uses: BSFishy/pip-action@v1
56-
with:
57-
packages: toml
5841
- name: Checkout precice and make required files discoverable
5942
run: |
6043
git clone --branch develop https://github.com/precice/precice.git precice-core
@@ -65,27 +48,56 @@ jobs:
6548
cd precice-core
6649
mkdir build && cd build
6750
cmake .. -DPRECICE_FEATURE_MPI_COMMUNICATION=OFF -DPRECICE_FEATURE_PETSC_MAPPING=OFF -DPRECICE_FEATURE_PYTHON_ACTIONS=OFF -DBUILD_TESTING=OFF
68-
- name: Install dependencies
69-
run: |
70-
python3 -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | pip3 install -r /dev/stdin
71-
- name: Run setup test
51+
- name: Install tox
52+
run: pip install tox
53+
- name: Run tox
7254
env:
73-
PKG_CONFIG_PATH: "precice-core/build"
7455
PKG_CONFIG_SYSTEM_INCLUDE_PATH: 1
7556
run: |
76-
export CFLAGS=-I$GITHUB_WORKSPACE
77-
python3 setup.py test
57+
export PKG_CONFIG_PATH=$(readlink -f "precice-core/build")
58+
tox
59+
60+
build_dist:
61+
name: build distributions
62+
needs: [pre-commit]
63+
runs-on: ubuntu-latest
64+
container:
65+
image: precice/precice:nightly
66+
options: --user root
67+
steps:
68+
- name: Checkout Repository
69+
uses: actions/checkout@v4
70+
with:
71+
fetch-depth: 0
72+
- name: Configure safe directory
73+
run: git config --global --add safe.directory $GITHUB_WORKSPACE
74+
- name: Install dependencies
75+
run: |
76+
apt-get -yy update
77+
apt-get install -y python3-pip python3.12-venv pkg-config pipx
78+
rm -rf /var/lib/apt/lists/*
79+
- name: Install pyproject-build
80+
run: |
81+
pipx install build
82+
- name: Build sdist
83+
run: |
84+
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
85+
$HOME/.local/bin/pyproject-build -s
86+
- name: Build wheel
87+
run: |
88+
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
89+
$HOME/.local/bin/pyproject-build -w
7890
7991
pip_install:
80-
name: Run pip install
81-
needs: [setup_test]
92+
name: pip install
93+
needs: [pre-commit]
8294
runs-on: ubuntu-latest
8395
container:
8496
image: precice/precice:nightly
8597
options: --user root
8698
steps:
8799
- name: Checkout Repository
88-
uses: actions/checkout@v2
100+
uses: actions/checkout@v4
89101
- name: Install dependencies
90102
run: |
91103
apt-get -yy update
@@ -94,28 +106,30 @@ jobs:
94106
- name: Create venv
95107
run: |
96108
python3 -m venv .venv
97-
- name: Activate venv
98-
# see https://stackoverflow.com/a/74669486
99-
run: |
100-
. .venv/bin/activate
101-
echo PATH=$PATH >> $GITHUB_ENV
102109
- name: Run pip install
103-
run: pip3 install .
110+
run: |
111+
.venv/bin/pip3 install .
104112
- name: Check import
105113
run: |
106114
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
107-
python3 -c "import precice"
115+
.venv/bin/python3 -c "import precice"
116+
- name: Get version
117+
run: |
118+
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
119+
.venv/bin/python3 -c "import precice; print(precice.__version__)"
120+
.venv/bin/python3 -c "import precice; print(precice.get_version_information())"
121+
108122
109123
solverdummy_test:
110-
name: Run solverdummy
124+
name: solverdummies
111125
needs: [pip_install]
112126
runs-on: ubuntu-latest
113127
container:
114128
image: precice/precice:nightly
115129
options: --user root
116130
steps:
117131
- name: Checkout Repository
118-
uses: actions/checkout@v2
132+
uses: actions/checkout@v4
119133
- name: Install dependencies
120134
run: |
121135
apt-get -yy update

.github/workflows/check-markdown.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/check-pep8.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/pythonpublish.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Upload Python Package
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
build:
10+
name: Build package
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.x'
17+
- run: pip install --upgrade build
18+
- name: Build package
19+
run: pyproject-build --sdist
20+
- uses: actions/upload-artifact@v4
21+
with:
22+
name: dist
23+
path: dist
24+
overwrite: true
25+
if-no-files-found: error
26+
retention-days: 1
27+
28+
publish:
29+
name: Upload release to PyPI
30+
needs: build
31+
runs-on: ubuntu-latest
32+
permissions:
33+
id-token: write
34+
steps:
35+
- name: Download package
36+
uses: actions/download-artifact@v4
37+
with:
38+
name: dist
39+
path: dist
40+
- name: Publish package distributions to PyPI
41+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/run-solverdummy.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
repos:
2+
# Official repo for the clang-format hook
3+
- repo: https://github.com/pre-commit/mirrors-clang-format
4+
rev: 'v20.1.0'
5+
hooks:
6+
- id: clang-format
7+
name: format C/C++
8+
types_or: [c++]
9+
# Official repo for default hooks
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: 'v5.0.0'
12+
hooks:
13+
- id: check-merge-conflict
14+
- id: mixed-line-ending
15+
- id: trailing-whitespace
16+
args: [--markdown-linebreak-ext=md]
17+
- id: end-of-file-fixer
18+
# black repo for python formatting
19+
- repo: https://github.com/ambv/black
20+
rev: 25.1.0
21+
hooks:
22+
- id: black
23+
name: format python
24+
- repo: https://github.com/codespell-project/codespell
25+
rev: v2.4.1
26+
hooks:
27+
- id: codespell
28+
name: check spelling
29+
- repo: https://github.com/python-jsonschema/check-jsonschema
30+
rev: 0.33.2
31+
hooks:
32+
- id: check-github-workflows
33+
args: ["--verbose"]
34+
35+
- repo: https://github.com/igorshubovych/markdownlint-cli
36+
rev: v0.39.0
37+
hooks:
38+
- id: markdownlint
39+
exclude: "^changelog-entries/"
40+
- id: markdownlint-fix
41+
exclude: "^changelog-entries/"

0 commit comments

Comments
 (0)