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
5 changes: 4 additions & 1 deletion codecov.yml → .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
codecov:
notify:
after_n_builds: 3
coverage:
status:
project:
default:
target: auto
threshold: 2%
threshold: 5%
patch: false
changes: false

Expand Down
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
5 changes: 5 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
changelog:
exclude:
authors:
- dependabot
- pre-commit-ci
17 changes: 0 additions & 17 deletions .github/workflows/lint.yaml

This file was deleted.

54 changes: 37 additions & 17 deletions .github/workflows/pypipublish.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,46 @@
name: Upload Python Package

on:
workflow_dispatch:
release:
types: [created]
types: [published]
pull_request:
paths:
- ".github/workflows/pypipublish.yml"
- "pyproject.toml"

jobs:
deploy:
dist:
name: Build & inspect package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- name: Set up Python
uses: actions/setup-python@v2.1.4
- uses: actions/checkout@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools setuptools-scm wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
fetch-depth: 0

- uses: hynek/build-and-inspect-python-package@v2

publish:
name: Upload package to PyPI
needs: [dist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
attestations: write
contents: read
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Get dist files
uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- name: Generate artifact attestation for sdist and wheel
uses: actions/attest-build-provenance@v2
with:
subject-path: "dist/*"

- name: Publish on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
55 changes: 25 additions & 30 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test
name: Tests

on:
push:
Expand All @@ -12,41 +12,36 @@ jobs:
test:
name: pytest (${{ matrix.os }}, ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -el {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.7", "3.8", "3.9"]
python-version: ["3.10", "3.13"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install miniconda
uses: conda-incubator/setup-miniconda@v2
uses: actions/checkout@v5
with:
python-version: ${{ matrix.python-version }}
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
auto-activate-base: false
- name: Conda info
shell: bash -l {0}
run: |
conda info
conda list
conda config --show-sources
conda config --show
printenv | sort
- name: Install dependencies
shell: bash -l {0}
run: mamba install xarray dask numpy scipy scikit-learn pys2index pytest pytest-cov
- name: Build and install xoak
shell: bash -l {0}
fetch-depth: 0

- name: Setup micromamba
uses: mamba-org/setup-micromamba@v2
with:
environment-file: ci/environment.yml
cache-environment: true
cache-downloads: false
create-args: >-
python=${{ matrix.python-version }}

- name: Install xoak
run: |
python -m pip install . --no-deps -v
python -OO -c "import xoak"
python -m pip install .

- name: Run tests
shell: bash -l {0}
run: pytest . --verbose --color=yes
- name: Codecov
if: matrix.os == 'macos-latest' && matrix.python-version == '3.8'
uses: codecov/codecov-action@v1
run: |
python -m pytest -vv --cov=xoak --color=yes src/xoak/tests

- name: Upload coverage report
uses: codecov/codecov-action@v5
26 changes: 11 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-yaml
- id: double-quote-string-fixer

- repo: https://github.com/ambv/black
rev: 20.8b1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.5
hooks:
- id: black
args: ["--line-length", "100", "--skip-string-normalization"]
- id: ruff-format
types_or: [ python, pyi ]
- id: ruff
args: [--fix]
types_or: [ python, pyi ]

- repo: https://gitlab.com/PyCQA/flake8
rev: 3.8.4
hooks:
- id: flake8

- repo: https://github.com/PyCQA/isort
rev: 5.6.4
hooks:
- id: isort
ci:
autofix_prs: false
autoupdate_schedule: quarterly
11 changes: 8 additions & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# Required
version: 2

# Build documentation in the doc/ directory with Sphinx
build:
os: "ubuntu-20.04"
tools:
python: "mambaforge-4.10"

sphinx:
configuration: doc/conf.py

conda:
environment: environment_doc.yml
environment: doc/environment.yml

python:
version: 3.8
install:
- method: pip
path: .

formats: []
15 changes: 15 additions & 0 deletions ci/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: xoak
channels:
- conda-forge
dependencies:
- python
- numpy
- xarray
- dask
- scipy
- scikit-learn
- pys2index
- pytest
- pytest-cov
- pydata-sphinx-theme=0.15.4
- sphinx-book-theme=1.1.4
55 changes: 55 additions & 0 deletions doc/_static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

code.literal {
background-color: unset;
border: unset;
}

.xr-wrap {
/* workaround when (ipy)widgets are present in output cells
* https://github.com/xarray-contrib/xarray-indexes/issues/14
* only rely on pydata-sphinx-theme variables here!
*/
--xr-font-color0: var(--pst-color-text-base);
--xr-font-color2: var(--pst-color-text-base);
--xr-font-color3: var(--pst-color-text-base);
--xr-border-color: hsl(from var(--pst-color-text-base) h s calc(l + 40));
--xr-disabled-color: hsl(from var(--pst-color-text-base) h s calc(l + 40));
--xr-background-color: var(--pst-color-on-background);
--xr-background-color-row-even: hsl(
from var(--pst-color-on-background) h s calc(l - 5)
);
--xr-background-color-row-odd: hsl(
from var(--pst-color-on-background) h s calc(l - 15)
);

font-size: 0.9em;
margin-left: 1.25em;
}

html[data-theme="dark"] .xr-wrap {
--xr-border-color: hsl(from var(--pst-color-text-base) h s calc(l - 40));
--xr-disabled-color: hsl(from var(--pst-color-text-base) h s calc(l - 40));
--xr-background-color-row-even: hsl(
from var(--pst-color-on-background) h s calc(l + 5)
);
--xr-background-color-row-odd: hsl(
from var(--pst-color-on-background) h s calc(l + 15)
);
}

.xr-array-wrap,
.xr-var-data,
.xr-var-preview {
/* font-size: 0.9em; */
}
.gp {
color: darkorange;
}

/* workaround Pydata Sphinx theme using light colors for widget cell outputs in dark-mode */
/* works for many widgets but not for Xarray html reprs */
/* https://github.com/pydata/pydata-sphinx-theme/issues/2189 */
html[data-theme="dark"] .output_area.rendered_html:has(div.xr-wrap) {
background-color: var(--pst-color-on-background) !important;
color: var(--pst-color-text-base) !important;
}
Loading