Skip to content

Commit

Permalink
Remove support for Python 3.8 (#29)
Browse files Browse the repository at this point in the history
- Added support for 3.13
  • Loading branch information
jkanche authored Dec 23, 2024
1 parent e03b460 commit 5b6edef
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 68 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@ on:
- "*"

jobs:
test:
build_docs:
name: Build docs
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/checkout@v4

- name: Set up Python 3.9
uses: actions/setup-python@v2
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.12
cache: 'pip'

- name: Set up HDF5
Expand All @@ -29,7 +27,10 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools
pip install cmake pybind11 numpy tox
DEPENDENCIES=$(python -c 'from setuptools.config.setupcfg import read_configuration as c; a = c("setup.cfg"); print(" ".join(a["options"]["install_requires"][1:]))')
pip install ${DEPENDENCIES}
DOCDEPENDENCIES=$(python -c 'with open("docs/requirements.txt") as a: available = list(a); print(" ".join(map(lambda x : x.strip(), filter(lambda x : not x.startswith("#"), available))))')
pip install ${DOCDEPENDENCIES}
- name: Build docs
run: |
Expand All @@ -39,8 +40,9 @@ jobs:
touch ./docs/_build/html/.nojekyll
- name: GH Pages Deployment
uses: JamesIves/[email protected]
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: ./docs/_build/html
clean: true # Automatically remove deleted files from the deploy branch
clean: true # Automatically remove deleted files from the deploy branch
56 changes: 28 additions & 28 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,28 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS: x86_64
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
CIBW_MANYLINUX_X86_64_IMAGE: ghcr.io/artifactdb/prebuilt-hdf5/manylinux_x86_64:0.0.4
CIBW_MUSLLINUX_X86_64_IMAGE: ghcr.io/artifactdb/prebuilt-hdf5/musllinux_x86_64:0.0.4
CIBW_SKIP: pp*

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-ubuntu-x86_64
path: ./wheelhouse/*.whl

build_macosx_x86_64:
name: Build wheels for macosx x86_64
runs-on: macos-13
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Grab prebuilt dependencies
run: |
Expand All @@ -42,22 +43,23 @@ jobs:
uses: pypa/[email protected]
env:
CIBW_ARCHS: x86_64
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
CIBW_ENVIRONMENT: "MORE_CMAKE_OPTIONS=\"-DCMAKE_INSTALL_PREFIX=$(pwd)/installed -DCMAKE_OSX_ARCHITECTURES=x86_64\""
CIBW_BUILD_VERBOSITY: 3
CIBW_SKIP: pp*
MACOSX_DEPLOYMENT_TARGET: 11.7

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-macos-x86_64
path: ./wheelhouse/*.whl

build_macosx_arm64:
name: Build wheels for macosx arm64
runs-on: macos-13
runs-on: macos-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Grab prebuilt dependencies
run: |
Expand All @@ -68,79 +70,77 @@ jobs:
uses: pypa/[email protected]
env:
CIBW_ARCHS: arm64
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
CIBW_ENVIRONMENT: "MORE_CMAKE_OPTIONS=\"-DCMAKE_INSTALL_PREFIX=$(pwd)/installed -DCMAKE_OSX_ARCHITECTURES=arm64\""
CIBW_BUILD_VERBOSITY: 3
MACOSX_DEPLOYMENT_TARGET: 13.0

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-maxos_arm64
path: ./wheelhouse/*.whl

# build_windows_x86_64:
# name: Build wheels for windows x86_64
# runs-on: windows-2019
# steps:
# - name: Check out repository
# uses: actions/checkout@v3

# uses: actions/checkout@v4
#
# - name: Grab prebuilt dependencies
# run: |
# curl -L https://github.com/ArtifactDB/prebuilt-hdf5/releases/download/0.0.4/windows_x86_64.tar.gz > bundle.tar.gz
# tar -xvf bundle.tar.gz
# shell: bash

#
# - name: Store path
# run: |
# $wd = pwd
# echo "INSTALL_DIR=$wd\\installed" >> $env:GITHUB_ENV
# shell: powershell

#
# - name: Build wheels
# uses: pypa/[email protected]
# env:
# CIBW_ARCHS: AMD64
# CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
# CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
# CIBW_ENVIRONMENT: "MORE_CMAKE_OPTIONS=\"-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}\" VERBOSE=1"
# CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
# CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}"
# CIBW_TEST_EXTRAS: "testing"
# CIBW_TEST_COMMAND: "pytest {package}/tests"
# CIBW_BUILD_VERBOSITY: 3

# - uses: actions/upload-artifact@v3
# with:
# path: ./wheelhouse/*.whl
# - uses: actions/upload-artifact@v3
# with:
# path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_pypi:
needs: [build_linux_x86_64, build_macosx_x86_64, build_macosx_arm64, build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
pattern: cibw-*
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@v1.8.3
- uses: pypa/gh-action-pypi-publish@v1.12.2
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
39 changes: 10 additions & 29 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,37 @@
name: Run unit tests
name: Test the library

on:
push:
branches: [ master ]
branches:
- master
pull_request:
branches: [ master ]

jobs:
test:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

name: Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache: "pip"

- name: Set up HDF5
run: |
sudo apt-get update
sudo apt-get install libhdf5-dev
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools
DEPENDENCIES=$(python -c 'from setuptools.config.setupcfg import read_configuration as c; a = c("setup.cfg"); print(" ".join(a["options"]["install_requires"][1:] + a["options"]["extras_require"]["testing"][1:]))')
pip install ${DEPENDENCIES} pybind11
- name: Get latest CMake
uses: lukka/get-cmake@latest

# We do proper tests if we're on the master branch, or if we're creating a new release.
- name: Test with tox
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
run: |
pip install tox
tox
# Otherwise we do some cached builds and tests for faster merging of PRs.
- name: Set up ccache
if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags')
uses: hendrikmuhs/[email protected]

- name: Quickly build and test
if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags')
run: |
CC="ccache gcc" python setup.py install
pytest
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
exclude: '^docs/conf.py'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
- id: check-ast
- id: check-json
- id: check-merge-conflict
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: mixed-line-ending
args: ['--fix=auto'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

## Check for misspells in documentation files:
# - repo: https://github.com/codespell-project/codespell
# rev: v2.2.5
# hooks:
# - id: codespell
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Version 0.4.0

- chore: Remove Python 3.8 (EOL).
- precommit: Replace docformatter with ruff's formatter.

## Version 0.3.0

- Fixes to support NumPy 2.0 release.
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
furo
myst-nb
# Requirements file for ReadTheDocs, check .readthedocs.yml.
# To build the module reference correctly, make sure every external package
# under `install_requires` in `setup.cfg` is also listed here!
Expand Down
16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,19 @@ build-backend = "setuptools.build_meta"
# For smarter version schemes and other configuration options,
# check out https://github.com/pypa/setuptools_scm
version_scheme = "no-guess-dev"

[tool.ruff]
line-length = 120
src = ["src"]
exclude = ["tests"]
extend-ignore = ["F821"]

[tool.ruff.pydocstyle]
convention = "google"

[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 20

[tool.ruff.per-file-ignores]
"__init__.py" = ["E402", "F401"]
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ package_dir =
=src

# Require a min/specific Python version (comma-separated conditions)
python_requires = >=3.8
python_requires = >=3.9

# Add here dependencies of your project (line-separated), e.g. requests>=2.2,<3.0.
# Version specifiers like >=2.2,<3.0 avoid problems due to API changes in
Expand Down

0 comments on commit 5b6edef

Please sign in to comment.