Skip to content

Commit

Permalink
merged w/ main
Browse files Browse the repository at this point in the history
  • Loading branch information
norlandrhagen committed Mar 12, 2024
2 parents e24aeb4 + 9d1d0cd commit 63d31fa
Show file tree
Hide file tree
Showing 22 changed files with 1,644 additions and 199 deletions.
10 changes: 7 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: 'monthly'
interval: "monthly"
groups:
actions:
patterns:
- "*"
50 changes: 50 additions & 0 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: codspeed-benchmarks

on:
# Run on pushes to the main branch
push:
branches:
- "main"
# Run on pull requests
pull_request:
# `workflow_dispatch` allows CodSpeed to trigger backtest
# performance analysis in order to generate initial data.
workflow_dispatch:

jobs:
benchmarks:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Miniconda
uses: conda-incubator/[email protected]
with:
auto-activate-base: true
activate-environment: "" # base environment
channels: conda-forge,nodefaults
channel-priority: strict

- name: Install dependencies
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
# Preprend $CONDA/bin to $PATH so that conda's python is used over system python
echo $CONDA/bin >> $GITHUB_PATH
conda install --solver=libmamba dask python=3.10 \
esmpy>=8.2.0 mpich netcdf4 numpy pip pooch pydantic>=1.10 pyproj \
pytest pytest-cov pytest-mypy rasterio rioxarray scipy sparse>=0.13.0 \
xarray xarray-datatree>=0.0.11 xesmf zarr cf_xarray>=0.8.0
python -m pip install -U pytest-codspeed setuptools
python -m pip install -e . --no-deps
- name: Run benchmarks
uses: CodSpeedHQ/[email protected]
with:
run: |
conda list
python -c "import ndpyramid; print(ndpyramid.__version__)"
python -m pytest --codspeed
18 changes: 11 additions & 7 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- main
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Daily “At 00:00”
- cron: "0 0 * * *" # Daily “At 00:00”

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -23,20 +23,24 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10'] #TODO: add 3.11 once sparse/numba support it
python-version: ["3.9", "3.10"] #TODO: add 3.11 once sparse/numba support it
timeout-minutes: 20
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Install Conda environment from environment.yml
uses: mamba-org/provision-with-micromamba@main
uses: mamba-org/setup-micromamba@v1
with:
# environment-file is not assumed anymore
environment-file: ci/environment.yml
cache-downloads: true
extra-specs: |
create-args: >-
python=${{ matrix.python-version }}
# now called cache-environment
cache-environment: true

- name: Install package
run: |
Expand All @@ -49,7 +53,7 @@ jobs:
run: |
python -m pytest
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false
12 changes: 6 additions & 6 deletions .github/workflows/pypi-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: 3.9
Expand All @@ -39,7 +39,7 @@ jobs:
else
echo "✅ Looks good"
fi
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: releases
path: dist
Expand All @@ -48,11 +48,11 @@ jobs:
needs: build-artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: 3.9
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: releases
path: dist
Expand All @@ -73,12 +73,12 @@ jobs:
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: releases
path: dist
- name: Publish package to PyPI
uses: pypa/[email protected].11
uses: pypa/[email protected].12
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/generated/

# PyBuilder
target/
Expand Down
64 changes: 57 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -15,18 +15,68 @@ repos:
- id: debug-statements
- id: mixed-line-ending

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.0.292'
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: ruff
args: ['--fix']
- id: pyupgrade
args:
- "--py39-plus"

- repo: https://github.com/psf/black
rev: 24.1.1
hooks:
- id: black

- repo: https://github.com/keewis/blackdoc
rev: v0.3.8
rev: v0.3.9
hooks:
- id: blackdoc

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.2.1"
hooks:
- id: ruff
args: ["--fix"]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
rev: v4.0.0-alpha.8
hooks:
- id: prettier

- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
args:
[
"--extra-keys",
"metadata.celltoolbar metadata.kernelspec",
"metadata.language_info.codemirror_mode.version",
"metadata.language_info.pygments_lexer",
"metadata.language_info.version",
"metadata.toc",
"metadata.notify_time",
"metadata.varInspector",
"cell.metadata.heading_collapsed",
"cell.metadata.hidden",
"cell.metadata.code_folding",
"cell.metadata.tags",
"cell.metadata.init_cell",
]

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.1
hooks:
- id: nbqa-ruff
args: ["--fix"]
- id: nbqa-isort
args: ["--profile=black"]
additional_dependencies: [isort==5.6.4]
- id: nbqa-black
- id: nbqa-pyupgrade
args: ["--py39-plus"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ version: 2
build:
os: ubuntu-20.04
tools:
python: 'mambaforge-4.10'
python: "mambaforge-4.10"

# Build documentation in the doc/ directory with Sphinx
sphinx:
Expand Down
28 changes: 12 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
<p align='left'>
<a href='https://carbonplan.org/#gh-light-mode-only'>
<img
src='https://carbonplan-assets.s3.amazonaws.com/monogram/dark-small.png'
height='48px'
/>
</a>
<a href='https://carbonplan.org/#gh-dark-mode-only'>
<img
src='https://carbonplan-assets.s3.amazonaws.com/monogram/light-small.png'
height='48px'
/>
</a>
<p align="left" >
<a href='https://carbonplan.org'>
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://carbonplan-assets.s3.amazonaws.com/monogram/light-small.png">
<img alt="CarbonPlan monogram." height="48" src="https://carbonplan-assets.s3.amazonaws.com/monogram/dark-small.png">
</picture>
</a>
</p>

# ndpyramid

A small utility for generating ND array pyramids using Xarray and Zarr.

[![CI](https://github.com/carbonplan/ndpyramid/actions/workflows/main.yaml/badge.svg)](https://github.com/carbonplan/ndpyramid/actions/workflows/main.yaml)
![MIT License](https://badgen.net/badge/license/MIT/blue)
![PyPI](https://img.shields.io/pypi/v/ndpyramid)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/ndpyramid.svg)](https://anaconda.org/conda-forge/ndpyramid)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

# installation

Expand Down Expand Up @@ -74,8 +70,8 @@ See the docstrings for more details about input parameters and options.

## license

All the code in this repository is [MIT](https://choosealicense.com/licenses/mit/) licensed, but we request that you please provide attribution if reusing any of our digital content (graphics, logo, articles, etc.).
All the code in this repository is [MIT](https://choosealicense.com/licenses/mit/)-licensed, but we request that you please provide attribution if reusing any of our digital content (graphics, logo, articles, etc.).

## about us

CarbonPlan is a non-profit organization that uses data and science for climate action. We aim to improve the transparency and scientific integrity of climate solutions with open data and tools. Find out more at [carbonplan.org](https://carbonplan.org/) or get in touch by [opening an issue](https://github.com/carbonplan/ndpyramid/issues/new) or [sending us an email](mailto:[email protected]).
CarbonPlan is a nonprofit organization that uses data and science for climate action. We aim to improve the transparency and scientific integrity of climate solutions with open data and tools. Find out more at [carbonplan.org](https://carbonplan.org/) or get in touch by [opening an issue](https://github.com/carbonplan/ndpyramid/issues/new) or [sending us an email](mailto:[email protected]).
4 changes: 4 additions & 0 deletions ci/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@ dependencies:
- numpy
- pip
- pooch
- pre-commit
- pydantic>=1.10
- pyproj
- pytest
- pytest-cov
- pytest-mypy
- rasterio
- rioxarray
- s3fs
- scipy
- sparse>=0.13.0
- xarray
- xarray-datatree>=0.0.11
- xesmf
- zarr
- cf_xarray>=0.8.0
- pip:
- pytest-codspeed
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ codecov:
comment: false

ignore:
- 'tests/*.py'
- 'setup.py'
- "tests/*.py"
- "setup.py"

coverage:
precision: 2
Expand Down
8 changes: 5 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ['myst_parser',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',]
extensions = [
'myst_parser',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
]

autosummary_generate = True

Expand Down
5 changes: 1 addition & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ ndpyramid

A small utility for generating ND array pyramids using Xarray and Zarr.

.. toctree::
:hidden:
self

.. toctree::
:maxdepth: 1
:hidden:
Expand All @@ -30,3 +26,4 @@ A small utility for generating ND array pyramids using Xarray and Zarr.
:caption: Reference

API <api>
schema
Loading

0 comments on commit 63d31fa

Please sign in to comment.