Skip to content

Commit bd458ea

Browse files
Jhsmitcvanelteren
andauthored
update python versions and dependencies in pyproject.toml (#20)
--------- Co-authored-by: cvanelteren <caspervanelteren@gmail.com>
1 parent 81f00e8 commit bd458ea

45 files changed

Lines changed: 131 additions & 26 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-docs.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
name: Build docs
22
on:
3-
push:
4-
branches: [main]
5-
pull_request:
6-
branches: [main]
3+
workflow_call:
4+
inputs:
5+
python-version:
6+
required: true
7+
type: string
78

89
jobs:
9-
build:
10+
build-docs:
1011
runs-on: ubuntu-latest
1112
timeout-minutes: 15
1213
steps:
@@ -16,6 +17,7 @@ jobs:
1617
environment-file: ./environment-dev.yml
1718
init-shell: bash
1819
create-args: --verbose
20+
python=${{ inputs.python-version }}
1921
cache-environment: true
2022
cache-downloads: false
2123

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
name: Build and Test
22
on:
3-
push:
4-
branches: [main]
5-
pull_request:
6-
branches: [main]
3+
workflow_call:
4+
inputs:
5+
python-version:
6+
required: true
7+
type: string
78

89
jobs:
9-
build:
10+
build-ultraplot:
11+
name: Test Python ${{ inputs.python-version }}
1012
runs-on: ubuntu-latest
1113
timeout-minutes: 15
1214
steps:
@@ -15,13 +17,44 @@ jobs:
1517
with:
1618
environment-file: ./environment-dev.yml
1719
init-shell: bash
18-
create-args: --verbose
20+
create-args: >-
21+
--verbose
22+
python=${{ inputs.python-version }}
1923
cache-environment: true
2024
cache-downloads: false
2125

22-
- name: Test Ultraplot
26+
- name: Build Ultraplot
2327
shell: bash -el {0}
2428
run: |
2529
micromamba activate ultraplot-dev
2630
pip install .
27-
python -m pytest
31+
32+
- name: Generate baseline from main
33+
shell: bash -el {0}
34+
run: |
35+
mkdir -p baseline
36+
micromamba activate ultraplot-dev
37+
git fetch origin ${{ github.event.pull_request.base.sha }}
38+
git checkout ${{ github.event.pull_request.base.sha }}
39+
pytest --mpl-generate-path=baseline_images
40+
git checkout ${{ github.sha }} # Return to PR branch
41+
42+
- name: Test Ultraplot
43+
shell: bash -el {0}
44+
run: |
45+
micromamba activate ultraplot-dev
46+
pytest
47+
48+
# - name: Image Comparison Ultraplot
49+
# shell: bash -el {0}
50+
# run: |
51+
# micromamba activate ultraplot-dev
52+
# pytest --mpl --mpl-baseline-path=baseline_images
53+
54+
# # return the images that failed
55+
# - name: Upload comparison failures
56+
# if: failure()
57+
# uses: actions/upload-artifact@v4
58+
# with:
59+
# name: failed-comparisons
60+
# path: result_images

.github/workflows/linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
branches: [main]
77

88
jobs:
9-
build:
9+
linter:
1010
runs-on: ubuntu-latest
1111
timeout-minutes: 15
1212
steps:

.github/workflows/main.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Matrix Test
2+
on:
3+
push:
4+
branches: [main, devel]
5+
pull_request:
6+
branches: [main, devel]
7+
8+
jobs:
9+
get-python-versions:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
python-versions: ${{ steps.set-versions.outputs.python-versions }}
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-python@v4
16+
with:
17+
python-version: "3.11"
18+
19+
- name: Install dependencies
20+
run: pip install tomli
21+
22+
- id: set-versions
23+
run: |
24+
# Create a Python script to read and parse versions
25+
cat > get_versions.py << 'EOF'
26+
import tomli
27+
import re
28+
import json
29+
30+
# Read pyproject.toml
31+
with open("pyproject.toml", "rb") as f:
32+
data = tomli.load(f)
33+
34+
# Get Python version requirement
35+
python_req = data["project"]["requires-python"]
36+
37+
# Parse min and max versions
38+
min_version = re.search(r">=(\d+\.\d+)", python_req)
39+
max_version = re.search(r"<(\d+\.\d+)", python_req)
40+
41+
versions = []
42+
if min_version and max_version:
43+
# Convert version strings to tuples
44+
min_v = tuple(map(int, min_version.group(1).split(".")))
45+
max_v = tuple(map(int, max_version.group(1).split(".")))
46+
47+
# Generate version list
48+
current = min_v
49+
while current < max_v:
50+
versions.append(".".join(map(str, current)))
51+
current = (current[0], current[1] + 1)
52+
53+
# Print as JSON array
54+
print(json.dumps(versions))
55+
EOF
56+
57+
# Run the script and capture output
58+
VERSIONS=$(python3 get_versions.py)
59+
echo "Detected versions: ${VERSIONS}" # Debug output
60+
echo "python-versions=${VERSIONS}" >> $GITHUB_OUTPUT
61+
62+
build:
63+
needs: get-python-versions
64+
strategy:
65+
matrix:
66+
python-version: ${{ fromJson(needs.get-python-versions.outputs.python-versions) }}
67+
locale: ["en_US.UTF-8", "C.UTF-8"]
68+
fail-fast: false
69+
uses: ./.github/workflows/build-ultraplot.yml
70+
with:
71+
python-version: ${{ matrix.python-version }}

environment-dev.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: ultraplot-dev
22
channels:
33
- conda-forge
44
dependencies:
5-
- python==3.12
6-
- numpy>=2.2
7-
- matplotlib>=3.9.3
5+
- python>=3.9, <3.13
6+
- numpy>=1.20.0
7+
- matplotlib>=3.9
88
- cartopy
99
- xarray
1010
- seaborn
@@ -21,5 +21,5 @@ dependencies:
2121
- nbsphinx
2222
- sphinx-copybutton
2323
- sphinx-autoapi
24-
- git+https://github.com/cvanelteren/sphinx-rtd-light-dark.git@mplv3.9.1
24+
- git+https://github.com/ultraplot/UltraTheme.git@mplv3.9.1
2525
- sphinx-automodapi

environment.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ channels:
33
- conda-forge
44
- nodefaults
55
dependencies:
6-
- python >=3.9
6+
- python >=3.9, <3.13
77
- pytest
88
- pytest-mpl
9-
- numpy
10-
- matplotlib>=3.9.2
9+
- numpy>=1.20.0
10+
- matplotlib>=3.9
1111
- pip

pyproject.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["setuptools>=64",
33
"setuptools_scm[toml]>=8",
44
"wheel",
55
"numpy>=1.26.0",
6-
"matplotlib>=3.9.1",
6+
"matplotlib>=3.9",
77
]
88
build-backend = "setuptools.build_meta"
99

@@ -19,22 +19,21 @@ maintainers = [
1919
]
2020
description = "A succinct matplotlib wrapper for making beautiful, publication-quality graphics."
2121
readme = "README.rst"
22-
requires-python = ">=3.6.0"
22+
requires-python = ">=3.9,<3.13"
2323
license = {text = "MIT"}
2424
classifiers = [
2525
"License :: OSI Approved :: MIT License",
2626
"Operating System :: OS Independent",
2727
"Intended Audience :: Science/Research",
2828
"Programming Language :: Python :: 3 :: Only",
29-
"Programming Language :: Python :: 3.8",
3029
"Programming Language :: Python :: 3.9",
3130
"Programming Language :: Python :: 3.10",
3231
"Programming Language :: Python :: 3.11",
3332
"Programming Language :: Python :: 3.12",
3433
]
3534
dependencies= [
36-
'importlib-metadata; python_version>"3.8"',
37-
35+
"numpy>=1.26.0",
36+
"matplotlib>=3.9"
3837
]
3938
dynamic = ["version"]
4039

-20 Bytes
-52.7 KB
Binary file not shown.
-171 Bytes

0 commit comments

Comments
 (0)