Skip to content

Commit a463246

Browse files
authored
Merge pull request #3301 from agriyakhetarpal/pyproject-toml-migration
Add support for `pyproject.toml`
2 parents f440164 + f1fd05f commit a463246

27 files changed

+539
-4449
lines changed

.github/release_workflow.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This file contains the workflow required to make a `PyBaMM` release on GitHub, P
99
- `pybamm/version.py`
1010
- `docs/conf.py`
1111
- `CITATION.cff`
12+
- `pyproject.toml`
1213
- `vcpkg.json`
1314
- `docs/_static/versions.json`
1415
- `CHANGELOG.md`
@@ -32,6 +33,7 @@ If a new release candidate is required after the release of `rc0` -
3233
- `pybamm/version.py`
3334
- `docs/conf.py`
3435
- `CITATION.cff`
36+
- `pyproject.toml`
3537
- `vcpkg.json`
3638
- `docs/_static/versions.json`
3739
- `CHANGELOG.md`
@@ -53,6 +55,7 @@ Once satisfied with the release candidates -
5355
- `pybamm/version.py`
5456
- `docs/conf.py`
5557
- `CITATION.cff`
58+
- `pyproject.toml`
5659
- `vcpkg.json`
5760
- `docs/_static/versions.json`
5861
- `CHANGELOG.md`
@@ -70,7 +73,7 @@ Once satisfied with the release candidates -
7073
Some other essential things to check throughout the release process -
7174

7275
- If updating our custom vcpkg registory entries [pybamm-team/sundials-vcpkg-registry](https://github.com/pybamm-team/sundials-vcpkg-registry) or [pybamm-team/casadi-vcpkg-registry](https://github.com/pybamm-team/casadi-vcpkg-registry) (used to build Windows wheels), make sure to update the baseline of the registories in vcpkg-configuration.json to the latest commit id.
73-
- Update jax and jaxlib to the latest version in `pybamm.util` and `setup.py`, fixing any bugs that arise
76+
- Update jax and jaxlib to the latest version in `pybamm.util` and `pyproject.toml`, fixing any bugs that arise
7477
- Make sure the URLs in `docs/_static/versions.json` are valid
7578
- As the release workflow is initiated by the `release` event, it's important to note that the default `GITHUB_REF` used by `actions/checkout` during the checkout process will correspond to the tag created during the release process. Consequently, the workflows will consistently build PyBaMM based on the commit associated with this tag. Should new commits be introduced to the `vYY.MM` branch, such as those addressing build issues, it becomes necessary to manually update this tag to point to the most recent commit -
7679
```

.github/workflows/lychee_url_checker.yml

+5
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,18 @@ jobs:
4545
--accept 200,429
4646
--exclude-path ./CHANGELOG.md
4747
--exclude-path ./scripts/update_version.py
48+
--exclude-path asv.conf.json
4849
--exclude-path docs/conf.py
4950
'./**/*.rst'
5051
'./**/*.md'
5152
'./**/*.py'
5253
'./**/*.ipynb'
54+
'./**/*.json'
55+
'./**/*.toml'
5356
# fail the action on broken links
5457
fail: true
58+
jobSummary: true
59+
format: markdown
5560
env:
5661
# to be used in case rate limits are surpassed
5762
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/publish_pypi.yml

+24-38
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Build and publish package to PyPI
2-
32
on:
43
release:
54
types: [published]
@@ -27,22 +26,18 @@ jobs:
2726
with:
2827
python-version: 3.8
2928

30-
- name: Install cibuildwheel
31-
run: python -m pip install cibuildwheel==2.12.3
32-
3329
- name: Clone pybind11 repo (no history)
34-
run: git clone --depth 1 --branch v2.10.4 https://github.com/pybind/pybind11.git
30+
run: git clone --depth 1 --branch v2.11.1 https://github.com/pybind/pybind11.git
3531

36-
# remove when a new vcpkg version is released
37-
- name: Install the latest commit of vcpkg on windows
32+
- name: Install vcpkg on Windows
3833
run: |
3934
cd C:\
4035
rm -r -fo 'C:\vcpkg'
4136
git clone https://github.com/microsoft/vcpkg
4237
cd vcpkg
4338
.\bootstrap-vcpkg.bat
4439
45-
- name: Cache packages installed through vcpkg on windows
40+
- name: Cache packages installed through vcpkg on Windows
4641
uses: actions/cache@v3
4742
env:
4843
cache-name: vckpg_binary_cache
@@ -55,14 +50,13 @@ jobs:
5550
uses: mxschmitt/action-tmate@v3
5651
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
5752

58-
- name: Build 64 bits wheels on Windows
59-
run: |
60-
python -m cibuildwheel --output-dir wheelhouse
53+
- name: Build 64-bit wheels on Windows
54+
run: pipx run cibuildwheel --output-dir wheelhouse
6155
env:
6256
CIBW_ENVIRONMENT: 'PYBAMM_USE_VCPKG=ON VCPKG_ROOT_DIR=C:\vcpkg VCPKG_DEFAULT_TRIPLET=x64-windows-static-md VCPKG_FEATURE_FLAGS=manifests,registries CMAKE_GENERATOR="Visual Studio 17 2022" CMAKE_GENERATOR_PLATFORM=x64'
6357
CIBW_ARCHS: "AMD64"
6458

65-
- name: Upload windows wheels
59+
- name: Upload Windows wheels
6660
uses: actions/upload-artifact@v3
6761
with:
6862
name: windows_wheels
@@ -82,42 +76,34 @@ jobs:
8276
with:
8377
python-version: 3.8
8478

85-
- name: Install cibuildwheel
86-
run: python -m pip install cibuildwheel==2.12.3
87-
8879
- name: Clone pybind11 repo (no history)
89-
run: git clone --depth 1 --branch v2.10.4 https://github.com/pybind/pybind11.git
80+
run: git clone --depth 1 --branch v2.11.1 https://github.com/pybind/pybind11.git
9081

91-
- name: Install SUNDIALS on macOS
82+
# sometimes gfortran cannot be found, so reinstall gcc just to be sure
83+
- name: Install SuiteSparse and SUNDIALS on macOS
9284
if: matrix.os == 'macos-latest'
9385
run: |
94-
# https://github.com/actions/virtual-environments/issues/1280
95-
rm -f /usr/local/bin/2to3*
96-
rm -f /usr/local/bin/idle3*
97-
rm -f /usr/local/bin/pydoc3*
98-
rm -f /usr/local/bin/python3*
99-
brew update
86+
brew install graphviz openblas libomp
10087
brew reinstall gcc
101-
brew install libomp
10288
python -m pip install cmake wget
10389
python scripts/install_KLU_Sundials.py
10490
105-
- name: Build wheels on Linux and MacOS
106-
run: python -m cibuildwheel --output-dir wheelhouse
91+
- name: Build wheels on ${{ matrix.os }}
92+
run: pipx run cibuildwheel --output-dir wheelhouse
10793
env:
10894
CIBW_ARCHS_LINUX: x86_64
10995
CIBW_BEFORE_ALL_LINUX: >
11096
yum -y install openblas-devel lapack-devel &&
111-
bash build_manylinux_wheels/install_sundials.sh 6.0.3 6.5.0
112-
113-
CIBW_BEFORE_BUILD_LINUX: "python -m pip install cmake casadi numpy"
97+
bash scripts/install_sundials.sh 6.0.3 6.5.0
98+
CIBW_BEFORE_BUILD_LINUX: >
99+
python -m pip install cmake casadi numpy
100+
# override; point to casadi install path so that it can be found by the repair command
101+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
102+
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:$(python -c 'import casadi; print(casadi.__path__[0])')" auditwheel repair -w {dest_dir} {wheel}
114103
CIBW_BEFORE_BUILD_MACOS: >
115104
python -m pip
116105
install cmake casadi numpy &&
117-
python scripts/fix_casadi_rpath_mac.py &&
118-
scripts/fix_suitesparse_rpath_mac.sh
119-
# got error "re.error: multiple repeat at position 104" on python 3.7 when --require-archs added, so remove
120-
# it for mac
106+
python scripts/fix_casadi_rpath_mac.py && scripts/fix_suitesparse_rpath_mac.sh
121107
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
122108
delocate-listdeps {wheel} &&
123109
delocate-wheel -v -w {dest_dir} {wheel}
@@ -131,7 +117,7 @@ jobs:
131117
if-no-files-found: error
132118

133119
build_sdist:
134-
name: Build sdist
120+
name: Build SDist
135121
runs-on: ubuntu-latest
136122

137123
steps:
@@ -141,12 +127,12 @@ jobs:
141127
python-version: 3.11
142128

143129
- name: Install dependencies
144-
run: pip install --upgrade pip setuptools wheel build
130+
run: pip install --upgrade pip setuptools wheel
145131

146-
- name: Build sdist
147-
run: python -m build --sdist
132+
- name: Build SDist
133+
run: pipx run build --sdist
148134

149-
- name: Upload sdist
135+
- name: Upload SDist
150136
uses: actions/upload-artifact@v3
151137
with:
152138
name: sdist

.github/workflows/run_periodic_tests.yml

+17-22
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,19 @@ on:
1212
schedule:
1313
- cron: "0 3 * * *"
1414

15-
jobs:
16-
pre_job:
17-
runs-on: ubuntu-latest
18-
# Map a step output to a job output
19-
outputs:
20-
should_skip: ${{ steps.skip_check.outputs.should_skip }}
21-
steps:
22-
- id: skip_check
23-
uses: fkirc/skip-duplicate-actions@master
24-
with:
25-
# All of these options are optional, so you can remove them if you are happy with the defaults
26-
concurrent_skipping: "never"
27-
cancel_others: "true"
28-
paths_ignore: '["**/README.md"]'
15+
env:
16+
FORCE_COLOR: 3
17+
18+
concurrency:
19+
# github.workflow: name of the workflow, so that we don't cancel other workflows
20+
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request
21+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
22+
# Cancel in-progress runs when a new workflow with the same group name is triggered
23+
# This avoids workflow runs on both pushes and PRs
24+
cancel-in-progress: true
2925

26+
jobs:
3027
style:
31-
needs: pre_job
32-
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
3328
runs-on: ubuntu-latest
3429
steps:
3530
- uses: actions/checkout@v4
@@ -69,19 +64,19 @@ jobs:
6964
- name: Install macOS system dependencies
7065
if: matrix.os == 'macos-latest'
7166
run: |
72-
brew install graphviz openblas
67+
brew analytics off
68+
brew install graphviz openblas libomp
7369
brew reinstall gcc
7470
7571
- name: Install Windows system dependencies
7672
if: matrix.os == 'windows-latest'
7773
run: choco install graphviz --version=2.38.0.20190211
7874

79-
- name: Install standard Python dependencies
80-
run: |
81-
python -m pip install --upgrade pip wheel setuptools nox
75+
- name: Install nox
76+
run: python -m pip install nox
8277

83-
- name: Install SuiteSparse and SUNDIALS on GNU/Linux
84-
if: matrix.os == 'ubuntu-latest'
78+
- name: Install SuiteSparse and SUNDIALS on GNU/Linux and macOS
79+
if: matrix.os != 'windows-latest'
8580
run: python -m nox -s pybamm-requires
8681

8782
- name: Run unit tests for GNU/Linux with Python 3.8, 3.9, and 3.10, and for macOS and Windows with all Python versions

0 commit comments

Comments
 (0)