Skip to content

Commit

Permalink
Update Build CI (#91)
Browse files Browse the repository at this point in the history
* Do not use float128, since it is not available on all builds on numpy

* Update metadata in setup.py

* Update ci build actions to newer versions

* Add build backend to pyproject.toml

* Try removing universal2 build for macos

* Add empty setuptools_scm section to pyproject.toml

* Updates to CI recipe

* Try adding name to cibuildwheel options

* Use pipx for sdist

* fix indentation

* remove pypi environment

* fix syntax error?

* fix syntax error?
  • Loading branch information
johnveitch authored May 19, 2024
1 parent 9e727af commit cc8853a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 37 deletions.
54 changes: 26 additions & 28 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
CIBW_ARCHS_MACOS: "x86_64 arm64"
strategy:
matrix:
os: [ubuntu-20.04, windows-latest, macos-10.15]
os: [ubuntu-latest, windows-latest, macos-latest]
cibw_archs: ["auto"]
include:
- os: ubuntu-20.04
- os: ubuntu-latest
cibw_archs : "aarch64"

steps:
Expand All @@ -36,57 +36,55 @@ jobs:
with:
platforms: arm64

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions/setup-python@v2
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.7'

- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==2.3.0
python-version: '3.x'
- name: Build wheels
run: |
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v2
uses: pypa/cibuildwheel@v2.18.0
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions/setup-python@v2
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.7'
python-version: '3.x'

- name: Build sdist
run: |
python -m pip install cython numpy setuptools_scm
python setup.py sdist
- uses: actions/upload-artifact@v2
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
environment: pypi
# upload to PyPI on every tag starting with 'v'
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: artifact
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist

- uses: pypa/gh-action-pypi-publish@master
merge-multiple: true
- name: Upload release to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypitoken }}
Expand Down
4 changes: 2 additions & 2 deletions cpnest/NestedSampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ def get_worst_n_live_points(self, n):
for evolution
"""
self.worst = np.arange(n)
self.logLmin.value = np.float128(self.params[n-1].logL)
return np.float128(self.logLmin.value)
self.logLmin.value = np.float(self.params[n-1].logL)
return self.logLmin.value

def check_insertion_indices(self, rolling=True, filename=None):
"""
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[build-system]
requires = ["setuptools_scm", "numpy", "cython"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]

13 changes: 6 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,12 @@
'Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8'],
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.7'],
keywords='nested sampling bayesian inference',
packages=['cpnest'],
install_requires=requirements,
Expand Down

0 comments on commit cc8853a

Please sign in to comment.