Skip to content

Commit baba412

Browse files
committed
Merge remote-tracking branch 'upstream/main' into 2024.04
2 parents 794bc0a + c487eb3 commit baba412

File tree

4 files changed

+152
-17
lines changed

4 files changed

+152
-17
lines changed

.github/workflows/release.yml

+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
name: Build and deploy
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types:
7+
- published
8+
9+
jobs:
10+
build_sdist:
11+
name: Build source distribution
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: "3.12"
18+
cache: "pip"
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install build twine
23+
- name: Build sdist
24+
run: python -m build --sdist
25+
- name: Check the package
26+
run: python -m twine check dist/*
27+
- uses: actions/upload-artifact@v4
28+
with:
29+
name: cibw-sdist
30+
path: dist/*.tar.gz
31+
32+
test_sdist:
33+
needs: [build_sdist]
34+
name: Test source distribution
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: actions/setup-python@v5
39+
with:
40+
python-version: "3.12"
41+
cache: "pip"
42+
- uses: actions/download-artifact@v4
43+
with:
44+
name: cibw-sdist
45+
path: dist
46+
- name: Install from sdist
47+
run: pip install "$(ls dist/fabio-*.tar.gz)"
48+
- name: Run tests
49+
run: python -c "import fabio.test, sys; sys.exit(fabio.test.run_tests())"
50+
51+
build_doc:
52+
name: Build documentation
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/checkout@v4
56+
- uses: actions/setup-python@v5
57+
with:
58+
python-version: "3.12"
59+
cache: "pip"
60+
- name: Install pandoc&graphviz
61+
run: sudo apt-get install pandoc graphviz
62+
- name: Install fabio
63+
run: pip install .
64+
- name: Install documentation dependencies
65+
run: pip install -r requirements.txt
66+
- name: Build doc
67+
env:
68+
READTHEDOCS: "True" # To skip checking that fabio is installed locally
69+
run: |
70+
export FABIO_VERSION="$(python -c 'import fabio; print(fabio.strictversion)')"
71+
sphinx-build doc/source/ "fabio-${FABIO_VERSION}_documentation/"
72+
zip -r "fabio-${FABIO_VERSION}_documentation.zip" "fabio-${FABIO_VERSION}_documentation/"
73+
- uses: actions/upload-artifact@v4
74+
with:
75+
name: documentation
76+
path: fabio-*_documentation.zip
77+
78+
build_wheels:
79+
name: Build wheels on ${{ matrix.os }}-${{ matrix.cibw_archs }}
80+
runs-on: ${{ matrix.os }}
81+
strategy:
82+
# Ensure that a wheel builder finishes even if another fails
83+
fail-fast: false
84+
matrix:
85+
include:
86+
- os: ubuntu-20.04
87+
cibw_archs: "auto64"
88+
- os: ubuntu-20.04
89+
cibw_archs: "aarch64"
90+
- os: ubuntu-20.04
91+
cibw_archs: "ppc64le"
92+
- os: windows-2019
93+
cibw_archs: "auto64"
94+
- os: macos-11
95+
cibw_archs: "x86_64"
96+
macos_target: "10.9"
97+
- os: macos-14
98+
cibw_archs: "arm64"
99+
macos_target: "11.0"
100+
101+
steps:
102+
- uses: actions/checkout@v4
103+
- uses: docker/setup-qemu-action@v3
104+
if: runner.os == 'Linux'
105+
with:
106+
platforms: all
107+
- uses: pypa/[email protected]
108+
env:
109+
# Use silx wheelhouse: needed for ppc64le
110+
CIBW_ENVIRONMENT_LINUX: "PIP_FIND_LINKS=https://www.silx.org/pub/wheelhouse/ PIP_TRUSTED_HOST=www.silx.org"
111+
112+
CIBW_BUILD: cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*
113+
# Do not build for pypy and muslinux
114+
CIBW_SKIP: pp* *-musllinux_*
115+
CIBW_ARCHS: ${{ matrix.cibw_archs }}
116+
117+
MACOSX_DEPLOYMENT_TARGET: "${{ matrix.macos_target }}"
118+
119+
# Install test dependencies
120+
CIBW_TEST_COMMAND: python -c "import fabio.test, sys; sys.exit(fabio.test.run_tests())"
121+
# Skip tests for emulated architectures
122+
# and Python3.8 on macos/arm64 (https://github.com/pypa/cibuildwheel/pull/1169)
123+
CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} cp38-macosx_arm64"
124+
125+
- uses: actions/upload-artifact@v4
126+
with:
127+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
128+
path: ./wheelhouse/*.whl
129+
130+
pypi-publish:
131+
needs: [build_doc, build_sdist, build_wheels, test_sdist]
132+
name: Upload release to PyPI
133+
runs-on: ubuntu-latest
134+
environment:
135+
name: pypi
136+
permissions:
137+
id-token: write
138+
if: github.event_name == 'release' && github.event.action == 'published'
139+
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
140+
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
141+
steps:
142+
- uses: actions/download-artifact@v4
143+
with:
144+
pattern: cibw-*
145+
path: dist
146+
merge-multiple: true
147+
- uses: pypa/gh-action-pypi-publish@release/v1

doc/source/conf.py

+4-15
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313

1414
import sys
1515
import os
16-
import glob
17-
import subprocess
1816

19-
on_rtd = os.environ.get('READTHEDOCS') == 'True'
2017
# If extensions (or modules to document with autodoc) are in another directory,
2118
# add these directories to sys.path here. If the directory is relative to the
2219
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -26,7 +23,7 @@
2623
import fabio
2724
project_dir = os.path.abspath(os.path.join(__file__, "..", "..", ".."))
2825
build_dir = os.path.abspath(fabio.__file__)
29-
if on_rtd:
26+
if os.environ.get('READTHEDOCS') == 'True':
3027
print("On Read The Docs")
3128
print("build_dir", build_dir)
3229
print("project_dir", project_dir)
@@ -55,19 +52,11 @@
5552

5653
extensions = ['sphinx.ext.autodoc',
5754
'sphinx.ext.mathjax',
55+
'sphinx_rtd_theme',
5856
'sphinxcontrib.programoutput',
5957
'nbsphinx'
6058
]
6159

62-
# Set the theme to sphinx_rtd_theme when *not* building on Read The Docs.
63-
# The theme is set to default otherwise as Read The Docs uses its own theme anyway.
64-
if not on_rtd:
65-
try:
66-
import sphinx_rtd_theme
67-
extensions.append('sphinx_rtd_theme')
68-
except:
69-
print("sphinx_rtd_theme is not available")
70-
7160
# Add any paths that contain templates here, relative to this directory.
7261
templates_path = ['_templates']
7362

@@ -81,7 +70,7 @@
8170
master_doc = 'index'
8271

8372
# General information about the project.
84-
from fabio.version import strictversion, version, __date__ as fabio_date
73+
from fabio.version import strictversion, __date__ as fabio_date
8574

8675
year = fabio_date.split("/")[-1]
8776
copyright = u'2006-%s, Henning Sorensen, Erik Knudsen, Jon Wright, Gael Goret, Brian Pauw and Jerome Kieffer' % (year)
@@ -136,7 +125,7 @@
136125

137126
# The theme to use for HTML and HTML Help pages. See the documentation for
138127
# a list of builtin themes.
139-
html_theme = 'default' if on_rtd else 'sphinx_rtd_theme'
128+
html_theme = 'sphinx_rtd_theme'
140129

141130
# Theme options are theme-specific and customize the look and feel of a theme
142131
# further. For a list of options available for each theme, see the

pyproject.toml

-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ requires = [
5555
'ninja',
5656
'wheel',
5757
'Cython>=0.29',
58-
"numpy<1.26.0; platform_machine == 'ppc64le'",
59-
"numpy; platform_machine != 'ppc64le'",
6058
'pyproject-metadata>=0.5.0',
6159
'tomli>=1.0.0'
6260
]

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ hdf5plugin
1111
sphinx
1212
sphinxcontrib-programoutput
1313
sphinx-rtd-theme
14+
nbsphinx

0 commit comments

Comments
 (0)