Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade infrastructure to pixi/uv/ruff, bump minimum python version to 3.11 Develop #2132

Merged
merged 24 commits into from
Feb 15, 2025
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1e5f0c7
refactor: pyupgrade --py310-plus **/*.py
hgrecco Feb 14, 2025
46f8c91
refactor: pyupgrade --py311-plus **/*.py
hgrecco Feb 14, 2025
282941f
build: start to move build and ci infrastructure to pixi
hgrecco Nov 10, 2024
43adf97
build: create full and bench environments
hgrecco Nov 10, 2024
b1ad8eb
build: create numpy and full pixi environments
hgrecco Nov 12, 2024
8bc6369
build: update .gitignore
hgrecco Nov 10, 2024
a01033a
build: add pyright environment and task
hgrecco Feb 14, 2025
dc5473d
build: bump minimum Python version for 3.11
hgrecco Feb 14, 2025
da0e9d6
refactor: split try/except from if HAS_*/else in compat
hgrecco Feb 14, 2025
c9aaee1
refactor: delete unused file
hgrecco Nov 8, 2024
1b5689d
refactor: use TypeAlias
hgrecco Nov 8, 2024
be61d6f
test: refactor test_pint_eval as functions and incorporated uncertainty
hgrecco Nov 8, 2024
a9631e5
perf: benchmarks for pint_eval
hgrecco Nov 8, 2024
1958fab
docs: update CHANGES
hgrecco Feb 14, 2025
74b8a08
fix: plain_tokenizer is currently named _plain_tokenizer
hgrecco Feb 14, 2025
fcb0196
build: remove python 3.9 and 3.10 from github workflows
hgrecco Feb 14, 2025
85303e5
build: renamed full environment to all
hgrecco Feb 14, 2025
629d38f
build: remove requirements.txt as it is now in pyproject.toml
hgrecco Feb 14, 2025
e946bf9
ci: remove unnecessary pip install
hgrecco Feb 14, 2025
57a55b9
build: specify package folder for hatch
hgrecco Feb 14, 2025
c28eab5
fix: remove -j auto because it is failing with current setup
hgrecco Feb 14, 2025
1297186
build: upgrade packages to make this sphinx work
hgrecco Feb 14, 2025
b494c56
build: move doc building and testing to pixi
hgrecco Feb 15, 2025
80b390f
build: install french locales for doctest
hgrecco Feb 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
231 changes: 61 additions & 170 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,45 @@
name: CI
name: Test and release when tagged

on: [push, pull_request]
on: [push]

jobs:
lint:
runs-on: ubuntu-latest
steps:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a good idea to use os in the matrix so that we define everything in one job.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, but My I will use this commit to migrate as is, and then use future commits to do this.

- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
with:
environments: lint
- run: pixi run --environment lint lint

test-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
environment:
- test-py311
- test-py312
- test-py313
numpy: [null, "numpy>=1.23,<2.0.0", "numpy>=2.0.0rc1"]
uncertainties: [null, "uncertainties==3.1.6", "uncertainties>=3.1.6,<4.0.0"]
extras: [null]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno if its still relevant to test multiple versions of uncertainties

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure. My suggestion is that we use this commit to migrate as is, and the use future commits to do this.

include:
- python-version: "3.10" # Minimal versions
- environment: "test-py311" # Minimal versions
numpy: "numpy>=1.23,<2.0.0"
extras: matplotlib==3.5.3
- python-version: "3.10"
- environment: "test-py311"
numpy: "numpy"
uncertainties: "uncertainties"
extras: "sparse xarray netCDF4 dask[complete]==2024.5.1 graphviz babel==2.8 mip>=1.13"
- python-version: "3.10"
- environment: "test-py311"
numpy: "numpy==1.26.1"
uncertainties: null
extras: "babel==2.15 matplotlib==3.9.0"
runs-on: ubuntu-latest

env:
TEST_OPTS: "-rfsxEX -s --cov=pint --cov-config=.coveragerc --benchmark-skip"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
with:
fetch-depth: 100

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

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

- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"

- name: Setup caching
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-${{ matrix.python-version }}
restore-keys: |
pip-${{ matrix.python-version }}

environments: ${{ matrix.environment }}
- name: Install numpy
if: ${{ matrix.numpy != null }}
run: pip install "${{matrix.numpy}}"
Expand Down Expand Up @@ -82,159 +69,63 @@ jobs:
- name: Install pytest-mpl
if: contains(matrix.extras, 'matplotlib')
run: pip install pytest-mpl

- name: Run Tests
run: |
pytest $TEST_OPTS

# - name: Coverage report
# run: coverage report -m

# - name: Coveralls Parallel
# env:
# COVERALLS_FLAG_NAME: ${{ matrix.test-number }}
# COVERALLS_PARALLEL: true
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# COVERALLS_SERVICE_NAME: github
# run: |
# pip install coveralls "requests<2.29"
# coveralls
- run: pixi run --environment ${{ matrix.environment }} test

test-windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
numpy: [ "numpy>=1.23,<2.0.0" ]
runs-on: windows-latest

env:
TEST_OPTS: "-rfsxEX -s -k issue1498b --benchmark-skip"

environment:
- test-py311
- test-py312
- test-py313
numpy: [null, "numpy>=1.23,<2.0.0", "numpy>=2.0.0rc1"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
with:
fetch-depth: 100

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

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

- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"

- name: Setup caching
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-windows-${{ matrix.python-version }}
restore-keys: |
pip-windows-${{ matrix.python-version }}

environments: ${{ matrix.environment }}
- name: Install numpy
if: ${{ matrix.numpy != null }}
run: pip install "${{matrix.numpy}}"

# - name: Install uncertainties
# if: ${{ matrix.uncertainties != null }}
# run: pip install "${{matrix.uncertainties}}"
#
# - name: Install extras
# if: ${{ matrix.extras != null }}
# run: pip install ${{matrix.extras}}

- name: Install dependencies
run: |
# sudo apt install -y graphviz
pip install packaging
pip install .[testbase]

# - name: Install pytest-mpl
# if: contains(matrix.extras, 'matplotlib')
# run: pip install pytest-mpl

- name: Run tests
run: pytest -rfsxEX -s -k issue1498b --benchmark-skip
- run: pixi run --environment ${{ matrix.environment }} test

test-macos:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
numpy: [null, "numpy>=1.23,<2.0.0" ]
runs-on: macos-latest

env:
TEST_OPTS: "-rfsxEX -s --cov=pint --cov-config=.coveragerc --benchmark-skip"

environment:
- test-py311
- test-py312
- test-py313
numpy: [null, "numpy>=1.23,<2.0.0", "numpy>=2.0.0rc1"]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 100

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

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

- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"

- name: Setup caching
uses: actions/cache@v2
- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-${{ matrix.python-version }}
restore-keys: |
pip-${{ matrix.python-version }}

environments: ${{ matrix.environment }}
- name: Install numpy
if: ${{ matrix.numpy != null }}
run: pip install "${{matrix.numpy}}"
- run: pixi run --environment ${{ matrix.environment }} test

- name: Install dependencies
run: |
pip install packaging
pip install .[testbase]

- name: Run Tests
run: |
pytest $TEST_OPTS

# - name: Coverage report
# run: coverage report -m
publish:
if: github.ref_type == 'tag'
needs: [test-linux, test-windows, test-macos, lint]

# - name: Coveralls Parallel
# env:
# COVERALLS_FLAG_NAME: ${{ matrix.test-number }}
# COVERALLS_PARALLEL: true
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# COVERALLS_SERVICE_NAME: github
# run: |
# pip install coveralls "requests<2.29"
# coveralls
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pint
permissions:
id-token: write # for trusted publising to PyPI

# coveralls:
# needs: test-linux
# runs-on: ubuntu-latest
# steps:
# - uses: actions/setup-python@v2
# with:
# python-version: 3.x
# - name: Coveralls Finished
# continue-on-error: true
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# COVERALLS_SERVICE_NAME: github
# run: |
# pip install coveralls "requests<2.29"
# coveralls --finish
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
with:
environments: build
- name: Build the package
run: pixi run --environment build build
- name: Publish to PyPI
run: pixi run --environment build publish
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up minimal Python version
uses: actions/setup-python@v2
with:
python-version: "3.10"
python-version: "3.11"

- name: Get pip cache dir
id: pip-cache
Expand Down
46 changes: 0 additions & 46 deletions .github/workflows/lint-autoupdate.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/lint.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/publish.yml

This file was deleted.

Loading
Loading