Skip to content
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
104 changes: 61 additions & 43 deletions .github/workflows/build_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ on:
env:
CANCEL_OTHERS: false
PATHS_IGNORE: '["**/README.md", "**/docs/**"]'
# Static python version for setting up pre-commit linting
PYTHON_VERSION: "3.14"
PIXI_VERSION: "v0.63.0"

jobs:
pre-commit-hooks:
Expand All @@ -34,10 +33,14 @@ jobs:
uses: actions/checkout@v6

- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v6
name: Set up Pixi
uses: prefix-dev/setup-pixi@v0.9.3
with:
python-version: ${{ env.PYTHON_VERSION }}
pixi-version: ${{ env.PIXI_VERSION }}
environments: default
activate-environment: true
cache: true
locked: true

- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
id: file_changes
Expand All @@ -46,24 +49,61 @@ jobs:
output: ' '

- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
# Run all pre-commit hooks on all the files.
# Getting only staged files can be tricky in case a new PR is opened
# since the action is run on a branch in detached head state
name: Install and Run Pre-commit
uses: pre-commit/action@v3.0.1
name: Run Pre-commit
run: pre-commit run --file ${{ steps.file_changes.outputs.files}}

package:
name: build rattler recipe
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
shell: bash -el {0}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
extra_args: --files ${{ steps.file_changes.outputs.files}}
cancel_others: ${{ env.CANCEL_OTHERS }}
paths_ignore: ${{ env.PATHS_IGNORE }}

- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
uses: actions/checkout@v6

- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Set up Pixi
uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: ${{ env.PIXI_VERSION }}
environments: package
activate-environment: package
cache: true
locked: true

- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Build package with rattler-build
run: |
rattler-build build -r recipe/ -c conda-forge --output-dir rattler-build-output

build:
name: test geometric_features - python ${{ matrix.python-version }}
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
shell: bash -l {0}
shell: bash -el {0}
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
include:
- python-version: "3.10"
environment: py310
- python-version: "3.11"
environment: py311
- python-version: "3.12"
environment: py312
- python-version: "3.13"
environment: py313
- python-version: "3.14"
environment: py314
fail-fast: false
steps:
- id: skip_check
Expand All @@ -76,40 +116,19 @@ jobs:
uses: actions/checkout@v6

- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Cache Conda
uses: actions/cache@v5
env:
# Increase this value to reset cache if conda-dev-spec.template has not changed in the workflow
CACHE_NUMBER: 0
name: Set up Pixi
uses: prefix-dev/setup-pixi@v0.9.3
with:
path: ~/conda_pkgs_dir_py${{ matrix.python-version }}
key:
${{ runner.os }}-${{ matrix.python-version }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('dev-spec.txt,pyproject.toml') }}

- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Set up Conda Environment
uses: mamba-org/setup-micromamba@v3
with:
environment-name: geometric_features_dev
init-shell: bash
condarc: |
channel_priority: strict
channels:
- conda-forge
create-args: >-
python=${{ matrix.python-version }}

- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Install geometric_features
run: |
conda install -y --file dev-spec.txt python=${{ matrix.python-version }}
python -m pip install --no-deps --no-build-isolation -vv -e .
pixi-version: ${{ env.PIXI_VERSION }}
environments: ${{ matrix.environment }}
activate-environment: ${{ matrix.environment }}
cache: true
locked: true

- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Run Tests
env:
CHECK_IMAGES: False
CHECK_IMAGES: False
run: |
set -e
pip check
Expand All @@ -129,4 +148,3 @@ jobs:
run: |
cd docs
DOCS_VERSION=test make versioned-html

40 changes: 9 additions & 31 deletions .github/workflows/docs_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,29 @@ on:
types: [published]

env:
PYTHON_VERSION: "3.14"
PIXI_VERSION: "v0.63.0"

jobs:
publish-docs:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
shell: bash -el {0}
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
fetch-depth: 0

- name: Cache Conda
uses: actions/cache@v5
env:
# Increase this value to reset cache if deploy/conda-dev-spec.template has not changed in the workflow
CACHE_NUMBER: 0
- name: Set up Pixi
uses: prefix-dev/setup-pixi@v0.9.3
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('dev-spec.txt') }}

- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Set up Conda Environment
uses: mamba-org/setup-micromamba@v3
with:
environment-name: pyremap_dev
init-shell: bash
condarc: |
channel_priority: strict
channels:
- conda-forge
create-args: >-
python=${{ env.PYTHON_VERSION }}

- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Install geometric_features
run: |
git config --global url."https://github.com/".insteadOf "git@github.com:"
conda install -y --file dev-spec.txt python=${{ env.PYTHON_VERSION }}
python -m pip install -vv --no-deps --no-build-isolation -e .
pixi-version: ${{ env.PIXI_VERSION }}
environments: default
activate-environment: true
cache: true
locked: true

- name: Build Sphinx Docs
run: |
Expand Down Expand Up @@ -92,4 +71,3 @@ jobs:
directory: docs/gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,5 @@ ENV/
.DS_Store

.idea
.pixi/
rattler-build-output/
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include geometric_features/features_and_tags.json
recursive-include geometric_data *.geojson
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,23 @@ conda create -n geometric_features -c conda-forge python=3.13 geometric_features
conda activate geometric_features
```

To develop `geometric_features` (e.g. to add new features), create and activate
an environment with all of the required dependencies:
To develop `geometric_features` (e.g. to add new features), install the
default pixi environment:
```bash
conda create -y -n mpas_dev --file dev-spec.txt
conda activate mpas_dev
python -m pip install --no-deps --no-build-isolation -e .
pixi install
```

If you want a different Python version, choose one of the versioned pixi
environments:
```bash
pixi install -e py310
```

The development environment in `pixi.toml` is equivalent to the legacy
`dev-spec.txt`, with the local package installed in editable mode and an
additional `package` environment for
`rattler-build`.

A typical workflow will look like:
* Create a `GeometricFeatures` object and point it to a location where you have
stored (or would like to store) geometry data.
Expand Down
2 changes: 1 addition & 1 deletion ci/python3.10.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
channel_sources:
- conda-forge,defaults
- conda-forge
pin_run_as_build:
python:
min_pin: x.x
Expand Down
2 changes: 1 addition & 1 deletion ci/python3.11.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
channel_sources:
- conda-forge,defaults
- conda-forge
pin_run_as_build:
python:
min_pin: x.x
Expand Down
2 changes: 1 addition & 1 deletion ci/python3.12.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
channel_sources:
- conda-forge,defaults
- conda-forge
pin_run_as_build:
python:
min_pin: x.x
Expand Down
2 changes: 1 addition & 1 deletion ci/python3.13.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
channel_sources:
- conda-forge,defaults
- conda-forge
pin_run_as_build:
python:
min_pin: x.x
Expand Down
2 changes: 1 addition & 1 deletion ci/python3.14.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
channel_sources:
- conda-forge,defaults
- conda-forge
pin_run_as_build:
python:
min_pin: x.x
Expand Down
6 changes: 3 additions & 3 deletions docs/releasing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Version Bump and Dependency Updates
- Manually update the version number in the following files:

- ``geometric_features/version.py``
- ``recipe/meta.yaml``
- ``recipe/recipe.yaml``

- Make sure the version follows `semantic versioning <https://semver.org/>`_.
For release candidates, use versions like ``1.6.2rc1``.
Expand All @@ -25,11 +25,11 @@ Version Bump and Dependency Updates
- Ensure that dependencies and their constraints are up-to-date and
consistent in:

- ``recipe/meta.yaml`` (for the conda-forge release)
- ``recipe/recipe.yaml`` (for the rattler-build recipe)

- ``pyproject.toml`` (for PyPI; used for sanity checks)

- ``dev-spec.txt`` (development dependencies; should be a superset)
- ``pixi.toml`` (development dependencies; should be a superset)

- Use the GitHub "Compare" feature to check for dependency changes between
releases:
Expand Down
5 changes: 5 additions & 0 deletions geometric_features/geometric_features.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import os
import sys
from importlib.resources import files as imp_res_files

from geometric_features.download import download_files
Expand Down Expand Up @@ -359,4 +360,8 @@ def _get_default_cache_location():
if os.path.isdir(repo_cache):
return repo_cache

prefix_cache = os.path.join(sys.prefix, 'share', 'geometric_data')
if os.path.isdir(prefix_cache):
return prefix_cache

return './geometric_data'
2 changes: 1 addition & 1 deletion geometric_features/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version_info__ = (1, 6, 2)
__version_info__ = (1, 6, 3)
__version__ = '.'.join(str(vi) for vi in __version_info__)
Loading
Loading