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 pixi for tests, envs, and tasks #95

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
50 changes: 25 additions & 25 deletions environment.yml → .binder/environment.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
name: ioos-metrics
channels:
- conda-forge
dependencies:
- python=3.13
- bs4
- ckanapi
- fake-useragent
- fiscalyear
- geopandas>=0.13.2
- gliderpy
- html5lib
- joblib
- lxml
- nbclassic
- pandas
- pdfminer.six
- pyarrow
- pyobis
- pytest
- requests
- suds
- pip
- pip:
- git+https://github.com/ioos/ioos_metrics.git
name: ioos-metrics
channels:
- conda-forge
dependencies:
- python=3.12
- bs4
- ckanapi
- fake-useragent
- fiscalyear
- geopandas>=0.13.2
- gliderpy
- html5lib
- joblib
- lxml
- nbclassic
- pandas
- pdfminer.six
- pyarrow
- pyobis
- pytest
- requests
- suds
- pip
- pip:
- git+https://github.com/ioos/ioos_metrics.git
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML linguist-generated=true
14 changes: 6 additions & 8 deletions .github/workflows/metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v2
- uses: actions/checkout@v4
- name: Setup Pixi
uses: prefix-dev/[email protected]
with:
init-shell: bash
environment-file: environment.yml
manifest-path: pyproject.toml

- name: echo secrets into a file
shell: bash -l {0}
Expand All @@ -41,10 +41,8 @@ jobs:

- name: Collect quarterly GTS and BTN metrics
shell: bash -l {0}
run: >
python btn_metrics.py
&& python gts_regional_metrics.py
&& python gts_atn_metrics.py
run: |
pixi run metrics

- name: Get current date
run: echo "NOW=$(date -u)" >> ${GITHUB_ENV}
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v2
- uses: actions/checkout@v4
- name: Setup Pixi
uses: prefix-dev/[email protected]
with:
init-shell: bash
environment-file: environment.yml
environment-name: TEST
manifest-path: pyproject.toml

- name: Tests
shell: bash -l {0}
run: |
python -m pytest -rxs tests
pixi run tests
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.log
updated_metrics.csv
.ipynb_checkpoints/
/config.py
/website/deploy/asset_inventory.html
Expand All @@ -8,3 +9,6 @@ dist/
ioos_metrics/_version.py
website/deploy/gts_atn.html
website/deploy/gts_regional.html
# pixi environments
.pixi
*.egg-info
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ prune gts
prune website
prune tests
prune notebooks
prune .binder

exclude *.ipynb
exclude btn_metrics.py
Expand All @@ -19,6 +20,7 @@ exclude read_bufr.py
exclude ioos_btn_metrics.csv

exclude ruff.toml
exclude *.lock
exclude .gitignore
exclude .pre-commit-config.yaml
exclude *.yml
Expand Down
35 changes: 17 additions & 18 deletions notebooks/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# Run the metrics notebook

## How to run

1. Install pixi: https://pixi.sh/dev/#installation
1. Clone this repository: `git clone https://github.com/ioos/ioos_metrics.git`
1. Enter the repository directory: `cd gider_metrics`
1. Create tne enviroment: `conda env create --name METRICS --file environment.yml`
1. Start the notebook: `jupyter nbclassic`

## You can also try it on mybinder

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/ioos/ioos_metrics/HEAD?labpath=/notebooks/glider_metrics.ipynb)


## Or Google Colab

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ioos/ioos_metrics/blob/main/notebooks/glider_metrics.ipynb)
# Run the metrics notebook

## How to run

1. Install pixi: https://pixi.sh/dev/#installation
1. Clone this repository: `git clone https://github.com/ioos/ioos_metrics.git`
1. Enter the repository directory: `cd ioos_metrics`
1. Start the notebook: `pixi run notebook`

## You can also try it on mybinder

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/ioos/ioos_metrics/HEAD?labpath=/notebooks/glider_metrics.ipynb)


## Or Google Colab

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ioos/ioos_metrics/blob/main/notebooks/glider_metrics.ipynb)
15,808 changes: 15,808 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,34 @@ ignore = [
"tests",
"tests/*",
]

[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["linux-64", "win-64", "osx-64", "osx-arm64"]

[tool.pixi.pypi-dependencies]
ioos_metrics = { path = ".", editable = true }

[tool.pixi.tasks]
notebook = "cd notebooks && jupyter nbclassic"
tests = "python -m pytest -rxs tests"
metrics = "python btn_metrics.py && python gts_regional_metrics.py && python gts_atn_metrics.py"

[tool.pixi.dependencies]
bs4 = ">=4.12.3,<5"
ckanapi = ">=4.8,<5"
fake-useragent = ">=1.4.0,<2"
fiscalyear = ">=0.4.0,<0.5"
geopandas = ">=0.13.2"
gliderpy = ">=0.2.2,<0.3"
html5lib = ">=1.1,<2"
joblib = ">=1.4.2,<2"
lxml = ">=5.3.0,<6"
nbclassic = ">=1.1.0,<2"
pandas = ">=2.2.3,<3"
"pdfminer.six" = ">=20240706,<20240707"
pyarrow = ">=18.0.0,<19"
pyobis = ">=1.3.1,<2"
pytest = ">=8.3.3,<9"
requests = ">=2.32.3,<3"
suds = ">=1.1.2,<2"