Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
bgilbert committed Nov 10, 2023
1 parent 72eb0d1 commit f9e9ebf
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 12 deletions.
13 changes: 2 additions & 11 deletions .github/ISSUE_TEMPLATE/python-bump.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
# Adding wheels for a new Python release
# Adding a new Python release

- Update Git main
- [ ] `git checkout main`
- [ ] Add classifier for new Python version to `setup.py`
- [ ] Add classifier for new Python version to `pyproject.toml'
- [ ] Add new Python version to lists in `.github/workflows/python.yml`
- [ ] Commit and open a PR
- [ ] Merge the PR when CI passes
- [ ] Add new Python jobs to [branch protection required checks](https://github.com/openslide/openslide-python/settings/branches)
- Build new wheels
- [ ] Check out a new branch from the most recent release tag
- [ ] Add new Python version to lists in `.github/workflows/python.yml`, commit, and open a DNM PR
- [ ] Find the [workflow run](https://github.com/openslide/openslide-python/actions) for the PR; download its wheels artifact
- [ ] Close the PR
- [ ] In OpenSlide Python checkout, `git checkout v<version> && git clean -dxf && mkdir dist`
- [ ] Copy downloaded wheels _from new Python release only_ into `dist` directory
- [ ] `twine upload dist/*`
- [ ] Upload new wheels to [GitHub release](https://github.com/openslide/openslide-python/releases)
- [ ] Update MacPorts package
- [ ] Update website: Python 3 versions in `download/index.md`
43 changes: 43 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,47 @@ jobs:
os: [ubuntu-latest, macos-latest]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
include:
- os: ubuntu-latest
python-version: 3.8
# can't use abi3
wheel: wheel
- os: ubuntu-latest
python-version: 3.9
# can't use abi3
wheel: wheel
- os: ubuntu-latest
python-version: "3.10"
# can't use abi3
wheel: wheel
- os: ubuntu-latest
python-version: "3.11"
# oldest supported release that can use abi3
wheel: wheel
- os: ubuntu-latest
python-version: "3.12"
sdist: sdist
- os: macos-latest
python-version: "3.8"
# can't use abi3
wheel: wheel
# Python 3.8 is too old to support universal binaries, and
# setup-python's Python 3.9 and 3.10 won't build them. Use the
# last upstream patch releases that ship with installers.
# https://github.com/actions/setup-python/issues/439#issuecomment-1247646682
- os: macos-latest
python-version: "3.9"
upstream-python: 3.9.13
# can't use abi3
wheel: wheel
- os: macos-latest
python-version: "3.10"
upstream-python: 3.10.11
# can't use abi3
wheel: wheel
- os: macos-latest
python-version: "3.11"
# oldest supported release that can use abi3
wheel: wheel
steps:
- name: Check out repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -113,6 +141,7 @@ jobs:
- name: Tile slide
run: python examples/deepzoom/deepzoom_tile.py --viewer -o tiled tests/fixtures/small.svs
- name: Archive wheel
if: matrix.wheel
uses: actions/upload-artifact@v3
with:
name: ${{ env.basename }}
Expand All @@ -129,6 +158,19 @@ jobs:
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
include:
- python-version: 3.8
# can't use abi3
wheel: wheel
- python-version: 3.9
# can't use abi3
wheel: wheel
- python-version: 3.10
# can't use abi3
wheel: wheel
- python-version: 3.11
# oldest supported release that can use abi3
wheel: wheel
steps:
- name: Check out repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -170,6 +212,7 @@ jobs:
# Reads OPENSLIDE_PATH
run: python examples/deepzoom/deepzoom_tile.py --viewer -o tiled tests/fixtures/small.svs
- name: Archive wheel
if: matrix.wheel
uses: actions/upload-artifact@v3
with:
name: ${{ env.basename }}
Expand Down
17 changes: 16 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
import sys

from setuptools import Extension, setup

# use the limited API on newer Python; build release-specific wheels on
# older Python
_use_limited = sys.version_info >= (3, 11)

setup(
ext_modules=[
Extension('openslide._convert', ['openslide/_convert.c']),
Extension(
'openslide._convert',
['openslide/_convert.c'],
# hide symbols that aren't part of the Limited API
define_macros=[('Py_LIMITED_API', '0x030B0000')] if _use_limited else [],
# set extension module ABI tag
py_limited_api=_use_limited,
),
],
# set wheel ABI tag
options={"bdist_wheel": {"py_limited_api": "cp311"}} if _use_limited else {},
)

0 comments on commit f9e9ebf

Please sign in to comment.