Skip to content

Commit 496f6c0

Browse files
authored
Update Python build and publish workflow and bump version (#32)
* Update build and publish workflow * Bump version * Force Python versions as strings * CMake build on matrix of Python versions
1 parent b825746 commit 496f6c0

File tree

6 files changed

+64
-70
lines changed

6 files changed

+64
-70
lines changed

.github/workflows/cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
os: [ubuntu-latest, macos-latest]
19-
python-version: [3.8]
19+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
2020

2121
steps:
2222
- uses: actions/checkout@v4

.github/workflows/python.yml

Lines changed: 58 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,104 @@
1-
name: Python Build
1+
name: Python tests, package build and publish on release
22

33
env:
44
# Set to avoid errors when building FFTW with CMake v4+
55
# https://github.com/FFTW/fftw3/issues/381
66
CMAKE_POLICY_VERSION_MINIMUM: 3.5
77

8-
"on":
8+
on:
99
push:
1010
branches: ["main"]
11-
tags:
12-
- "v[0-9]+.[0-9]+.[0-9]+"
13-
- "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
1411
pull_request:
12+
release:
13+
types:
14+
- published
1515

1616
jobs:
17-
from-sdist:
18-
name: python source distribution
19-
runs-on: ubuntu-latest
17+
tests:
18+
name: Run tests on ${{matrix.os}} / Python ${{matrix.python-version}}
19+
runs-on: ${{matrix.os}}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: [macos-latest, ubuntu-latest]
24+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
2025
steps:
2126
- uses: actions/checkout@v4
22-
- name: Set up Python 3.8
27+
- name: Set up Python
2328
uses: actions/setup-python@v5
2429
with:
25-
python-version: 3.8
26-
27-
- name: Install build packages and pytest
28-
run: |
29-
python -m pip install --upgrade pip wheel setuptools
30-
python -m pip install "conan<2" scikit-build pytest cython numpy
31-
32-
- name: Create sdist
33-
run: python setup.py sdist
34-
35-
- name: Install python so3
36-
run: "pip install dist/so3-*.tar.gz"
37-
30+
python-version: ${{matrix.python-version}}
31+
- name: Install so3
32+
run: pip install ".[dev]"
3833
- name: run pytest
3934
run: pytest tests/
4035

36+
37+
build-sdist:
38+
name: Build source distribution
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
- name: Set up Python
43+
uses: actions/setup-python@v5
44+
with:
45+
python-version: 3.x
46+
- name: Upgrade pip and install build
47+
run: |
48+
python -m pip install --upgrade pip
49+
python -m pip install build
50+
- name: Build sdist
51+
run: python -m build --sdist
4152
- uses: actions/upload-artifact@v4
42-
if: ${{ startsWith(github.ref, 'refs/tags') }}
4353
with:
44-
path: ./dist/*.tar.gz
45-
name: source-distribution
54+
name: pkg-sdist
55+
path: dist/*.tar.gz
4656

4757

48-
build_wheels:
49-
name: Build wheels on ${{ matrix.os }}
50-
runs-on: ${{ matrix.os }}
58+
build-wheels:
59+
name: Build wheels on ${{matrix.os}} / Python ${{matrix.python-version}}
60+
runs-on: ${{matrix.os}}
5161
strategy:
62+
fail-fast: false
5263
matrix:
53-
os: [macos-latest]
54-
python-version: [3.8]
64+
os: [macos-latest, ubuntu-latest]
65+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
5566

5667
steps:
5768
- uses: actions/checkout@v4
58-
5969
- uses: actions/setup-python@v4
60-
name: Install Python
70+
name: Set up Python
6171
with:
6272
python-version: ${{ matrix.python-version }}
63-
64-
- name: Setup environment
73+
- name: Upgrade pip and install build
6574
run: |
66-
python -m pip install --upgrade pip wheel
67-
python -m pip install "conan<2" pytest
68-
conan profile new default --detect
69-
70-
- name: Build wheels
71-
run: pip wheel . --use-pep517 --no-deps -w dist
72-
73-
- name: install wheel
74-
run: "pip install dist/*.whl"
75-
76-
- name: run pytests
77-
run: pytest tests
78-
75+
python -m pip install --upgrade pip
76+
python -m pip install build
77+
- name: Build sdist
78+
run: python -m build --wheel
7979
- uses: actions/upload-artifact@v4
80-
if: ${{ startsWith(github.ref, 'refs/tags') }}
8180
with:
82-
path: ./dist/*.whl
83-
name: wheel-${{matrix.os}}-${{matrix.python-version}}
81+
name: pkg-wheel-${{matrix.os}}-python-${{matrix.python-version}}
82+
path: dist/*.whl
8483

85-
publication:
86-
name: publish to pypi
87-
if: ${{ startsWith(github.ref, 'refs/tags') }}
84+
publish:
85+
name: Publish to PyPI
86+
if: github.event_name == 'release' && github.event.action == 'published'
8887
runs-on: ubuntu-latest
89-
needs: [build_wheels, from-sdist]
88+
needs: [build-wheels, build-sdist]
9089
steps:
9190
- name: Download wheels and sdist
9291
uses: actions/download-artifact@v4
93-
94-
- name: Move wheels and source distribution to dist/
95-
run: |
96-
mkdir -p dist
97-
mv source-distribution/*.tar.gz wheel-*/*.whl dist
98-
92+
with:
93+
pattern: pkg-*
94+
path: dist
95+
merge-multiple: true
9996
- name: Publish distribution 📦 to Test PyPI
100-
if: ${{ github.ref != 'refs/tags/v1.3.6' }}
10197
uses: pypa/gh-action-pypi-publish@release/v1
10298
with:
10399
password: ${{ secrets.TEST_PYPI_TOKEN }}
104-
repository_url: https://test.pypi.org/legacy/
105-
100+
repository-url: https://test.pypi.org/legacy/
106101
- name: Publish distribution 📦 to PyPI
107-
if: ${{ github.ref == 'refs/tags/v1.3.6' }}
108102
uses: pypa/gh-action-pypi-publish@release/v1
109103
with:
110104
password: ${{ secrets.PYPI_TOKEN }}

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.12)
22
project(
33
so3
4-
VERSION "1.3.6"
4+
VERSION "1.3.7"
55
DESCRIPTION "Fast and exact Wigner transforms"
66
HOMEPAGE_URL "http://astro-informatics.github.io/so3/"
77
LANGUAGES C)

makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
CC = gcc
55

6-
#OPT = -Wall -O3 -fopenmp -DSO3_VERSION=\"0.1\" -DSO3_BUILD=\"`git rev-parse HEAD`\"
7-
OPT = -Wall -g -fopenmp -DSO3_VERSION=\"1.3.6\" -DSO3_BUILD=\"`git rev-parse HEAD`\"
6+
OPT = -Wall -g -fopenmp -DSO3_VERSION=\"1.3.7\" -DSO3_BUILD=\"`git rev-parse HEAD`\"
87

98

109
# ======== LINKS ========

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.3.6
2+
current_version = 1.3.7
33
commit = False
44
tag = False
55
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(rc(?P<rc>\d+))?

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setup(
1212
name="so3",
13-
version="1.3.6",
13+
version="1.3.7",
1414
author="Jason McEwen",
1515
install_requires=["numpy", "scipy"],
1616
extras_require={
@@ -35,4 +35,5 @@
3535
packages=["so3"],
3636
long_description=Path(__file__).with_name("README.md").read_text(),
3737
long_description_content_type="text/markdown",
38+
python_requires=">=3.8"
3839
)

0 commit comments

Comments
 (0)