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

use uv in CI #189

Merged
merged 3 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions .github/workflows/check-test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ jobs:
- name: Generate coverage report
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
python -m pip install uv
uv venv
source .venv/bin/activate
uv pip install pytest flake8
if [ -f requirements_dev.txt ]; then uv pip install -r requirements_dev.txt; fi
coverage run --source wqio check_wqio.py --doctest-modules --cov --cov-report=xml
- name: Upload coverage reports to Codecov
run: |
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/python-runtests-basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
python -m pip install uv
uv venv
source .venv/bin/activate
uv pip install pytest
if [ -f requirements_dev.txt ]; then uv pip install -r requirements_dev.txt; fi
- name: Test with pytest
run: |
source .venv/bin/activate
python check_wqio.py --doctest-modules
8 changes: 6 additions & 2 deletions .github/workflows/python-runtests-img-comp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
python -m pip install uv
uv venv
source .venv/bin/activate
uv pip install pytest
if [ -f requirements_dev.txt ]; then uv pip install -r requirements_dev.txt; fi
- name: Test with pytest
run: |
source .venv/bin/activate
export MPL_IMGCOMP_TOLERANCE=20
python check_wqio.py --strict --verbose
2 changes: 1 addition & 1 deletion wqio/hydro.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def __init__(
},
self.precipcol: {
"name": "Precip (mm)",
"ylabel": "%s Precip.\nDepth (mm)" % self.hydrofreq_label,
"ylabel": f"{self.hydrofreq_label} Precip.\nDepth (mm)",
"color": "DarkGreen",
"linewidth": 1.5,
"alpha": 0.4,
Expand Down
4 changes: 2 additions & 2 deletions wqio/tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ def _show_system_info(): # pragma: no cover
import pytest

pyversion = sys.version.replace("\n", "")
print("Python version %s" % pyversion)
print("pytest version %d.%d.%d" % pytest.__versioninfo__)
print(f"Python version {pyversion}")
print(f"pytest version {pytest.__versioninfo__}")

import numpy

Expand Down
3 changes: 1 addition & 2 deletions wqio/tests/test_datacollections.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,7 @@ def test_wilcoxon(dc):
F,Outflow,62.0,,28.0,0.492459,,0.656642
F,Reference,22.0,28.0,,0.952765,0.656642,
"""
with pytest.warns(UserWarning):
check_stat(known_csv, dc.wilcoxon(), comp=True)
check_stat(known_csv, dc.wilcoxon(), comp=True)


@helpers.seed
Expand Down
4 changes: 2 additions & 2 deletions wqio/utils/numutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def process_p_vals(pval):
elif pval > 1 or pval < 0:
raise ValueError(f"p-values must be between 0 and 1 (not {pval})")
else:
out = "%0.3f" % pval
out = f"{pval:0.3f}"

return out

Expand Down Expand Up @@ -377,7 +377,7 @@ def pH_to_concentration(pH, *args):

# check that we recieved a valid input:
if pH < 0 or pH > 14:
raise ValueError("pH = %f but must be between 0 and 14" % pH)
raise ValueError(f"pH = {pH} but must be between 0 and 14")

# avogadro's number (items/mole)
avogadro = 6.0221413e23
Expand Down
Loading