-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from umr-lops/migrate2pyproject.toml
Migrate from `setup.py` to `pyproject.toml`
- Loading branch information
Showing
33 changed files
with
1,597 additions
and
1,100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
changelog: | ||
exclude: | ||
authors: | ||
- dependabot | ||
- pre-commit-ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
detect-skip-ci-trigger: | ||
name: "Detect CI Trigger: [skip-ci]" | ||
if: | | ||
github.repository == 'umr-lops/xsarsea' | ||
&& ( | ||
github.event_name == 'push' || github.event_name == 'pull_request' | ||
) | ||
runs-on: ubuntu-latest | ||
outputs: | ||
triggered: ${{ steps.detect-trigger.outputs.trigger-found }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
- uses: xarray-contrib/ci-trigger@v1 | ||
id: detect-trigger | ||
with: | ||
keyword: "[skip-ci]" | ||
|
||
ci: | ||
name: ${{ matrix.os }} py${{ matrix.python-version }} | ||
runs-on: ${{ matrix.os }} | ||
needs: detect-skip-ci-trigger | ||
|
||
if: needs.detect-skip-ci-trigger.outputs.triggered == 'false' | ||
|
||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.10", "3.11", "3.12"] | ||
os: ["ubuntu-latest", "macos-latest", "windows-latest"] | ||
|
||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
# need to fetch all tags to get a correct version | ||
fetch-depth: 0 # fetch all branches and tags | ||
|
||
- name: Setup environment variables | ||
run: | | ||
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | ||
echo "CONDA_ENV_FILE=ci/requirements/environment.yaml" >> $GITHUB_ENV | ||
- name: Setup micromamba | ||
uses: mamba-org/setup-micromamba@v1 | ||
with: | ||
environment-file: ${{ env.CONDA_ENV_FILE }} | ||
environment-name: xsarsea-tests | ||
cache-environment: true | ||
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}" | ||
create-args: >- | ||
python=${{matrix.python-version}} | ||
- name: Install xsarsea | ||
run: | | ||
python -m pip install --no-deps -e . | ||
- name: Import xsarsea | ||
run: | | ||
python -c "import xsarsea" | ||
- name: Run tests | ||
run: | | ||
python -m pytest --cov=xsarsea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Conda feedstock test | ||
|
||
# this workflow generate the documentation, using conda-feedstock | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '00 23 * * 0' | ||
|
||
|
||
jobs: | ||
dynamic-matrix: | ||
# from https://michaelheap.com/dynamic-matrix-generation-github-actions/ | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: get-matrix | ||
run: | | ||
echo "get matrix for event ${{ github.event_name }}" | ||
echo "::echo::on" | ||
python .github/actions/dynamic_matrix.py ${{ github.event_name }} | ||
outputs: | ||
os_matrix: ${{ steps.get-matrix.outputs.os_matrix }} | ||
python_version_matrix: ${{ steps.get-matrix.outputs.python_version_matrix }} | ||
|
||
build: | ||
needs: dynamic-matrix | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ${{ fromJson(needs.dynamic-matrix.outputs.os_matrix) }} | ||
python-version: ${{ fromJson(needs.dynamic-matrix.outputs.python_version_matrix) }} | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
name: python ${{ matrix.python-version }} on ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Strip python version | ||
run: cat environment.yml | egrep -vw python > environment-nopython.yml | ||
- uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
auto-update-conda: true | ||
activate-environment: xsarsea | ||
environment-file: environment-nopython.yml | ||
condarc-file: condarc.yml | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: install xsarsea from feedstock | ||
run: | | ||
conda install -c conda-forge xsarsea | ||
(cd docs ; pip install -r ../requirements.txt) | ||
- name: List Packages | ||
run: | | ||
python -V | ||
conda info | ||
conda list | ||
- name: Documentation test | ||
run: | | ||
cd docs | ||
make html | ||
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: upstream-dev CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
schedule: | ||
- cron: "0 18 * * 0" # Weekly "On Sundays at 18:00" UTC | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
detect-test-upstream-trigger: | ||
name: "Detect CI Trigger: [test-upstream]" | ||
if: github.event_name == 'push' || github.event_name == 'pull_request' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
triggered: ${{ steps.detect-trigger.outputs.trigger-found }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
- uses: xarray-contrib/ci-trigger@v1.2 | ||
id: detect-trigger | ||
with: | ||
keyword: "[test-upstream]" | ||
|
||
upstream-dev: | ||
name: upstream-dev | ||
runs-on: ubuntu-latest | ||
needs: detect-test-upstream-trigger | ||
|
||
if: | | ||
always() | ||
&& github.repository == 'umr-lops/xsarsea' | ||
&& ( | ||
github.event_name == 'schedule' | ||
|| github.event_name == 'workflow_dispatch' | ||
|| needs.detect-test-upstream-trigger.outputs.triggered == 'true' | ||
|| contains(github.event.pull_request.labels.*.name, 'run-upstream') | ||
) | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.12"] | ||
|
||
steps: | ||
- name: checkout the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
# need to fetch all tags to get a correct version | ||
fetch-depth: 0 # fetch all branches and tags | ||
|
||
- name: set up conda environment | ||
uses: mamba-org/setup-micromamba@v1 | ||
with: | ||
environment-file: ci/requirements/environment.yaml | ||
environment-name: tests | ||
create-args: >- | ||
python=${{ matrix.python-version }} | ||
pytest-reportlog | ||
- name: install upstream-dev dependencies | ||
run: bash ci/install-upstream-dev.sh | ||
|
||
- name: install the package | ||
run: python -m pip install --no-deps -e . | ||
|
||
- name: show versions | ||
run: python -m pip list | ||
|
||
- name: import | ||
run: | | ||
python -c 'import xsarsea' | ||
- name: run tests | ||
if: success() | ||
id: status | ||
run: | | ||
python -m pytest -rf --report-log=pytest-log.jsonl | ||
- name: report failures | ||
if: | | ||
failure() | ||
&& steps.tests.outcome == 'failure' | ||
&& github.event_name == 'schedule' | ||
uses: xarray-contrib/issue-from-pytest-log@v1 | ||
with: | ||
log-path: pytest-log.jsonl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,41 @@ | ||
ci: | ||
autoupdate_schedule: weekly | ||
autoupdate_schedule: monthly | ||
|
||
# https://pre-commit.com/ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
rev: v5.0.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-docstring-first | ||
- id: check-yaml | ||
- id: check-toml | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/psf/black | ||
rev: 23.1.0 | ||
rev: 24.10.0 | ||
hooks: | ||
- id: black | ||
- id: black-jupyter | ||
- repo: https://github.com/keewis/blackdoc | ||
rev: v0.3.8 | ||
rev: v0.3.9 | ||
hooks: | ||
- id: blackdoc | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 6.0.0 | ||
additional_dependencies: ["black==24.10.0"] | ||
- id: blackdoc-autoupdate-black | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.7.1 | ||
hooks: | ||
- id: flake8 | ||
- id: ruff | ||
args: [--fix] | ||
- repo: https://github.com/kynan/nbstripout | ||
rev: 0.6.1 | ||
rev: 0.7.1 | ||
hooks: | ||
- id: nbstripout | ||
args: [--extra-keys=metadata.kernelspec metadata.language_info.version] | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v3.0.0-alpha.4 | ||
- repo: https://github.com/rbubley/mirrors-prettier | ||
rev: v3.3.3 | ||
hooks: | ||
- id: prettier | ||
- repo: https://github.com/ComPWA/taplo-pre-commit | ||
rev: v0.9.3 | ||
hooks: | ||
- id: prettier | ||
- id: taplo-format | ||
- id: taplo-lint | ||
args: [--no-schema] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
conda remove -y --force cytoolz numpy xarray toolz python-dateutil pandas | ||
python -m pip install \ | ||
-i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ | ||
--no-deps \ | ||
--pre \ | ||
--upgrade \ | ||
numpy \ | ||
pandas \ | ||
xarray | ||
python -m pip install --upgrade \ | ||
git+https://github.com/pytoolz/toolz \ | ||
git+https://github.com/dateutil/dateutil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: xsarsea-docs | ||
channels: | ||
- conda-forge | ||
dependencies: | ||
- python=3.11 | ||
- sphinx>=4 | ||
- sphinx_book_theme | ||
- ipython |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: xsarsea-tests | ||
channels: | ||
- conda-forge | ||
dependencies: | ||
- ipython | ||
- pre-commit | ||
- pytest | ||
- pytest-reportlog | ||
- pytest-cov | ||
- numpy | ||
- toolz | ||
- cytoolz | ||
- python-dateutil | ||
- construct | ||
- xarray | ||
- pandas | ||
- aiohttp |
Oops, something went wrong.