-
Notifications
You must be signed in to change notification settings - Fork 0
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 #17 from Deltares/pixi
add pixi, linting, pytest and run it on CI
- Loading branch information
Showing
27 changed files
with
19,655 additions
and
157 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,4 @@ | ||
* text=auto eol=lf | ||
|
||
# GitHub syntax highlighting | ||
pixi.lock linguist-language=YAML |
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,7 @@ | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" |
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,28 @@ | ||
name: Pre-commit | ||
|
||
on: | ||
schedule: | ||
# At 03:00 on day 1 of the month | ||
- cron: "0 3 1 * *" | ||
# on demand | ||
workflow_dispatch: | ||
|
||
jobs: | ||
auto-update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- uses: browniebroke/pre-commit-autoupdate-action@main | ||
- uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: update/pre-commit-hooks | ||
title: Update pre-commit hooks | ||
commit-message: "Update pre-commit hooks" | ||
body: Update versions of pre-commit hooks to latest version. | ||
author: "GitHub <[email protected]>" |
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: Pre-commit | ||
|
||
on: | ||
pull_request: | ||
merge_group: | ||
push: | ||
branches: [main, update/pre-commit-hooks] | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- uses: pre-commit/[email protected] |
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,27 @@ | ||
name: Python Lint | ||
on: | ||
push: | ||
branches: [main] | ||
paths-ignore: [".teamcity/**"] | ||
tags: ["*"] | ||
pull_request: | ||
merge_group: | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
mypy: | ||
name: Mypy | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: prefix-dev/[email protected] | ||
with: | ||
pixi-version: "latest" | ||
cache: true | ||
- name: Prepare pixi | ||
run: pixi run install-without-pre-commit | ||
- name: Run mypy on hydamo | ||
run: | | ||
pixi run mypy-hydamo |
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,39 @@ | ||
name: Python Tests | ||
on: | ||
push: | ||
branches: [main] | ||
paths-ignore: [".teamcity/**"] | ||
tags: ["*"] | ||
pull_request: | ||
merge_group: | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
test: | ||
name: Python ${{ matrix.os }} - ${{ matrix.arch }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macOS-latest | ||
- windows-latest | ||
arch: | ||
- x86 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: prefix-dev/[email protected] | ||
with: | ||
pixi-version: "latest" | ||
cache: true | ||
- name: Prepare pixi | ||
run: pixi run install-without-pre-commit | ||
|
||
- name: Run tests | ||
run: pixi run test-hydamo | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 |
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,21 @@ | ||
# pixi environments | ||
.pixi | ||
|
||
# visual studio code | ||
.vscode/settings.json | ||
|
||
.ipynb_checkpoints | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
htmlcov/ | ||
coverage.xml | ||
.coverage | ||
.coverage.* | ||
.pytest_cache/ | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json |
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,37 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-json | ||
- id: check-yaml | ||
- id: check-toml | ||
- id: check-merge-conflict | ||
- id: check-vcs-permalinks | ||
- | ||
id: end-of-file-fixer | ||
exclude: '.teamcity' | ||
- id: trailing-whitespace | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.0.291 | ||
hooks: | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix] | ||
- repo: https://github.com/psf/black | ||
rev: 23.9.1 | ||
hooks: | ||
- id: black | ||
- id: black-jupyter | ||
- repo: https://github.com/kynan/nbstripout | ||
rev: 0.6.1 | ||
hooks: | ||
- id: nbstripout | ||
- repo: https://github.com/crate-ci/typos | ||
rev: v1.16.17 | ||
hooks: | ||
- id: typos | ||
# use pass_filenames as a workaround such that | ||
# the excluded files in .typos.toml are respected | ||
# https://github.com/crate-ci/typos/issues/347 | ||
pass_filenames: false |
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,2 @@ | ||
[files] | ||
extend-exclude = ["*.csv", "*.json"] |
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,9 @@ | ||
{ | ||
"recommendations": [ | ||
"ms-python.python", | ||
"ms-python.black-formatter", | ||
"ms-python.mypy-type-checker", | ||
"charliermarsh.ruff", | ||
"njpwerner.autodocstring" | ||
] | ||
} |
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,10 @@ | ||
{ | ||
"notebook.formatOnSave.enabled": true, | ||
"[python]": { | ||
"editor.defaultFormatter": "ms-python.black-formatter", | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": true | ||
} | ||
} | ||
} |
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
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,9 @@ | ||
coverage: | ||
status: | ||
patch: | ||
default: | ||
informational: true | ||
|
||
project: | ||
default: | ||
informational: true |
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,11 @@ | ||
[mypy] | ||
plugins = pydantic.mypy, numpy.typing.mypy_plugin, pandera.mypy | ||
|
||
warn_unused_configs = True | ||
warn_redundant_casts = True | ||
warn_unused_ignores = True | ||
strict_equality = True | ||
strict_concatenate = True | ||
disallow_subclassing_any = True | ||
disallow_untyped_decorators = True | ||
disallow_any_generics = True |
Oops, something went wrong.