Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgsavage authored May 14, 2024
2 parents 6c52052 + 21ad66c commit bb2473d
Show file tree
Hide file tree
Showing 197 changed files with 16,760 additions and 9,890 deletions.
8 changes: 6 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[run]
omit = pint/testsuite/*
omit =
pint/testsuite/*
pint/_vendor/*

[report]
# Regexes for lines to exclude from consideration
Expand All @@ -16,4 +18,6 @@ exclude_lines =
AbstractMethodError

# Don't complain if non-runnable code isn't run:
if TYPE_CHECKING:
if TYPE_CHECKING:

return NotImplemented
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- [ ] Closes # (insert issue number)
- [ ] Executed ``pre-commit run --all-files`` with no errors
- [ ] Executed `pre-commit run --all-files` with no errors
- [ ] The change is fully covered by automated unit tests
- [ ] Documented in docs/ as appropriate
- [ ] Added an entry to the CHANGES file
32 changes: 32 additions & 0 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: codspeed-benchmarks

on:
push:
branches:
- "master"
- "develop"
pull_request:
# `workflow_dispatch` allows CodSpeed to trigger backtest
# performance analysis in order to generate initial data.
workflow_dispatch:

jobs:
benchmarks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: "3.12"

- name: Install dependencies
run: pip install "numpy>=1.23,<2.0.0"

- name: Install bench dependencies
run: pip install .[bench]

- name: Run benchmarks
uses: CodSpeedHQ/action@v1
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: pytest . --codspeed
210 changes: 166 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9]
numpy: [null, "numpy>=1.17,<2.0.0"]
uncertainties: [null, "uncertainties==3.0.1", "uncertainties>=3.0.1,<4.0.0"]
python-version: ["3.10", "3.11", "3.12"]
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]
include:
- python-version: 3.7 # Minimal versions
numpy: numpy==1.17.5
- python-version: "3.10" # Minimal versions
numpy: "numpy"
extras: matplotlib==2.2.5
- python-version: 3.8
- python-version: "3.10"
numpy: "numpy"
uncertainties: "uncertainties"
extras: "sparse xarray netCDF4 dask[complete] graphviz babel==2.8"
extras: "sparse xarray netCDF4 dask[complete]==2023.4.0 graphviz babel==2.8 mip>=1.13"
runs-on: ubuntu-latest

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

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Install numpy
if: ${{ matrix.numpy != null }}
run: pip install "${{matrix.numpy}}"

- name: Install uncertainties
if: ${{ matrix.uncertainties != null }}
run: pip install "${{matrix.uncertainties}}"
Expand All @@ -61,11 +61,19 @@ jobs:
if: ${{ matrix.extras != null }}
run: pip install ${{matrix.extras}}

- name: Install locales
if: ${{ matrix.extras != null }}
run: |
sudo apt-get install language-pack-es language-pack-fr language-pack-ro
sudo localedef -i es_ES -f UTF-8 es_ES
sudo localedef -i fr_FR -f UTF-8 fr_FR
sudo localedef -i ro_RO -f UTF-8 ro_RO
- name: Install dependencies
run: |
sudo apt install -y graphviz
pip install pytest pytest-cov pytest-subtests
pip install .
pip install packaging
pip install .[testbase]
- name: Install pytest-mpl
if: contains(matrix.extras, 'matplotlib')
Expand All @@ -75,40 +83,154 @@ jobs:
run: |
pytest $TEST_OPTS
- name: Coverage report
run: coverage report -m
# - 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
coveralls
# - 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

test-windows:
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"

coveralls:
needs: test-linux
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Coveralls Finished
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
run: |
pip install coveralls
coveralls --finish
# Dummy task to summarize all. See https://github.com/bors-ng/bors-ng/issues/1300
ci-success:
name: ci
if: ${{ success() }}
needs: test-linux
runs-on: ubuntu-latest
- 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
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-windows-${{ matrix.python-version }}
restore-keys: |
pip-windows-${{ matrix.python-version }}
- 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

test-macos:
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"

steps:
- name: CI succeeded
run: exit 0
- 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
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-${{ matrix.python-version }}
restore-keys: |
pip-${{ matrix.python-version }}
- name: Install numpy
if: ${{ matrix.numpy != null }}
run: pip install "${{matrix.numpy}}"

- name: Install dependencies
run: |
pip install packaging
pip install .[testbase]
- 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

# 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
10 changes: 7 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

- name: Set up Python 3.8
- name: Set up minimal Python version
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: "3.10"

- name: Get pip cache dir
id: pip-cache
Expand All @@ -30,6 +30,11 @@ jobs:
key: pip-docs
restore-keys: pip-docs

- name: Install locales
run: |
sudo apt-get install language-pack-fr
sudo localedef -i fr_FR -f UTF-8 fr_FR
- name: Install dependencies
run: |
sudo apt install -y pandoc
Expand All @@ -43,4 +48,3 @@ jobs:

- name: Doc Tests
run: sphinx-build -a -j auto -b doctest -d build/doctrees docs build/doctest

2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
- name: Lint
uses: pre-commit/[email protected]
with:
extra_args: --all-files --show-diff-on-failure
extra_args: --all-files --show-diff-on-failure
27 changes: 27 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build and publish to PyPI

on:
push:
tags:
- '*'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: python -m pip install build

- name: Build package
run: python -m build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ MANIFEST
.eggs
.mypy_cache
pip-wheel-metadata
pint/testsuite/dask-worker-space
venv
.envrc

# WebDAV file system cache files
.DAV/
Expand Down
Loading

0 comments on commit bb2473d

Please sign in to comment.