Skip to content

Commit 4f34d48

Browse files
authored
Update Python support (#33)
* Update Python support * Match latest zstash and zppy python support * Address comments
1 parent a8a819d commit 4f34d48

File tree

4 files changed

+42
-27
lines changed

4 files changed

+42
-27
lines changed

.github/workflows/build_workflow.yml

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,26 @@ jobs:
3737
- name: Checkout Code Repository
3838
uses: actions/checkout@v3
3939

40-
- name: Set up Python
40+
- name: Set up Python 3.13
4141
uses: actions/setup-python@v4
4242
with:
43-
python-version: 3.9
43+
python-version: 3.13
4444

4545
# Run all pre-commit hooks on all the files.
4646
# Getting only staged files can be tricky in case a new PR is opened
4747
# since the action is run on a branch in detached head state.
4848
# This is the equivalent of running "pre-commit run --all-files" locally.
4949
# If you commit with the `--no-verify` flag, this check may fail.
5050
- name: Install and Run Pre-commit
51-
uses: pre-commit/[email protected].0
51+
uses: pre-commit/[email protected].1
5252

5353
build:
5454
needs: check-jobs-to-skip
5555
if: ${{ needs.check-jobs-to-skip.outputs.should_skip != 'true' }}
5656
runs-on: ubuntu-latest
57+
strategy:
58+
matrix:
59+
python-version: ["3.11", "3.12", "3.13"]
5760
defaults:
5861
run:
5962
shell: bash -l {0}
@@ -63,11 +66,11 @@ jobs:
6366
- name: Cache Conda
6467
uses: actions/cache@v3
6568
env:
66-
CACHE_NUMBER: 0
69+
CACHE_NUMBER: 1 # Increment this to invalidate cache
6770
with:
6871
path: ~/conda_pkgs_dir
6972
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
70-
hashFiles('conda/dev.yml') }}
73+
hashFiles('conda/dev.yml') }}-python${{ matrix.python-version }}
7174

7275
- name: Build Conda Environment
7376
uses: conda-incubator/setup-miniconda@v3
@@ -76,8 +79,23 @@ jobs:
7679
miniforge-variant: Miniforge3
7780
miniforge-version: latest
7881
environment-file: conda/dev.yml
79-
channel-priority: strict
82+
channel-priority: flexible # Changed from strict to flexible
8083
auto-update-conda: true
84+
python-version: ${{ matrix.python-version }}
85+
channels: conda-forge
86+
use-only-tar-bz2: true
87+
88+
- name: Verify Environment and Fix Dependencies
89+
run: |
90+
conda info
91+
conda list
92+
# Ensure we have the right Python version
93+
python --version
94+
# Fix pip issues for Python 3.12+
95+
if [[ "${{ matrix.python-version }}" == "3.12" ]] || [[ "${{ matrix.python-version }}" == "3.13" ]]; then
96+
python -m ensurepip --upgrade || true
97+
python -m pip install --upgrade --force-reinstall pip setuptools wheel
98+
fi
8199
82100
- if: ${{ needs.check-jobs-to-skip.outputs.should_skip != 'true' }}
83101
name: Show Conda Environment Info
@@ -87,7 +105,7 @@ jobs:
87105
conda list
88106
89107
- name: Install `zppy-interfaces` Package
90-
run: pip install .
108+
run: python -m pip install .
91109

92110
# Does not run the integration tests, which require server access
93111
- name: Run Unit Tests
@@ -101,7 +119,7 @@ jobs:
101119
defaults:
102120
run:
103121
shell: bash -l {0}
104-
timeout-minutes: 5
122+
timeout-minutes: 10 # Increased timeout for docs
105123
steps:
106124
- uses: actions/checkout@v2
107125
with:
@@ -111,11 +129,11 @@ jobs:
111129
- name: Cache Conda
112130
uses: actions/cache@v3
113131
env:
114-
CACHE_NUMBER: 0
132+
CACHE_NUMBER: 1 # Match the build job cache number
115133
with:
116134
path: ~/conda_pkgs_dir
117135
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
118-
hashFiles('conda/dev.yml') }}
136+
hashFiles('conda/dev.yml') }}-docs
119137

120138
- name: Build Conda Environment
121139
uses: conda-incubator/setup-miniconda@v3
@@ -124,8 +142,9 @@ jobs:
124142
miniforge-variant: Miniforge3
125143
miniforge-version: latest
126144
environment-file: conda/dev.yml
127-
channel-priority: strict
145+
channel-priority: flexible # Changed from strict to flexible
128146
auto-update-conda: true
147+
python-version: "3.13" # Use stable Python version for docs
129148

130149
- if: ${{ needs.check-jobs-to-skip.outputs.should_skip != 'true' }}
131150
name: Show Conda Environment Info

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,29 @@ repos:
1313

1414
# Can run individually with `pre-commit run black --all-files`
1515
- repo: https://github.com/psf/black
16-
rev: 24.10.0
16+
rev: 25.1.0
1717
hooks:
1818
- id: black
1919

2020
# Can run individually with `pre-commit run isort --all-files`
2121
- repo: https://github.com/PyCQA/isort
22-
rev: 5.13.2
22+
rev: 6.0.1
2323
hooks:
2424
- id: isort
2525

2626
# Can run individually with `pre-commit run flake8 --all-files`
2727
# Need to use flake8 GitHub mirror due to CentOS git issue with GitLab
2828
# https://github.com/pre-commit/pre-commit/issues/1206
2929
- repo: https://github.com/pycqa/flake8
30-
rev: 7.1.1
30+
rev: 7.3.0
3131
hooks:
3232
- id: flake8
3333
args: ["--config=.flake8"]
3434
additional_dependencies: [flake8-isort==6.1.1]
3535

3636
# Can run individually with `pre-commit run mypy --all-files`
3737
- repo: https://github.com/pre-commit/mirrors-mypy
38-
rev: v1.11.2
38+
rev: v1.18.2
3939
hooks:
4040
- id: mypy
4141
args: ["--config=pyproject.toml"]

conda/dev.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
name: zppy-interfaces-dev
33
channels:
44
- conda-forge
5-
- defaults
65
dependencies:
76
# Build
87
# =======================
9-
- python >=3.9
8+
- python >=3.11,<3.14
109
- pip
1110
- setuptools >= 60
1211
# Base
@@ -33,12 +32,11 @@ dependencies:
3332
# =======================
3433
# Run `pre-commit autoupdate` to get the latest pinned versions of 'rev' in
3534
# `.pre-commit.config.yaml`, then update the pinned versions here.
36-
- black=24.10.0
37-
- flake8=7.1.1
38-
- flake8-isort=6.1.0
39-
- isort=5.13.2
40-
- mypy=1.11.2
41-
- pre-commit >=3.0.0
35+
- black ==25.1.0
36+
- flake8 ==7.3.0
37+
- isort ==6.0.1
38+
- mypy ==1.18.2
39+
- pre-commit ==4.3.0
4240
- types-PyYAML >=6.0.0
4341
# Developer Tools
4442
# =======================

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ authors = [
77
description = "A package for providing extra functionality on top of external packages"
88
license = {file = "LICENSE"}
99
readme = "README.md"
10-
requires-python = ">=3.9"
10+
requires-python = ">=3.11,<3.14"
1111
classifiers = [
1212
# these are only for searching/browsing projects on PyPI
13-
"Programming Language :: Python :: 3.9",
14-
"Programming Language :: Python :: 3.10",
1513
"Programming Language :: Python :: 3.11",
1614
"Programming Language :: Python :: 3.12",
1715
"Programming Language :: Python :: 3.13",
@@ -98,7 +96,7 @@ exclude = '''
9896
'''
9997

10098
[tool.mypy]
101-
python_version = 3.9
99+
python_version = 3.13
102100
check_untyped_defs = true
103101
ignore_missing_imports = true
104102
warn_unused_ignores = true

0 commit comments

Comments
 (0)