-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Update conda env dependencies - Add `dev-nompi.yml` which includes the nompi version of esmf to avoid the yaksa leak error that breaks VS Code testing API - Update pre-commit dependency versions and fix new issues for `black`, `flake8`, and `mypy` - Move most of `setup.cfg` to `pyproject.toml` - Add `Makefile` with convenient developer commands - Update `test_diags.py` and `test_allsets.py` to use `pytest`
- Loading branch information
1 parent
a0a3561
commit 633b52c
Showing
40 changed files
with
577 additions
and
384 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
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,82 @@ | ||
.PHONY: clean clean-test clean-pyc clean-build docs help | ||
.DEFAULT_GOAL := help | ||
|
||
define BROWSER_PYSCRIPT | ||
import os, webbrowser, sys | ||
|
||
from urllib.request import pathname2url | ||
|
||
webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1]))) | ||
endef | ||
export BROWSER_PYSCRIPT | ||
|
||
define PRINT_HELP_PYSCRIPT | ||
import re, sys | ||
|
||
for line in sys.stdin: | ||
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line) | ||
if match: | ||
target, help = match.groups() | ||
print("%-20s %s" % (target, help)) | ||
endef | ||
export PRINT_HELP_PYSCRIPT | ||
|
||
BROWSER := python -c "$$BROWSER_PYSCRIPT" | ||
|
||
# To run these commands: make <COMMAND> | ||
# ================================================== | ||
|
||
help: | ||
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) | ||
|
||
# Clean local repository | ||
# ---------------------- | ||
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts | ||
|
||
clean-build: ## remove build artifacts | ||
rm -fr build/ | ||
rm -fr conda-build/ | ||
rm -fr dist/ | ||
rm -fr .eggs/ | ||
find . -name '*.egg-info' -exec rm -fr {} + | ||
find . -name '*.egg' -exec rm -f {} + | ||
|
||
clean-pyc: ## remove Python file artifacts | ||
find . -name '*.pyc' -exec rm -f {} + | ||
find . -name '*.pyo' -exec rm -f {} + | ||
find . -name '*~' -exec rm -f {} + | ||
find . -name '__pycache__' -exec rm -fr {} + | ||
|
||
clean-test: ## remove test and coverage artifacts | ||
rm -fr tests_coverage_reports/ | ||
rm -f .coverage | ||
rm -fr htmlcov/ | ||
rm -f coverage.xml | ||
rm -fr .pytest_cache | ||
rm -rf .mypy_cache | ||
|
||
# Quality Assurance | ||
# ---------------------- | ||
pre-commit: # run pre-commit quality assurance checks | ||
pre-commit run --all-files | ||
|
||
lint: ## check style with flake8 | ||
flake8 e3sm_diags tests | ||
|
||
test: ## run tests quickly with the default Python and produces code coverage report | ||
pytest | ||
$(BROWSER) tests_coverage_reports/htmlcov/index.html | ||
|
||
# Documentation | ||
# ---------------------- | ||
docs: ## generate Sphinx HTML documentation, including API docs | ||
rm -rf docs/generated | ||
cd docs && make html | ||
$(MAKE) -C docs clean | ||
$(MAKE) -C docs html | ||
$(BROWSER) docs/_build/html/index.html | ||
|
||
# Build | ||
# ---------------------- | ||
install: clean ## install the package to the active Python's site-packages | ||
python -m pip install . |
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 |
---|---|---|
|
@@ -36,4 +36,3 @@ dependencies: | |
- sphinx | ||
- sphinx_rtd_theme | ||
- sphinx-multiversion | ||
prefix: /opt/miniconda3/envs/e3sm_diags_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,56 @@ | ||
# Conda development environment for testing local source code changes to `e3sm_diags` before merging them to production (`master` branch). | ||
# This version contains the no MPI version of `esmf` as a workaround for allowing VS Code's testing API to work. | ||
# The MPI version of `esmf` is usually installed by default, but it breaks VS Code's testing API because it throws a mysterious | ||
# `yaksa` warning. | ||
# More info: https://github.com/E3SM-Project/e3sm_diags/issues/737 | ||
name: e3sm_diags_dev_nompi | ||
channels: | ||
- conda-forge | ||
- defaults | ||
dependencies: | ||
# Base | ||
# ================= | ||
- python >=3.9 | ||
- pip | ||
- beautifulsoup4 | ||
- cartopy >=0.17.0 | ||
- cartopy_offlinedata | ||
- cdp 1.7.0 | ||
- cdms2 3.1.5 | ||
- cdutil 8.2.1 | ||
- dask | ||
- esmf >=8.4.0 nompi* | ||
- esmpy >=8.4.0 | ||
- genutil 8.2.1 | ||
- lxml | ||
- mache >=0.15.0 | ||
- matplotlib-base | ||
- netcdf4 | ||
- numpy >=1.23.0 | ||
- shapely >=2.0.0,<3.0.0 | ||
- xarray >=2023.02.0 | ||
# Testing | ||
# ======================= | ||
- scipy | ||
- pytest | ||
- pytest-cov | ||
# Documentation | ||
# ======================= | ||
- sphinx | ||
- sphinx_rtd_theme | ||
- sphinx-multiversion | ||
# Quality Assurance Tools | ||
# ======================= | ||
# Run `pre-commit autoupdate` to get the latest pinned versions of 'rev' in | ||
# `.pre-commit.config.yaml`, then update the pinned versions here. | ||
- black=23.9.1 | ||
- flake8=6.1.0 | ||
- flake8-isort=6.1.0 | ||
- isort=5.12.0 | ||
- mypy=1.5.1 | ||
- pre-commit >=3.0.0 | ||
- types-PyYAML >=6.0.0 | ||
# Developer Tools | ||
# ======================= | ||
- tbump=6.9.0 | ||
- ipykernel |
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
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
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
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
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
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
Oops, something went wrong.