Skip to content

Commit 4c2c303

Browse files
initial pixi implementation
1 parent cadebc6 commit 4c2c303

18 files changed

+21584
-3124
lines changed

.github/workflows/nbval.yaml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,20 @@ jobs:
1818

1919
steps:
2020
- uses: actions/checkout@v4
21-
- name: Set up Python
22-
uses: actions/setup-python@v5
21+
- uses: prefix-dev/setup-pixi@v0.8.3
2322
with:
24-
python-version: "3.12"
25-
- name: Install notebook environment
23+
environments: dev
24+
- name: Execute notebook
2625
run: |
27-
python -m pip install --upgrade pip wheel
28-
pip install --timeout=300 -r requirements.txt -r docs/notebook_requirements.txt .[test]
29-
- name: Run notebook and check output
26+
pixi run -e dev jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=600 --output ${{ matrix.notebook-file }} docs/${{ matrix.notebook-file }}
27+
- name: Validate notebook output
3028
run: |
3129
# --nbval-sanitize-with: pre-process text to remove irrelevant differences (e.g. warning filepaths)
32-
pytest --nbval --nbval-sanitize-with docs/nbval_sanitization_rules.cfg docs/${{ matrix.notebook-file }}
33-
- name: Run notebooks again, save files
30+
pixi run -e dev pytest --nbval --nbval-lax --nbval-sanitize-with docs/nbval_sanitization_rules.cfg docs/${{ matrix.notebook-file }}
31+
- name: Convert notebook to HTML
3432
run: |
35-
pip install nbconvert[webpdf]
3633
mkdir docs/artifacts
37-
jupyter nbconvert --to html --execute --ExecutePreprocessor.timeout=600 --allow-errors --output artifacts/${{ matrix.notebook-file }}.html docs/${{ matrix.notebook-file }}
34+
pixi run -e dev jupyter nbconvert --to html --output artifacts/${{ matrix.notebook-file }}.html docs/${{ matrix.notebook-file }}
3835
- name: Upload artifacts
3936
uses: actions/upload-artifact@v4
4037
with:

.github/workflows/pytest.yaml

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,60 @@ on:
99

1010

1111
jobs:
12-
build:
12+
validate-envs:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: prefix-dev/setup-pixi@v0.8.3
17+
with:
18+
environments: core default dev
19+
frozen: true
20+
- name: Validate core environment
21+
run: pixi run -e core python -c "import rdtools; print(rdtools.__version__)"
22+
- name: Validate default environment
23+
run: pixi run python -c "import rdtools; import jupyter; print('default OK')"
24+
- name: Validate dev environment
25+
run: pixi run -e dev python -c "import rdtools; import pytest; import jupyter; print('dev OK')"
26+
27+
test:
28+
runs-on: ubuntu-latest
29+
strategy:
30+
matrix:
31+
environment: [dev-py310, dev-py311, dev-py312, dev-py313, dev-py314]
32+
fail-fast: false
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: prefix-dev/setup-pixi@v0.8.3
37+
with:
38+
environments: ${{ matrix.environment }}
39+
- name: Test with pytest (${{ matrix.environment }})
40+
run: pixi run -e ${{ matrix.environment }} test
41+
- name: Upload coverage reports to Codecov
42+
uses: codecov/codecov-action@v4
43+
env:
44+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
45+
46+
test-min:
47+
runs-on: ubuntu-latest
48+
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: prefix-dev/setup-pixi@v0.8.3
52+
with:
53+
environments: dev-min
54+
- name: Test with pytest (minimum versions)
55+
run: pixi run -e dev-min test
56+
- name: Upload coverage reports to Codecov
57+
uses: codecov/codecov-action@v4
58+
env:
59+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1360

61+
test-latest:
1462
runs-on: ubuntu-latest
1563
strategy:
1664
matrix:
17-
python-version: ["3.10", "3.11", "3.12", "3.13"]
18-
env: [
19-
'-r requirements.txt .[test]',
20-
'-r requirements-min.txt .[test]',
21-
'--upgrade --upgrade-strategy=eager .[test]'
22-
]
23-
exclude:
24-
- python-version: "3.10"
25-
env: '-r requirements-min.txt .[test]'
26-
- python-version: "3.11"
27-
env: '-r requirements-min.txt .[test]'
28-
- python-version: "3.12"
29-
env: '-r requirements-min.txt .[test]'
30-
- python-version: "3.13"
31-
env: '-r requirements-min.txt .[test]'
65+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
3266
fail-fast: false
3367

3468
steps:
@@ -37,13 +71,12 @@ jobs:
3771
uses: actions/setup-python@v5
3872
with:
3973
python-version: ${{ matrix.python-version }}
40-
- name: Install ${{ matrix.env }}
74+
- name: Install latest versions
4175
run: |
4276
python -m pip install --upgrade pip wheel
43-
pip install --timeout=300 ${{ matrix.env }}
44-
- name: Test with pytest ${{ matrix.env }}
45-
run: |
46-
python -m pytest --cov=./ --cov-report=xml
77+
pip install --timeout=300 --upgrade --upgrade-strategy=eager .[test]
78+
- name: Test with pytest (latest)
79+
run: python -m pytest --cov=rdtools --cov-report=xml
4780
- name: Upload coverage reports to Codecov
4881
uses: codecov/codecov-action@v4
4982
env:

.github/workflows/requirements.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
.coveralls.yml
1212
.coverage
1313
.coverage.*
14+
coverage.xml
1415
htmlcov/
1516

1617
# ignore test cache
@@ -38,5 +39,8 @@ rdtools.egg-info*
3839

3940
*.pickle
4041

42+
# pixi environments (local, not committed)
43+
.pixi/
44+
4145
# ignore vscode settings
4246
.vscode/

README.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,43 @@ command line:
2525
pip install rdtools
2626
```
2727

28+
Optional extras are available:
29+
30+
```
31+
pip install rdtools[notebooks] # Jupyter and notebook dependencies
32+
pip install rdtools[test] # pytest, coverage, flake8
33+
pip install rdtools[dev] # notebooks + test combined
34+
```
35+
36+
Alternatively, RdTools uses [pixi](https://pixi.sh) for reproducible
37+
environment management. To get started with pixi:
38+
39+
```
40+
pixi install # default environment (core + notebooks)
41+
pixi run lab # launch Jupyter Lab
42+
```
43+
44+
For development, use the `dev` environment which includes both notebook
45+
and test dependencies:
46+
47+
```
48+
pixi shell -e dev # activate the dev environment
49+
pixi run -e dev test # run pytest with coverage
50+
pixi run -e dev nbval # validate notebooks
51+
pixi run -e dev lab # launch Jupyter Lab
52+
```
53+
2854
For API documentation and full examples, please see the [documentation](https://rdtools.readthedocs.io).
2955

30-
RdTools currently is tested on Python 3.9+.
56+
RdTools currently is tested on Python 3.10+.
3157

3258
## Citing RdTools
3359

3460
To cite RdTools, please use the following along with the version number
3561
and the specific DOI coresponding to that version from [Zenodo](https://doi.org/10.5281/zenodo.1210316):
3662

37-
- Michael G. Deceglie, Kevin Anderson, Adam Shinn, Ambarish Nag, Mark Mikofski,
38-
Martin Springer, Jiyang Yan, Kirsten Perry, Sandra Villamar, Will Vining,
63+
- Michael G. Deceglie, Martin Springer, Kevin Anderson, Adam Shinn, Kirsten Perry, Ambarish Nag,
64+
Mark Mikofski, Jiyang Yan, Sandra Villamar, Will Vining,
3965
Gregory Kimball, Daniel Ruth, Noah Moyer, Quyen Nguyen, Dirk Jordan,
4066
Matthew Muller, and Chris Deline, RdTools, version {insert version}, Computer Software,
4167
https://github.com/NatLabRockies/rdtools. DOI:{insert DOI}

docs/Multi-year_on_year_example.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"1. Import and preliminary calculations: In this step data is imported and augmented to enable analysis with RdTools. **No RdTools functions are used in this step. It will vary depending on the particulars of your dataset.** \n",
1717
"2. Analysis with RdTools: This notebook illustrates the use of the TrendAnalysis API with two new features: `label='center'` and `multi_yoy=True`. Because we are implementing this with the `rdtools.TrendAnalysis` object-oriented API, it requires passing kwargs to `degradation_year_on_year` as a dictionary in the `TrendAnalysis.sensor_analysis(yoy_kwargs={})` input.\n",
1818
"\n",
19-
"For a consistent experience, we recommend installing the packages and versions documented in `docs/notebook_requirements.txt`. This can be achieved in your environment by running `pip install -r docs/notebook_requirements.txt` from the base directory. (RdTools must also be separately installed.) This notebook was tested in python 3.12.\n",
19+
"For a consistent experience, we recommend using [pixi](https://pixi.sh) to set up the notebook environment. From the base directory, run `pixi run -e notebooks lab` to launch JupyterLab with all required packages. Alternatively, install manually with `pip install rdtools[notebooks]`. This notebook was tested in python 3.13.\n",
2020
"\n",
2121
"This notebook works with data from the NREL PVDAQ `[4] NREL x-Si #1` system. This notebook automatically downloads and locally caches the dataset used in this example. The data can also be found on the DuraMAT Datahub (https://datahub.duramat.org/dataset/pvdaq-time-series-with-soiling-signal).\n"
2222
]
@@ -228,7 +228,7 @@
228228
},
229229
{
230230
"cell_type": "code",
231-
"execution_count": 9,
231+
"execution_count": null,
232232
"metadata": {},
233233
"outputs": [
234234
{
@@ -247,7 +247,7 @@
247247
],
248248
"source": [
249249
"# Provide additional timestamp information for the YoY slopes including the left and right timestamps that were used to calculate the slope.\n",
250-
"# The index is set to equal dt_center because we passed label='center' in the yoy_kwargs. \n",
250+
"# The index is set to equal dt_center because we passed label='center' in the yoy_kwargs.\n",
251251
"print(calc_info['YoY_times'].head().to_markdown())"
252252
]
253253
},
@@ -457,9 +457,9 @@
457457
"metadata": {
458458
"anaconda-cloud": {},
459459
"kernelspec": {
460-
"display_name": "Python [conda env:rdtools_dev]",
460+
"display_name": "rdtools_313-nb",
461461
"language": "python",
462-
"name": "conda-env-rdtools_dev-py"
462+
"name": "python3"
463463
},
464464
"language_info": {
465465
"codemirror_mode": {
@@ -471,7 +471,7 @@
471471
"name": "python",
472472
"nbconvert_exporter": "python",
473473
"pygments_lexer": "ipython3",
474-
"version": "3.12.11"
474+
"version": "3.13.11"
475475
}
476476
},
477477
"nbformat": 4,

docs/TrendAnalysis_example.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"# TrendAnalysis object-oriented example\n",
88
"\n",
99
"\n",
10-
"This juypter notebook is intended to demonstrate the RdTools analysis workflow as implemented with the `rdtools.TrendAnalysis` object-oriented API. For a consistent experience, we recommend installing the packages and versions documented in `docs/notebook_requirements.txt`. This can be achieved in your environment by running `pip install -r docs/notebook_requirements.txt` from the base directory. (RdTools must also be separately installed.) This notebook was tested in python 3.12.\n",
10+
"This juypter notebook is intended to demonstrate the RdTools analysis workflow as implemented with the `rdtools.TrendAnalysis` object-oriented API. For a consistent experience, we recommend using [pixi](https://pixi.sh) to set up the notebook environment. From the base directory, run `pixi run -e notebooks lab` to launch JupyterLab with all required packages. Alternatively, install manually with `pip install rdtools[notebooks]`. This notebook was tested in python 3.13.\n",
1111
"\n",
1212
"The calculations consist of two phases:\n",
1313
"\n",

docs/TrendAnalysis_example_NSRDB.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"# TrendAnalysis with satellite data\n",
88
"\n",
99
"\n",
10-
"This juypter notebook is intended to demonstrate how to use the RdTools analysis workflow as implemented with the `rdtools.TrendAnalysis` object-oriented API with satellite weather/irradiance data, such as NSRDB, instead of ground-based sensor data. For a consistent experience, we recommend installing the packages and versions documented in `docs/notebook_requirements.txt`. This can be achieved in your environment by running `pip install -r docs/notebook_requirements.txt` from the base directory. (RdTools must also be separately installed.) This notebook was tested in python 3.12.\n",
10+
"This juypter notebook is intended to demonstrate how to use the RdTools analysis workflow as implemented with the `rdtools.TrendAnalysis` object-oriented API with satellite weather/irradiance data, such as NSRDB, instead of ground-based sensor data. For a consistent experience, we recommend using [pixi](https://pixi.sh) to set up the notebook environment. From the base directory, run `pixi run -e notebooks lab` to launch JupyterLab with all required packages. Alternatively, install manually with `pip install rdtools[notebooks]`. This notebook was tested in python 3.13.\n",
1111
"\n",
1212
"The calculations consist of two phases:\n",
1313
"\n",

0 commit comments

Comments
 (0)