Skip to content

Commit

Permalink
Merge pull request #64 from iiasa/workflow
Browse files Browse the repository at this point in the history
Workflow
  • Loading branch information
gidden authored Nov 22, 2024
2 parents 9e5aa00 + a564316 commit 2bd6250
Show file tree
Hide file tree
Showing 49 changed files with 3,817 additions and 549 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[run]
omit = aneris/tutorial.py
omit = aneris/tutorial.py
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,28 @@ jobs:
# fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.8, 3.11] # to minimise complexity we only test a min and a max version
python-version: ["3.10", 3.12] # to minimise complexity we only test a min and a max version
include:
# on all platforms and versions do everything
- tox-envs: [docs, lint, build, test]
- tox-envs: [lint, test, docs, build]

runs-on: ${{ matrix.platform }}

steps:
- name: Checkout
uses: actions/checkout@v3

# pandoc is required by nbsphinx for building the notebook-based docs
- name: Setup pandoc for building docs
uses: r-lib/actions/setup-pandoc@v2
with:
pandoc-version: '2.19.2'

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install tox
run: |
Expand Down
77 changes: 68 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,72 @@
#*
aneris/_version.py
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

*#
# C extensions
*.so

# editors
*.swp
*~
*.pyc
build
dist
*.egg-info

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
_version.py

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
.*
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Sphinx documentation
docs/_build/
docs/html
docs/latex

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

venv
# Editor settings
.spyderproject
.spyproject
.ropeproject
.vscode
61 changes: 61 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
#- id: fix-encoding-pragma # ruff does not thing this makes sense
- id: mixed-line-ending
- id: trailing-whitespace
- id: check-added-large-files
args: ["--maxkb=2000"]

# # Convert relative imports to absolute imports
# - repo: https://github.com/MarcoGorelli/absolufy-imports
# rev: v0.3.1
# hooks:
# - id: absolufy-imports

# Find common spelling mistakes in comments and docstrings
- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
hooks:
- id: codespell
args: ['--ignore-regex="(\b[A-Z]+\b)"', '--ignore-words-list=fom'] # Ignore capital case words, e.g. country codes
types_or: [python, rst, markdown]
files: ^(scripts|doc)/

# Make docstrings PEP 257 compliant
- repo: https://github.com/PyCQA/docformatter
rev: 06907d0 # Update to new version when https://github.com/PyCQA/docformatter/issues/293 is closed
hooks:
- id: docformatter
args: ["--in-place", "--make-summary-multi-line", "--pre-summary-newline"]

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

# Formatting with "black" coding style
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
# Format Python files
- id: black
# Format Jupyter Python notebooks
- id: black-jupyter

# Linting with ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.7.4
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]

# # Check for FSFE REUSE compliance (licensing)
# - repo: https://github.com/fsfe/reuse-tool
# rev: v1.1.2
# hooks:
# - id: reuse
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ python:
install:
- method: pip
path: .
extra_requirements: [docs]
extra_requirements: [docs]
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

**To reproduce harmonization routines from [Gidden et al.
(2019)](https://gmd.copernicus.org/articles/12/1443/2019/), use `v0.3.2` (or
earlier). Subsequent versions introduce backwards incompatibilities.**
earlier). Subsequent versions introduce backwards incompatibilities.**

Documentation
-------------
Expand Down
2 changes: 1 addition & 1 deletion ci/.coveragerc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[report]
omit =
aneris/_version.py
aneris/_version.py
2 changes: 1 addition & 1 deletion ci/py2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ FROM gidden/python2-viz

COPY . /aneris
WORKDIR /
RUN cd /aneris && python2 setup.py install
RUN cd /aneris && python2 setup.py install
2 changes: 1 addition & 1 deletion ci/py3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ FROM gidden/python3-viz

COPY . /aneris
WORKDIR /
RUN cd /aneris && python3 setup.py install
RUN cd /aneris && python3 setup.py install
1 change: 0 additions & 1 deletion ci/travis-install-miniconda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ fi

# update conda
conda update --yes conda

2 changes: 1 addition & 1 deletion doc/.gh-config
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ include:
- _static
- _modules
- _templates
- _downloads
- _downloads
2 changes: 1 addition & 1 deletion doc/source/_bib/index.bib
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ @article{Gidden:2019:aneris
volume = {105},
journal = {Environmental Modelling & Software},
doi = {10.1016/j.envsoft.2018.04.002}
}
}
Loading

0 comments on commit 2bd6250

Please sign in to comment.