Skip to content

Commit

Permalink
ci: make python versions consistent, add other systems (#494)
Browse files Browse the repository at this point in the history
* ci: make python versions consistent, add other systems

* ci: remove some of the macos runners

* ci: fix typo

* ci: fix typo

* ci: remove pinned pre-commit deps
  • Loading branch information
jonas-eschle authored Apr 30, 2024
1 parent 58019e9 commit e7ab8f3
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 54 deletions.
78 changes: 40 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:
# Run daily at 0:01 UTC
schedule:
- cron: '1 0 * * *'
- cron: '1 0 * * *'

jobs:

Expand All @@ -16,42 +16,44 @@ jobs:
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
runs-on: [ubuntu-latest]
python-version: ["3.8", "3.10", "3.11"]
include:
- runs-on: macOS-latest
python-version: "3.8"
- runs-on: macOS-latest
python-version: "3.11"
runs-on: [ ubuntu-latest ]
python-version: [ "3.8", "3.10", "3.11", "3.12" ]
include: # testing the last "reasonable supported" version
- runs-on: macOS-13
python-version: "3.9"
- runs-on: macOS-14
python-version: "3.10" # min version available for Apple silicon
- runs-on: windows-latest
python-version: "3.9"

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install core fonts
if: runner.os == 'Linux'
run: |
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
sudo apt-get install ttf-mscorefonts-installer
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel pytest-github-actions-annotate-failures
python -m pip install -q --no-cache-dir -e .[all]
python -m pip list
- name: Test with pytest
run: |
python -m pytest -r sa --mpl --mpl-results-path=pytest_results
- name: Upload pytest test results
uses: actions/upload-artifact@v3
if: failure()
with:
name: pytest_results-${{ matrix.python-version }}-${{ matrix.runs-on }}
retention-days: 3
path: pytest_results
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install core fonts
if: runner.os == 'Linux'
run: |
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
sudo apt-get install ttf-mscorefonts-installer
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel pytest-github-actions-annotate-failures
python -m pip install -q --no-cache-dir -e .[all]
python -m pip list
- name: Test with pytest
run: |
python -m pytest -r sa --mpl --mpl-results-path=pytest_results
- name: Upload pytest test results
uses: actions/upload-artifact@v3
if: failure()
with:
name: pytest_results-${{ matrix.python-version }}-${{ matrix.runs-on }}
retention-days: 3
path: pytest_results
10 changes: 5 additions & 5 deletions .github/workflows/head-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-13]
python-version: ['3.11']
os: [ubuntu-latest, macos-13, macos-14, windows-latest]
python-version: ['3.12']

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.11']
python-version: ['3.12']

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.11']
python-version: ['3.12']

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.11']
python-version: ['3.12']

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ repos:
rev: "v2.5.0"
hooks:
- id: setup-cfg-fmt
args: ["--include-version-classifiers", "--max-py-version=3.11"]
args: ["--include-version-classifiers", "--max-py-version=3.12"]

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.5
hooks:
- id: nbqa-pyupgrade
additional_dependencies: [pyupgrade==2.31.0]
additional_dependencies: [pyupgrade]
args: ["--py38-plus"]

- repo: https://github.com/psf/black-pre-commit-mirror
Expand All @@ -49,7 +49,7 @@ repos:
hooks:
- id: mypy
files: src
additional_dependencies: ["uhi~=0.3.1", "numpy~=1.24.0", "matplotlib>3.4"]
additional_dependencies: ["uhi", "numpy", "matplotlib>3.4"]
args: [--show-error-codes]

- repo: https://github.com/codespell-project/codespell
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ classifiers =
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Topic :: Scientific/Engineering :: Physics

[options]
Expand Down
9 changes: 1 addition & 8 deletions src/mplhep/_compat.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
from __future__ import annotations

import matplotlib
from packaging.version import parse as parse_version

if parse_version(matplotlib.__version__) < parse_version("3.8.0"):
from matplotlib import docstring # type: ignore[attr-defined]
else:
from matplotlib import _docstring as docstring # type: ignore[attr-defined]

from matplotlib import _docstring as docstring # type: ignore[attr-defined]

__all__ = ("docstring",)

0 comments on commit e7ab8f3

Please sign in to comment.