Skip to content

Commit

Permalink
Merge pull request #236 from roocs/regrid-main-merge-master
Browse files Browse the repository at this point in the history
Regrid main merge master
  • Loading branch information
sol1105 authored Jul 8, 2022
2 parents f4562ed + 6798264 commit cb5333c
Show file tree
Hide file tree
Showing 49 changed files with 1,726 additions and 404 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Before you submit a pull request, please follow these guidelines:
* `numpydoc`_
* `reStructuredText (ReST)`_

5. The pull request should work for Python 3.7 as well as raise test coverage.
5. The pull request should work for Python 3.8+ as well as raise test coverage.
Pull requests are also checked for documentation build status and for `PEP8`_ compliance.

The build statuses and build errors for pull requests can be found at:
Expand Down
31 changes: 19 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ jobs:
matrix:
tox-env: [black]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Cancel previous runs
uses: styfle/[email protected]
with:
python-version: 3.7
access_token: ${{ github.token }}
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install tox
run: pip install tox
- name: Run linting suite
Expand All @@ -28,19 +32,19 @@ jobs:
strategy:
matrix:
include:
- python-version: 3.7
tox-env: py37
allowed_to_fail: false
- python-version: 3.8
- python-version: "3.8"
tox-env: py38
allowed_to_fail: false
- python-version: 3.9
- python-version: "3.9"
tox-env: py39
allowed_to_fail: false
- python-version: "3.10"
tox-env: py310
allowed_to_fail: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
Expand All @@ -57,16 +61,19 @@ jobs:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup conda with Python ${{ matrix.python-version }}
uses: s-weigand/setup-conda@v1
with:
update-conda: true
python-version: ${{ matrix.python-version }}
conda-channels: conda-forge, defaults
- name: Install mamba
run: |
conda install -c conda-forge mamba
- name: Conda env configuration
run: |
conda env create -f environment.yml
mamba env create -f environment.yml
source activate clisops
pip install -e ".[dev]"
- name: Test with conda
Expand Down
49 changes: 24 additions & 25 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,57 @@ default_language_version:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.3.0
hooks:
- id: trailing-whitespace
language_version: python3
exclude: setup.cfg
- id: end-of-file-fixer
language_version: python3
exclude: setup.cfg
- id: check-yaml
language_version: python3
- id: debug-statements
language_version: python3
- repo: https://github.com/ambv/black
rev: 21.4b2
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
language_version: python3
args: ["--target-version", "py36"]
args: ["--target-version", "py38"]
- repo: https://github.com/pycqa/flake8
rev: 3.9.1
rev: 4.0.1
hooks:
- id: flake8
language_version: python3
args: ['--config=setup.cfg']
#- repo: https://github.com/pre-commit/mirrors-autopep8
# rev: v1.4.4
# hooks:
# - id: autopep8
# args: ['--global-config=setup.cfg','--in-place']
- repo: https://github.com/timothycrosley/isort
rev: 5.8.0
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
language_version: python3
args: ['--profile', 'black']
exclude: clisops/core/__init__.py
#- repo: https://github.com/pycqa/pydocstyle
# rev: 5.0.2
# rev: 6.1.1
# hooks:
# - id: pydocstyle
# args: ["--conventions=numpy"]
# args: ["--convention=numpy"]
- repo: https://github.com/asottile/pyupgrade
rev: v2.14.0
rev: v2.34.0
hooks:
- id: pyupgrade
language_version: python3
args: ['--py38-plus']
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/kynan/nbstripout
rev: 0.4.0
rev: 0.5.0
hooks:
- id: nbstripout
language_version: python3
files: ".ipynb"

ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
autofix_prs: true
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: weekly
skip: []
submodules: false
19 changes: 6 additions & 13 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,21 @@ version: 2
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Build documentation with MkDocs
#mkdocs:
# configuration: mkdocs.yml
fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
formats: all
formats:
- pdf

# Optionally set the version of Python and requirements required to build your docs
#python:
# version: 3.7
python:
version: 3.7
install:
- method: pip
path: .
extra_requirements:
- docs


# conda:
# environment: docs/environment.yml

build:
image: stable
os: ubuntu-20.04
tools:
python: "3.8"
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ Contributors

* Pascal Bourgault [email protected] `@aulemahal <https://github.com/aulemahal>`_
* David Huard [email protected] `@huard <https://github.com/huard>`_
* Martin Schupfner [email protected] `@sol1105 <https://github.com/sol1105>`_
33 changes: 31 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Ready to contribute? Here's how to set up ``clisops`` for local development.
tests, including testing other Python versions with tox:

$ flake8 clisops tests
$ black --target-version py36 clisops tests
$ black --target-version py38 clisops tests
$ python setup.py test # (or pytest)
$ tox

Expand All @@ -106,6 +106,35 @@ Ready to contribute? Here's how to set up ``clisops`` for local development.
#.
Submit a pull request through the GitHub website.


Logging
-------

``clisops`` uses the `loguru <https://loguru.readthedocs.io/en/stable/index.html>`_ library as its primary logging engine. In order to integrate this kind of logging in processes, we can use their logger:

.. code-block:: python
from loguru import logger
logger.warning("This a warning message!")
The mechanism for enabling log reporting in scripts/notebooks using ``loguru`` is as follows:

.. code-block:: python
import sys
from loguru import logger
logger.enable("clisops")
LEVEL = "INFO || DEBUG || WARNING || etc."
logger.add(sys.stdout, level=LEVEL) # for logging to stdout
# or
logger.add("my_log_file.log", level=LEVEL, enqueue=True) # for logging to a file
For convenience, a preset logger configuration can be enabled via `clisops.enable_logging()`.

.. code-block:: python
from clisops import enable_logging
enable_logging()
Pull Request Guidelines
-----------------------

Expand All @@ -116,6 +145,6 @@ Before you submit a pull request, check that it meets these guidelines:
#. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.md.
#. The pull request should work for Python 3.7, 3.8, and 3.9. Check
#. The pull request should work for Python 3.8, 3.9, and 3.10. Check
https://github.com/roocs/clisops/actions
and make sure that the tests pass for all supported Python versions.
Loading

0 comments on commit cb5333c

Please sign in to comment.