Skip to content

Commit

Permalink
Merge pull request #27 from MeteoSwiss-APN/new-blueprint
Browse files Browse the repository at this point in the history
Adaptation to blueprint + Update to Python 3.10
  • Loading branch information
Karko93 authored Oct 20, 2023
2 parents 879dfed + d01db16 commit c475c9d
Show file tree
Hide file tree
Showing 96 changed files with 28,142 additions and 28,461 deletions.
29 changes: 0 additions & 29 deletions .bumpversion.cfg

This file was deleted.

17 changes: 17 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: cc8b3de
_src_path: [email protected]:MeteoSwiss-APN/mch-python-blueprint.git
email: [email protected]
full_name: Stefan Ruedisuehli
github_username: MeteoSwiss-APN
module_name: pyflexplot
project_doc_url: https://github.io/MeteoSwiss-APN/pyflexplot
project_github: https://github.com/MeteoSwiss-APN/pyflexplot
project_keywords: Dispersion, Flexpart, COSMO, mapping, visualization
project_name: PyFlexPlot
project_short_description: Stefan Ruedisuehli's PyFlexPlot
project_slug: pyflexplot
project_ssh_url: git+ssh://[email protected]/MeteoSwiss-APN/pyflexplot.git
python_version: '3.10'
version: 1.0.10
year: '2023'
40 changes: 40 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Run pre-commit in blueprint

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
blueprint-pre-commit:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11.0
- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: conda-forge
channel-priority: flexible
show-channel-urls: true
- name: Create env from unpinned reqs
run: |
conda env create --name dev_env --file requirements/requirements.yml
- name: Install project into env
run: |
conda run --name dev_env pip install --no-deps .
- name: Install pre-commit hooks
run: |
conda run --name dev_env pre-commit install-hooks
- name: Run pre-commit hooks
run: |
conda run --name dev_env pre-commit run --all-files
19 changes: 6 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
# Local files
local/

# Default test data link
data

# Non-permanent data, e.g. test output
scratch/

# Batch processing log files
log/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -58,7 +46,6 @@ nosetests.xml
coverage.xml
*.cover
.hypothesis/
junit-*.xml
.pytest_cache/

# Translations
Expand All @@ -85,6 +72,9 @@ target/
# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

Expand All @@ -96,6 +86,7 @@ celerybeat-schedule

# virtualenv
.venv
.venvs
venv/
venvs/
venv_*/
Expand All @@ -112,6 +103,8 @@ venv_*/

# mypy
.mypy_cache/

# Eclipse
.project

# VS Code
Expand Down
91 changes: 82 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,91 @@ repos:
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.1.0
- repo: local
hooks:
- id: forbidden-files-copier-rej
name: find copier rejection files
language: fail
entry: "Found copier update rejection file(s): review and remove them"
files: "\\.rej$"
- id: forbidden-files-git-orig
name: find git merge backup files
language: fail
entry: "Found git merge backup file(s): review and remove them"
files: "\\.orig$"
- repo: local
hooks:
- id: rstcheck
name: rstcheck
description: Check REST files for correctness
language: system
entry: rstcheck
types: [rst]
- repo: local
hooks:
- id: codespell
name: codespell
description: Check for spelling errors
language: system
entry: codespell
- repo: local
hooks:
- id: black
files: ^(.*\.py|(src|tests|docs)/(.*/)*.*\.py)$
- repo: https://github.com/timothycrosley/isort
rev: 5.12.0
name: black
description: Format Python code
language: system
entry: black
types_or: [python, pyi]
- repo: local
hooks:
- id: isort
files: ^(.*\.py|(src|tests|docs)/(.*/)*.*\.py)$
- repo: https://github.com/PyCQA/pydocstyle
rev: 6.3.0
name: isort
description: Group and sort Python imports
language: system
entry: isort
types_or: [python, pyi, cython]
- repo: local
hooks:
- id: pydocstyle
files: ^src/(.*/)*.*\.py$
name: pydocstyle
description: Check docstrings in Python code for compliance with conventions
language: system
entry: pydocstyle
types: [python]
files: ^src/
# SR It would be handy to abort if one linter fails b/c the same error often
# SR triggers multiple linters. That way, if flake8 fails, pylint and mypy
# SR (which in large code bases can take some time to run) could be skipped
# SR before fixing the error. Unfortunately, pre-commit only provides the global
# SR option fail_fast, which would abort even after the small fixers and
# SR formatters changed something. A potential solution could be to write a
# SR small bash script run-linters.sh that runs flake8, pylint and run-mypy.sh
# SR in that order and aborts on error.
#- repo: local
# hooks:
# - id: pylint
# name: pylint
# description: Check Python code for correctness, consistency and adherence to best practices
# language: system
# entry: pylint
# types: [python]
- repo: local
hooks:
- id: flake8
name: flake8
description: Check Python code for correctness, consistency and adherence to best practices
language: system
entry: flake8
types: [python]
- repo: local
hooks:
- id: mypy
name: mypy
description: Perform static type analysis of Python code
language: system
entry: bash tools/run-mypy.sh
require_serial: true
pass_filenames: false
verbose: true
types: [python]
files: ^(src|tests)/
9 changes: 9 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Credits

## Development Lead

- Stefan Ruedisuehli <[email protected]>

## Contributors

None yet. Why not be the first?
13 changes: 0 additions & 13 deletions AUTHORS.rst

This file was deleted.

Loading

0 comments on commit c475c9d

Please sign in to comment.