Skip to content

Commit

Permalink
Merge pull request #3301 from agriyakhetarpal/pyproject-toml-migration
Browse files Browse the repository at this point in the history
Add support for `pyproject.toml`
  • Loading branch information
Saransh-cpp authored Nov 25, 2023
2 parents f440164 + f1fd05f commit a463246
Show file tree
Hide file tree
Showing 27 changed files with 539 additions and 4,449 deletions.
5 changes: 4 additions & 1 deletion .github/release_workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This file contains the workflow required to make a `PyBaMM` release on GitHub, P
- `pybamm/version.py`
- `docs/conf.py`
- `CITATION.cff`
- `pyproject.toml`
- `vcpkg.json`
- `docs/_static/versions.json`
- `CHANGELOG.md`
Expand All @@ -32,6 +33,7 @@ If a new release candidate is required after the release of `rc0` -
- `pybamm/version.py`
- `docs/conf.py`
- `CITATION.cff`
- `pyproject.toml`
- `vcpkg.json`
- `docs/_static/versions.json`
- `CHANGELOG.md`
Expand All @@ -53,6 +55,7 @@ Once satisfied with the release candidates -
- `pybamm/version.py`
- `docs/conf.py`
- `CITATION.cff`
- `pyproject.toml`
- `vcpkg.json`
- `docs/_static/versions.json`
- `CHANGELOG.md`
Expand All @@ -70,7 +73,7 @@ Once satisfied with the release candidates -
Some other essential things to check throughout the release process -

- 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.
- Update jax and jaxlib to the latest version in `pybamm.util` and `setup.py`, fixing any bugs that arise
- Update jax and jaxlib to the latest version in `pybamm.util` and `pyproject.toml`, fixing any bugs that arise
- Make sure the URLs in `docs/_static/versions.json` are valid
- 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 -
```
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/lychee_url_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,18 @@ jobs:
--accept 200,429
--exclude-path ./CHANGELOG.md
--exclude-path ./scripts/update_version.py
--exclude-path asv.conf.json
--exclude-path docs/conf.py
'./**/*.rst'
'./**/*.md'
'./**/*.py'
'./**/*.ipynb'
'./**/*.json'
'./**/*.toml'
# fail the action on broken links
fail: true
jobSummary: true
format: markdown
env:
# to be used in case rate limits are surpassed
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
62 changes: 24 additions & 38 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Build and publish package to PyPI

on:
release:
types: [published]
Expand Down Expand Up @@ -27,22 +26,18 @@ jobs:
with:
python-version: 3.8

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.12.3

- name: Clone pybind11 repo (no history)
run: git clone --depth 1 --branch v2.10.4 https://github.com/pybind/pybind11.git
run: git clone --depth 1 --branch v2.11.1 https://github.com/pybind/pybind11.git

# remove when a new vcpkg version is released
- name: Install the latest commit of vcpkg on windows
- name: Install vcpkg on Windows
run: |
cd C:\
rm -r -fo 'C:\vcpkg'
git clone https://github.com/microsoft/vcpkg
cd vcpkg
.\bootstrap-vcpkg.bat
- name: Cache packages installed through vcpkg on windows
- name: Cache packages installed through vcpkg on Windows
uses: actions/cache@v3
env:
cache-name: vckpg_binary_cache
Expand All @@ -55,14 +50,13 @@ jobs:
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}

- name: Build 64 bits wheels on Windows
run: |
python -m cibuildwheel --output-dir wheelhouse
- name: Build 64-bit wheels on Windows
run: pipx run cibuildwheel --output-dir wheelhouse
env:
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'
CIBW_ARCHS: "AMD64"

- name: Upload windows wheels
- name: Upload Windows wheels
uses: actions/upload-artifact@v3
with:
name: windows_wheels
Expand All @@ -82,42 +76,34 @@ jobs:
with:
python-version: 3.8

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.12.3

- name: Clone pybind11 repo (no history)
run: git clone --depth 1 --branch v2.10.4 https://github.com/pybind/pybind11.git
run: git clone --depth 1 --branch v2.11.1 https://github.com/pybind/pybind11.git

- name: Install SUNDIALS on macOS
# sometimes gfortran cannot be found, so reinstall gcc just to be sure
- name: Install SuiteSparse and SUNDIALS on macOS
if: matrix.os == 'macos-latest'
run: |
# https://github.com/actions/virtual-environments/issues/1280
rm -f /usr/local/bin/2to3*
rm -f /usr/local/bin/idle3*
rm -f /usr/local/bin/pydoc3*
rm -f /usr/local/bin/python3*
brew update
brew install graphviz openblas libomp
brew reinstall gcc
brew install libomp
python -m pip install cmake wget
python scripts/install_KLU_Sundials.py
- name: Build wheels on Linux and MacOS
run: python -m cibuildwheel --output-dir wheelhouse
- name: Build wheels on ${{ matrix.os }}
run: pipx run cibuildwheel --output-dir wheelhouse
env:
CIBW_ARCHS_LINUX: x86_64
CIBW_BEFORE_ALL_LINUX: >
yum -y install openblas-devel lapack-devel &&
bash build_manylinux_wheels/install_sundials.sh 6.0.3 6.5.0
CIBW_BEFORE_BUILD_LINUX: "python -m pip install cmake casadi numpy"
bash scripts/install_sundials.sh 6.0.3 6.5.0
CIBW_BEFORE_BUILD_LINUX: >
python -m pip install cmake casadi numpy
# override; point to casadi install path so that it can be found by the repair command
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:$(python -c 'import casadi; print(casadi.__path__[0])')" auditwheel repair -w {dest_dir} {wheel}
CIBW_BEFORE_BUILD_MACOS: >
python -m pip
install cmake casadi numpy &&
python scripts/fix_casadi_rpath_mac.py &&
scripts/fix_suitesparse_rpath_mac.sh
# got error "re.error: multiple repeat at position 104" on python 3.7 when --require-archs added, so remove
# it for mac
python scripts/fix_casadi_rpath_mac.py && scripts/fix_suitesparse_rpath_mac.sh
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
delocate-listdeps {wheel} &&
delocate-wheel -v -w {dest_dir} {wheel}
Expand All @@ -131,7 +117,7 @@ jobs:
if-no-files-found: error

build_sdist:
name: Build sdist
name: Build SDist
runs-on: ubuntu-latest

steps:
Expand All @@ -141,12 +127,12 @@ jobs:
python-version: 3.11

- name: Install dependencies
run: pip install --upgrade pip setuptools wheel build
run: pip install --upgrade pip setuptools wheel

- name: Build sdist
run: python -m build --sdist
- name: Build SDist
run: pipx run build --sdist

- name: Upload sdist
- name: Upload SDist
uses: actions/upload-artifact@v3
with:
name: sdist
Expand Down
39 changes: 17 additions & 22 deletions .github/workflows/run_periodic_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,19 @@ on:
schedule:
- cron: "0 3 * * *"

jobs:
pre_job:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
# All of these options are optional, so you can remove them if you are happy with the defaults
concurrent_skipping: "never"
cancel_others: "true"
paths_ignore: '["**/README.md"]'
env:
FORCE_COLOR: 3

concurrency:
# github.workflow: name of the workflow, so that we don't cancel other workflows
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# Cancel in-progress runs when a new workflow with the same group name is triggered
# This avoids workflow runs on both pushes and PRs
cancel-in-progress: true

jobs:
style:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -69,19 +64,19 @@ jobs:
- name: Install macOS system dependencies
if: matrix.os == 'macos-latest'
run: |
brew install graphviz openblas
brew analytics off
brew install graphviz openblas libomp
brew reinstall gcc
- name: Install Windows system dependencies
if: matrix.os == 'windows-latest'
run: choco install graphviz --version=2.38.0.20190211

- name: Install standard Python dependencies
run: |
python -m pip install --upgrade pip wheel setuptools nox
- name: Install nox
run: python -m pip install nox

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

- 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
Expand Down
Loading

0 comments on commit a463246

Please sign in to comment.