Skip to content

Commit

Permalink
Deprecate 3.10; test workflow to pixi; project toml merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dalmijn committed Jan 16, 2025
1 parent 66edc2e commit b5c2f02
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 158 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.10","3.11","3.12","3.13"]
python-version: ["3.11","3.12","3.13"]
include:
- os: ubuntu-latest
label: linux-64
Expand Down
51 changes: 12 additions & 39 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
python-version: ["311", "312", "313"]
include:
- os: ubuntu-latest
label: linux-64
prefix: /home/runner/miniconda3/envs/fiat_test

name: ${{ matrix.label }} - py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
concurrency:
group: ${{ github.workflow }}-${{ matrix.python-version }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -44,52 +44,25 @@ jobs:
- name: Check-out source
uses: actions/checkout@v4

- name: Generate env yaml
run: pip install tomli && python make_env.py test -p ${{ matrix.python-version }}.*

- name: load from cache
id: cache
uses: actions/cache/restore@v4
- name: Setup pixi env
uses: prefix-dev/[email protected]
with:
path: |
/home/runner/miniconda3
~/pycache
# the below two settings mean we'll alway srestore the cache
# but the cache hit output can tell us if we have to update afterwards
key: test-py${{ matrix.python-version }}-${{ hashFiles('environment.yml') }}
restore-keys: |
test-py${{ matrix.python-version }}
- name: Fail on no cache restore
if: steps.cache.outputs.cache-matched-key == ''
run: |
echo "Failed to restore any cache. exiting..."
exit 1
- name: Update environment
if: steps.cache.outputs.cache-hit != 'true'
run: |
export PATH=/home/runner/miniconda3/bin:$PATH
mamba env update -n fiat_test -f environment.yml
- name: Conda info
run: |
export PATH=/home/runner/miniconda3/bin:$PATH
conda info
conda list -n fiat_test
pixi-version: "v0.39.4"
environments: test-py${{ matrix.python-version }}
locked: false
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}

- name: Create testdata
run: |
export PATH=/home/runner/miniconda3/bin:$PATH
mamba run -n fiat_test python .testdata/create_test_data.py
pixi run -e test-py${{ matrix.python-version }} generate-data
- name: Test
run: |
export PATH=/home/runner/miniconda3/bin:$PATH
mamba run -n fiat_test python -m pytest --verbose --cov=fiat --cov-report xml
pixi run -e test-py${{ matrix.python-version }} test-cov
- name: Upload coverage to codecov.io
if: matrix.python-version == '3.12'
if: matrix.python-version == '313'
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
Expand Down
115 changes: 0 additions & 115 deletions pixi.toml

This file was deleted.

80 changes: 77 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ description = "Delft Fast Impact Assessment Tool"
readme = "README.md"
license = {text = "MIT"}

requires-python = ">=3.10"
requires-python = ">=3.11"
dependencies = [
"gdal>=3.5",
"numpy",
Expand Down Expand Up @@ -66,7 +66,6 @@ classifiers = [
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
Expand Down Expand Up @@ -95,7 +94,6 @@ docs = [
"delft_fiat[all,extra]",
]
extra = [
"libgdal-netcdf",
"tomli-w",
]
test = [
Expand Down Expand Up @@ -172,3 +170,79 @@ ignore = ["B904", "D105", "D211", "D213", "D301", "E712", "E741"]

[tool.ruff.lint.pydocstyle]
convention = "numpy"

## Pixi related stuff
[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["linux-64", "win-64"]

[tool.pixi.tasks]
# Installation
install = { depends_on = ["install-fiat", "install-pre-commit"] }
install-fiat = "pip install --no-deps --editable ."
install-pre-commit = "pre-commit install"

# Repo related tasks
generate-data = { cmd = ["python", ".testdata/create_test_data.py"] }
lint = { cmd = ["pre-commit", "run", "--all"] }

# Docker related stuff (expand in future)
docker-clean = { cmd = ["docker", "system", "prune", "-f"] }

# Documentation generation
docs = { depends_on = ["generate-api", "interlink-docs", "quarto-render"] }
docs-quick = { depends-on = ["interlink-docs", "quarto-quick"] }
docs-slim = { depends-on = ["interlink-docs", "quarto-render"] }
generate-api = { cmd = ["python", "docs/api.py", "docs/_quarto.yml"] }
interlink-docs = { cmd = ["python", "docs/inv.py", "interlinks", "docs/_quarto.yml"] }
quarto = { cmd = ["quarto", "render"] }
quarto-quick = { cmd = ["quarto", "render", "docs"] }
quarto-render = { cmd = ["quarto", "render", "docs", "--execute"] }
serve = { cmd = ["python", "-m", "http.server", "8000", "-d", "docs/_site"] }

# Testing
test = { cmd = ["pytest"] }
test-lf = { cmd = ["pytest", "--lf", "--tb=short"] }
test-cov = { cmd = ["pytest", "--verbose", "--cov=fiat", "--cov-report", "xml"] }
test-cov-local = { cmd = ["pytest", "--verbose", "--cov", "--cov-report", "html",] }

# Clean up (some of) the temporary files
clean = { depends_on = [
"clean-env-files",
"clean-bin",
"clean-dist",
"clean-docs",
] }
clean-env-files = { cmd = ["rm", "-f", "*environment.yml"] }
clean-bin = { cmd = ["rm", "-rf", "bin"] }
clean-dist = {cmd = ["rm", "-rf", "dist"] }
clean-docs = { cmd = ["rm", "-rf", "docs/_site"] }

# Specify conda only deps
[tool.pixi.dependencies]
gdal = ">=3.5"
pip = "*"

[tool.pixi.feature.extra.dependencies]
libgdal-netcdf = "*"

# Extra python environments
[tool.pixi.feature.py311.dependencies]
python = "3.11.*"

[tool.pixi.feature.py312.dependencies]
python = "3.12.*"

[tool.pixi.feature.py313.dependencies]
python = "3.13.*"

# Environments
[tool.pixi.environments]
build = { features = ["all", "build", "extra"], solve-group = "default"}
default = { features = ["extra"], solve-group = "default"}
dev = { features = ["all", "dev", "docs", "extra", "test"], solve-group = "default"}
docs = { features = ["all", "docs", "extra"], solve-group = "default"}
min = { features = [], solve-group = "default"}
test-py313 = {features = ["py313", "all", "extra", "test"], solve-group = "py313"}
test-py312 = {features = ["py312", "all", "extra", "test"], solve-group = "py312"}
test-py311 = {features = ["py311", "all", "extra", "test"], solve-group = "py311"}

0 comments on commit b5c2f02

Please sign in to comment.