diff --git a/.cruft.json b/.cruft.json index 664bb85d..8a7dc3d2 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,23 +1,27 @@ { - "template": "https://github.com/bird-house/cookiecutter-birdhouse.git", - "commit": "be4eeb281ac2a027c2128c4ef84894ba559c8c24", - "context": { - "cookiecutter": { - "full_name": "Carsten Ehbrecht", - "email": "ehbrecht@dkrz.de", - "github_username": "roocs", - "project_name": "rook", - "project_slug": "rook", - "project_repo_name": "rook", - "project_readthedocs_name": "rook", - "project_short_description": "A WPS service for roocs.", - "version": "0.13.1", - "open_source_license": "Apache Software License 2.0", - "http_port": "5000", - "_copy_without_render": [ - "{{cookiecutter.project_slug}}/templates/*.cfg" - ], - "_template": "https://github.com/bird-house/cookiecutter-birdhouse.git" - } + "template": "https://github.com/bird-house/cookiecutter-birdhouse.git", + "commit": "231d17eca6986f606d280cc25262d0153efd92c4", + "context": { + "cookiecutter": { + "full_name": "Carsten Ehbrecht", + "email": "ehbrecht@dkrz.de", + "github_username": "roocs", + "project_name": "rook", + "project_slug": "rook", + "project_repo_name": "rook", + "project_readthedocs_name": "rook", + "project_short_description": "A WPS service for roocs.", + "version": "0.13.1", + "open_source_license": "Apache Software License 2.0", + "http_port": "5000", + "use_pytest": "y", + "use_black": "n", + "create_author_file": "y", + "_copy_without_render": [ + "{{cookiecutter.project_slug}}/templates/*.cfg" + ], + "_template": "https://github.com/bird-house/cookiecutter-birdhouse.git" } + }, + "checkout": null } diff --git a/.gitignore b/.gitignore index dcdde5d1..c420ecab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,18 @@ -# installer -#Makefile - -# Docker -#Dockerfile +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class # PyWPS -custom.cfg -.custom.cfg *.pid +.custom.cfg +custom.cfg + +# C extensions +*.so # Python / Extensions etc. *~ -*.mo -*.so *.pyc *.pyo *.egg @@ -21,26 +21,57 @@ custom.cfg *.bak __pycache__ -# Unit test / Coverage reports +# Distribution / packaging +*.egg-info/ +.Python +.eggs/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +env/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ + +# Translations +*.mo +*.pot + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +*.cover +*.lock +*.log .cache -.pytest_cache .coverage -.tox -nosetests.xml -unit_tests/testdata.json +.coverage.* +.hypothesis/ +.pytest_cache/ +.tox/ +coverage.xml coverage/ +htmlcov/ +nosetests.xml +testdata.json + # R *.Rhistory -# Eclipse / PyDev -.project -.pydevproject -.settings - -# PyCharm -*.idea - # Kate *.kate-swp @@ -62,26 +93,45 @@ downloads .mr.developer.cfg bootstrap-buildout.py bootstrap.py -#generated by buildout -*.pid - -# sphinx -#docs/Makefile -docs/make.bat +# Sphinx documentation +docs/Makefile +docs/_build +docs/_html/ docs/doctrees/ -docs/html/ -docs/build/ +docs/make.bat docs/source/output-sanitize.cfg # External Sources #src/external src/ +# Django stuff: +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# PyBuilder +target/ + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# dotenv +.env + # tests -*.log -*.lock -testdata.json output_*.nc # IPython @@ -95,3 +145,27 @@ output_*.nc # Merge conflict *.orig + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +# VSCode +.vscode/ + +# Eclipse / PyDev +.project +.pydevproject +.settings + +# PyCharm +*.idea diff --git a/.readthedocs.yml b/.readthedocs.yml index eb04ae8b..a6a210c1 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -12,19 +12,23 @@ sphinx: # disabled but this also means those errors will fail silently, choose wisely. fail_on_warning: false -# Build documentation with MkDocs -#mkdocs: -# configuration: mkdocs.yml - # Optionally build your docs in additional formats such as PDF and ePub formats: all # Optionally set the version of Python and requirements required to build your docs #python: -# version: 3.6 +build: + os: ubuntu-22.04 + tools: + python: mambaforge-22.9 conda: environment: environment-docs.yml -build: - image: stable +# Optionally set the version of Python and requirements required to build your docs +python: + install: + - method: pip + path: . + extra_requirements: + - dev diff --git a/CHANGES.rst b/CHANGES.rst index d4ffe936..aad14040 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,31 +1,30 @@ Changes ******* - 0.13.1 (2024-07-22) -================== +=================== * Added process for average over polygon (#251). * Update CDS domain (#253). 0.13.0 (2024-02-06) -================== +=================== * Add subsetting support for Atlas v1 datasets (#247, #248, #249). 0.12.2 (2023-12-08) -================== +=================== * Fixed the `time_components` parameter to avoid issues with 360day calendar (#245) 0.12.1 (2023-12-04) -================== +=================== * Updated clisops >=0.12.1 with fix for fill-value issue. * Added smoke test for fill-value issue. 0.12.0 (2023-11-28) -================== +=================== * Added regridding operator from clisops >=0.12.0. * Added tests for regridding process. @@ -33,7 +32,7 @@ Changes * Run GitHub tests with conda. 0.11.0 (2023-11-09) -================== +=================== * Added weighted average operator and wps process for it. * Added wps process for regridding ... using only dummy operator. @@ -42,13 +41,13 @@ Changes * Skip Python 3.8. 0.10.1 (2023-07-20) -================== +=================== * Updated checks when to apply fixes. * Fixed smoke tests for cmip5. 0.10.0 (2023-07-12) -================== +=================== * Updated concat operator to optionally apply subsetting and averaging to improve performance. * Apply cmip6 decadal fixes directly using Python code. Skip lookup of fixes in ElasticSearch. @@ -211,7 +210,6 @@ Changes: * Process outputs are provided as ``Metalink`` documents. * Added initial support for provenance documentation. - 0.1.0 (2020-04-03) ================== diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 00000000..8cc422f1 --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,123 @@ +.. highlight:: shell + +============ +Contributing +============ + +Contributions are welcome, and they are greatly appreciated! Every little bit +helps, and credit will always be given. + +You can contribute in many ways: + +Types of Contributions +---------------------- + +Report Bugs +~~~~~~~~~~~ + +Report bugs at https://github.com/roocs/rook/issues. + +If you are reporting a bug, please include: + +* Your operating system name and version. +* Any details about your local setup that might be helpful in troubleshooting. +* Detailed steps to reproduce the bug. + +Fix Bugs +~~~~~~~~ + +Look through the GitHub issues for bugs. Anything tagged with "bug" and "help +wanted" is open to whoever wants to implement it. + +Implement Features +~~~~~~~~~~~~~~~~~~ + +Look through the GitHub issues for features. Anything tagged with "enhancement" +and "help wanted" is open to whoever wants to implement it. + +Write Documentation +~~~~~~~~~~~~~~~~~~~ + +rook could always use more documentation, whether as part of the +official rook docs, in docstrings, or even on the web in blog posts, +articles, and such. + +Submit Feedback +~~~~~~~~~~~~~~~ + +The best way to send feedback is to file an issue at https://github.com/roocs/rook/issues. + +If you are proposing a feature: + +* Explain in detail how it would work. +* Keep the scope as narrow as possible, to make it easier to implement. +* Remember that this is a volunteer-driven project, and that contributions + are welcome :) + +Get Started! +------------ + +Ready to contribute? Here's how to set up `rook` for local development. + +1. Fork the `rook` repo on GitHub. +2. Clone your fork locally:: + + $ git clone git@github.com:your_name_here/rook.git + +3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:: + + $ mkvirtualenv rook + $ cd rook/ + $ python setup.py develop + +4. Create a branch for local development:: + + $ git checkout -b name-of-your-bugfix-or-feature + + Now you can make your changes locally. + +5. When you're done making changes, check that your changes pass flake8 and the + tests, including testing other Python versions with tox:: + + $ flake8 rook tests + $ python setup.py test or pytest + $ tox + + To get flake8 and tox, just pip install them into your virtualenv. + +6. Commit your changes and push your branch to GitHub:: + + $ git add . + $ git commit -m "Your detailed description of your changes." + $ git push origin name-of-your-bugfix-or-feature + +7. Submit a pull request through the GitHub website. + +Pull Request Guidelines +----------------------- + +Before you submit a pull request, check that it meets these guidelines: + +1. The pull request should include tests. +2. 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.rst. +3. The pull request should work for Python 3.7, 3.8, 3.9, 3.10 and 3.11. Check https://github.com/roocs/rook/actions and make sure that the tests pass for all supported Python versions. + +Tips +---- + +To run a subset of tests:: + +$ pytest tests.test_rook + + +Deploying +--------- + +A reminder for the maintainers on how to deploy. +Make sure all your changes are committed (including an entry in HISTORY.rst). +Then run:: + + $ bump2version patch # possible: major / minor / patch + $ git push + $ git push --tags + diff --git a/LICENSE.txt b/LICENSE similarity index 99% rename from LICENSE.txt rename to LICENSE index 65ba5cf5..d6456956 100644 --- a/LICENSE.txt +++ b/LICENSE @@ -1,4 +1,5 @@ -Apache License + + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -186,7 +187,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [2020] [Carsten Ehbrecht] + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/MANIFEST.in b/MANIFEST.in index 7046959d..1dadbc44 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,7 @@ include Makefile include *.txt include *.rst +include tox.ini recursive-include rook * global-exclude __pycache__ global-exclude *.py[co] diff --git a/Makefile b/Makefile index d994e8fd..cf01be63 100644 --- a/Makefile +++ b/Makefile @@ -13,72 +13,58 @@ SANITIZE_FILE := https://github.com/Ouranosinc/PAVICS-e2e-workflow-tests/raw/mas # end of configuration +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)) + else: + match = re.match(r'^## (.*)$$', line) + if match: + help = match.groups()[0] + print("\n%s" % (help)) +endef +export PRINT_HELP_PYSCRIPT + +BROWSER := python -c "$$BROWSER_PYSCRIPT" + .DEFAULT_GOAL := help -.PHONY: all -all: help - -.PHONY: help -help: - @echo "Please use 'make ' where is one of:" - @echo " help to print this help message. (Default)" - @echo " install to install app by running 'pip install -e .'" - @echo " develop to install with additional development requirements." - @echo " start to start $(APP_NAME) service as daemon (background process)." - @echo " stop to stop $(APP_NAME) service." - @echo " restart to restart $(APP_NAME) service." - @echo " status to show status of $(APP_NAME) service." - @echo " clean to remove all files generated by build and tests." - @echo "\nTesting targets:" - @echo " test to run tests (but skip long running tests)." - @echo " test-smoke to run smoke tests (sanity checks)." - @echo " smoke alias for test-smoke." - @echo " test-all to run all tests (including long running tests)." - @echo " test-notebooks to verify Jupyter Notebook test outputs are valid." - @echo " lint to run code style checks with flake8." - @echo " refresh-notebooks to verify Jupyter Notebook test outputs are valid." - @echo "\nSphinx targets:" - @echo " docs to generate HTML documentation with Sphinx." - @echo "\nDeployment targets:" - @echo " dist to build source and wheel package." - -## Build targets - -.PHONY: install -install: +help: ## print this help message. (Default) + @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) + +## Build targets: + +install: ## install rook application @echo "Installing application ..." @-bash -c 'pip install -e .' - @echo "\nStart service with \`make start'" + @echo "\nStart service with \`make start\` and stop with \`make stop\`." -.PHONY: develop -develop: +develop: ## install rook application with development libraries @echo "Installing development requirements for tests and docs ..." @-bash -c 'pip install -e ".[dev]"' -.PHONY: start -start: +start: ## start rook service as daemon (background process) @echo "Starting application ..." @-bash -c "$(APP_NAME) start -d" -.PHONY: stop -stop: +stop: ## stop rook service @echo "Stopping application ..." @-bash -c "$(APP_NAME) stop" -.PHONY: restart -restart: stop start +restart: stop start ## restart rook service @echo "Restarting application ..." -.PHONY: status -status: +status: ## show status of rook service @echo "Showing status ..." @-bash -c "$(APP_NAME) status" -.PHONY: clean clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts -.PHONY: clean-build -clean-build: +clean-build: ## remove build artifacts @echo "Removing build artifacts ..." @-rm -fr build/ @-rm -fr dist/ @@ -88,81 +74,104 @@ clean-build: @-find . -name '*.log' -exec rm -fr {} + @-find . -name '*.sqlite' -exec rm -fr {} + -.PHONY: clean-pyc -clean-pyc: +clean-pyc: ## remove Python file artifacts @echo "Removing 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 {} + -.PHONY: clean-test -clean-test: +clean-test: ## remove test and coverage artifacts @echo "Removing test artifacts ..." + @-rm -fr .tox/ + @-rm -f .coverage @-rm -fr .pytest_cache -.PHONY: clean-dist -clean-dist: clean +clean-dist: clean ## remove git ignored files and directories @echo "Running 'git clean' ..." @git diff --quiet HEAD || echo "There are uncommitted changes! Aborting 'git clean' ..." ## do not use git clean -e/--exclude here, add them to .gitignore instead @-git clean -dfx -## Test targets +clean-docs: ## remove documentation artifacts + @echo "Removing documentation artifacts ..." + @-rm -f docs/rook.rst + @-rm -f docs/modules.rst + $(MAKE) -C docs clean + +lint/flake8: ## check style with flake8 + @echo "Running flake8 code style checks ..." + @bash -c 'flake8 rook tests' + +lint: lint/flake8 ## check style -.PHONY: test -test: +## Testing targets: + +test: ## run tests quickly with the default Python (skip slow and online tests) @echo "Running tests (skip slow and online tests) ..." @bash -c 'pytest -v -m "not slow and not online" tests/' -.PHONY: test-smoke -test-smoke: +test-tox: ## run tests on every available Python version with tox + @bash -c 'tox' + +test-smoke: ## run smoke tests only @echo "Running smoke tests (only smoke tests) ..." @bash -c 'pytest -v -m "smoke" tests/' -.PHONY: smoke smoke: test-smoke -.PHONY: test-all -test-all: +test-all: ## run all tests quickly with the default Python @echo "Running all tests (including slow and online tests) ..." @bash -c 'pytest -v tests/' -.PHONY: notebook-sanitizer -notebook-sanitizer: +notebook-sanitizer: ## download notebook output sanitizer @echo "Copying notebook output sanitizer ..." @-bash -c "curl -L $(SANITIZE_FILE) -o $(CURDIR)/docs/source/output-sanitize.cfg --silent" -.PHONY: test-notebooks -test-notebooks: notebook-sanitizer + +test-notebooks: notebook-sanitizer ## run notebook-based tests @echo "Running notebook-based tests" - @bash -c "env WPS_URL=$(WPS_URL) pytest --nbval --verbose $(CURDIR)/docs/source/notebooks/ --sanitize-with $(CURDIR)/docs/source/output-sanitize.cfg --ignore $(CURDIR)/docs/source/notebooks/.ipynb_checkpoints" + @bash -c "env WPS_URL=$(WPS_URL) pytest --nbval --rootdir tests/ --verbose $(CURDIR)/docs/source/notebooks/ --sanitize-with $(CURDIR)/docs/source/output-sanitize.cfg --ignore $(CURDIR)/docs/source/notebooks/.ipynb_checkpoints" -.PHONY: lint -lint: - @echo "Running flake8 code style checks ..." - @bash -c 'flake8' +test-notebooks-lax: notebook-sanitizer ## run tests on notebooks but don't be so strict about outputs + @echo "Running notebook-based tests" + @bash -c "env WPS_URL=$(WPS_URL) pytest --nbval-lax --rootdir tests/ --verbose $(CURDIR)/docs/source/notebooks/ --ignore $(CURDIR)/docs/source/notebooks/.ipynb_checkpoints" -.PHONY: refresh-notebooks -refresh-notebooks: - @echo "Refresh all notebook outputs under docs/source/notebooks" - @bash -c 'for nb in $(CURDIR)/docs/source/notebooks/*.ipynb; do WPS_URL="$(WPS_URL)" jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --output "$$nb" "$$nb"; sed -i "s@$(WPS_URL)/outputs/@$(OUTPUT_URL)/@g" "$$nb"; done; cd $(APP_ROOT)' +coverage: ## check code coverage quickly with the default Python + @bash -c 'coverage run --source rook -m pytest' + @bash -c 'coverage report -m' + @bash -c 'coverage html' + $(BROWSER) htmlcov/index.html -## Sphinx targets +## Sphinx targets: -.PHONY: docs -docs: +docs: clean-docs ## generate Sphinx HTML documentation, including API docs @echo "Generating docs with Sphinx ..." - @bash -c '$(MAKE) -C $@ clean html' + $(MAKE) -C docs html @echo "Open your browser to: file:/$(APP_ROOT)/docs/build/html/index.html" - ## do not execute xdg-open automatically since it hangs travis and job does not complete + ## do not execute xdg-open automatically since it hangs ReadTheDocs and job does not complete @echo "xdg-open $(APP_ROOT)/docs/build/html/index.html" -## Deployment targets +servedocs: docs ## compile the docs watching for changes + @echo "Compiling the docs and watching for changes ..." + @watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D . + +notebook-sanitizer: ## sanitize notebooks with configuration file + @echo "Copying notebook output sanitizer ..." + @-bash -c "curl -L $(SANITIZE_FILE) -o $(CURDIR)/docs/source/output-sanitize.cfg --silent" + +refresh-notebooks: ## refreshing all notebook outputs under docs/source/notebooks + @echo "Refresh all notebook outputs under docs/source/notebooks" + @bash -c 'for nb in $(CURDIR)/docs/source/notebooks/*.ipynb; do WPS_URL="$(WPS_URL)" jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --output "$$nb" "$$nb"; sed -i "s@$(WPS_URL)/outputs/@$(OUTPUT_URL)/@g" "$$nb"; done; cd $(APP_ROOT)' -.PHONY: dist -dist: clean +## Deployment targets: + +dist: clean ## build source and wheel package @echo "Building source and wheel package ..." - @-python setup.py sdist - @-python setup.py bdist_wheel - @-bash -c 'ls -l dist/' + @python setup.py sdist + @python setup.py bdist_wheel + @bash -c 'ls -l dist/' + +release: dist ## upload source and wheel packages + @echo "Uploading source and wheel packages ..." + @bash -c 'twine upload dist/*' diff --git a/README.rst b/README.rst index b652c67a..69e44e99 100644 --- a/README.rst +++ b/README.rst @@ -1,19 +1,22 @@ rook ==== -.. image:: https://readthedocs.org/projects/rook-wps/badge/?version=latest - :target: https://rook-wps.readthedocs.io/en/latest/?badge=latest - :alt: Documentation Status +.. image:: https://img.shields.io/pypi/v/roocs-rook.svg + :target: https://pypi.python.org/pypi/roocs-rook + :alt: PyPI .. image:: https://github.com/roocs/rook/actions/workflows/main.yml/badge.svg - :target: https://github.com/roocs/rook/actions + :target: https://github.com/roocs/rook/actions/workflows/main.yml :alt: Build Status +.. image:: https://readthedocs.org/projects/rook/badge/?version=latest + :target: https://rook.readthedocs.io/en/latest/?version=latest + :alt: Documentation Status + .. image:: https://img.shields.io/github/license/roocs/rook.svg :target: https://github.com/roocs/rook/blob/master/LICENSE.txt :alt: GitHub license - rook (the bird) *The rook belongs to the crow family ...* @@ -28,18 +31,16 @@ available in the daops_ library based on xarray. Documentation ------------- -Learn more about rook in its official documentation at -https://rook-wps.readthedocs.io. +Learn more about rook in its official documentation at https://rook.readthedocs.io. -Submit bug reports, questions and feature requests at -https://github.com/roocs/rook/issues +Submit bug reports, questions and feature requests at https://github.com/roocs/rook/issues Contributing ------------ You can find information about contributing in our `Developer Guide`_. -Please use bumpversion_ to release a new version. +Please use bump2version_ to release a new version. Tests ----- @@ -52,7 +53,8 @@ The ``tests`` folder includes additional tests for a deployed rook service. License ------- -Free software: Apache Software License 2.0 +* Free software: Apache Software License 2.0 +* Documentation: https://rook.readthedocs.io. Credits ------- @@ -62,6 +64,6 @@ This package was created with Cookiecutter_ and the `bird-house/cookiecutter-bir .. _Cookiecutter: https://github.com/audreyr/cookiecutter .. _`bird-house/cookiecutter-birdhouse`: https://github.com/bird-house/cookiecutter-birdhouse .. _`Developer Guide`: https://rook-wps.readthedocs.io/en/latest/dev_guide.html -.. _bumpversion: https://rook-wps.readthedocs.io/en/latest/dev_guide.html#bump-a-new-version +.. _bump2version: https://rook.readthedocs.io/en/latest/dev_guide.html#bump-a-new-version .. _daops: https://github.com/roocs/daops .. _locust: https://locust.io/ diff --git a/docker-compose.yml b/docker-compose.yml index 1cc6d9e1..291c5b23 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,6 @@ services: ports: - "5000:5000" - # docker-compose build # docker-compose up # docker-compose down diff --git a/docs/source/.gitignore b/docs/source/.gitignore deleted file mode 100644 index a9cf7af9..00000000 --- a/docs/source/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/rook.rst -/rook.*.rst -/modules.rst diff --git a/docs/source/authors.rst b/docs/source/authors.rst new file mode 100644 index 00000000..7739272f --- /dev/null +++ b/docs/source/authors.rst @@ -0,0 +1 @@ +.. include:: ../../AUTHORS.rst diff --git a/docs/source/conf.py b/docs/source/conf.py index ea84bc34..f038dfde 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # # rook documentation build configuration file, created by # sphinx-quickstart on Fri Jun 9 13:47:02 2017. @@ -18,15 +17,12 @@ # relative to the documentation root, use os.path.abspath to make it # absolute, like shown here. # +import datetime import os import sys -# Add rook to sys.path to avoid having to full -# install rook for autodoc. -# Full install of rook will burst memory limit on ReadTheDocs. sys.path.insert(0, os.path.abspath("../../")) - # -- General configuration --------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. @@ -37,16 +33,16 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ "sphinx.ext.autodoc", - "sphinx.ext.viewcode", + "sphinx.ext.autosectionlabel", + "sphinx.ext.imgconverter", "sphinx.ext.mathjax", "sphinx.ext.napoleon", "sphinx.ext.todo", + "sphinx.ext.viewcode", + "IPython.sphinxext.ipython_console_highlighting", + "nbsphinx", "pywps.ext_autodoc", - "sphinx.ext.autosectionlabel", - # "sphinx.ext.imgconverter", - # "nbsphinx", - # "IPython.sphinxext.ipython_console_highlighting", -] + ] # To avoid having to install these and burst memory limit on ReadTheDocs. # List of all tested working mock imports from all birds so new birds can @@ -106,16 +102,14 @@ # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: -# -# source_suffix = ['.rst', '.md'] -source_suffix = ".rst" +source_suffix = {'.rst': 'restructuredtext'} # The master toctree document. master_doc = "index" # General information about the project. project = "rook" -copyright = "2020, Carsten Ehbrecht" +copyright = f"2020-{datetime.datetime.now().year}, Carsten Ehbrecht" author = "Carsten Ehbrecht" # The version info for the project you're documenting, acts as replacement @@ -123,7 +117,7 @@ # the built documents. # # The short X.Y version. -# version = "0.1.0" +version = "0.13.1" # The full version, including alpha/beta/rc tags. release = "0.13.1" @@ -132,7 +126,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. diff --git a/docs/source/index.rst b/docs/source/index.rst index be16e771..31913448 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -9,6 +9,7 @@ dev_guide notebooks processes + authors prov changes diff --git a/environment-docs.yml b/environment-docs.yml index 795d873f..4462e081 100644 --- a/environment-docs.yml +++ b/environment-docs.yml @@ -1,9 +1,11 @@ # conda env create -f environment-docs.yml name: rook channels: -- conda-forge -- defaults + - conda-forge + - defaults dependencies: -- python >=3.9,<3.10 -- pywps >=4.5.2,<4.7 -- sphinx >=7.0.0 + - python >=3.9,<3.10 + - pywps >=4.5.2,<4.7 + - sphinx >=7.0.0 + - nbsphinx + - ipython diff --git a/environment.yml b/environment.yml index 1983e30c..8f6f89be 100644 --- a/environment.yml +++ b/environment.yml @@ -1,40 +1,40 @@ name: rook channels: -- conda-forge -- defaults + - conda-forge + - defaults dependencies: -- python >=3.9 -- pywps >=4.5.2,<4.7 -- jinja2 -- click -- psutil -- requests -# daops -- cftime >=1.2.1 -- xarray >=0.21,<2023.3.0 # https://github.com/pydata/xarray/issues/7794 -- xesmf >=0.8.2 -- cf_xarray >=0.7 -- dask >=2021.12 -- netcdf4 >=1.4 -- bottleneck >=1.3.1,<1.4 -- daops >=0.11.0,<0.12 -- clisops >=0.12.2,<0.13 -- roocs-utils >=0.6.9,<0.7 -- roocs-grids >=0.1.2 -# workflow -- networkx -# provenance -- prov >=2.0.0 -- pydot -- graphviz -# catalog -- intake >=0.7.0,<2.0 -- pandas >=1.3.5,<2.0 -- sqlalchemy >=1.4.45,<2.0 -- aiohttp -# dashboard -- bokeh >=2.4.2,<2.5 -# tests -- pytest -- pytest-timeout -- beautifulsoup4 + - python >=3.9,<3.13 + - pywps >=4.5.2,<4.7 + - jinja2 + - click + - psutil + - requests + # daops + - cftime >=1.2.1 + - xarray >=0.21,<2023.3.0 # https://github.com/pydata/xarray/issues/7794 + - xesmf >=0.8.2 + - cf_xarray >=0.7 + - dask >=2021.12 + - netcdf4 >=1.4 + - bottleneck >=1.3.1,<1.4 + - daops >=0.11.0,<0.12 + - clisops >=0.12.2,<0.13 + - roocs-utils >=0.6.9,<0.7 + - roocs-grids >=0.1.2 + # workflow + - networkx + # provenance + - prov >=2.0.0 + - pydot + - graphviz + # catalog + - intake >=0.7.0,<2.0 + - pandas >=1.3.5,<2.0 + - sqlalchemy >=1.4.45,<2.0 + - aiohttp + # dashboard + - bokeh >=2.4.2,<2.5 + # tests + - pytest + - pytest-timeout + - beautifulsoup4 diff --git a/requirements.txt b/requirements.txt index b0fc4299..a7840e07 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ -pywps>=4.5.2,<4.7 -jinja2 click +jinja2 psutil +pywps>=4.5.1,<4.6 # daops daops>=0.11.0,<0.12 # daops @ git+https://github.com/roocs/daops.git@regrid-main-ce#egg=daops diff --git a/requirements_dev.txt b/requirements_dev.txt index d01e820b..6b0a9b0a 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,15 +1,21 @@ -pytest>=6.0 +pip>=23.1.0 +bump2version>=0.5.11 +coverage>=4.5.4 +click>=7.0 +cruft flake8 +nbval>=0.10.0 +pytest>=6.2.4 +pytest-cov pytest-flake8 -ipython pytest-notebook nbsphinx nbval>=0.9.6 nbconvert -sphinx>=3.5 -bumpversion -twine -cruft +sphinx>=1.8.5 +tox>=4.0 +twine>=4.0 +wheel # Changing dependencies above this comment will create merge conflicts when updating the cookiecutter template with cruft. Add extra requirements below this line. black>=24.8.0 pre-commit>=3.5.0 diff --git a/rook/__version__.py b/rook/__version__.py index 29057264..5b0549b2 100644 --- a/rook/__version__.py +++ b/rook/__version__.py @@ -4,6 +4,6 @@ # without importing the main package when its dependencies are not installed. # See: https://packaging.python.org/guides/single-sourcing-package-version -__author__ = """Carsten Ehbrecht""" +__author__ = "Carsten Ehbrecht" __email__ = "ehbrecht@dkrz.de" __version__ = "0.13.1" diff --git a/rook/cli.py b/rook/cli.py index cf5d75fb..b50d4cc6 100644 --- a/rook/cli.py +++ b/rook/cli.py @@ -172,6 +172,8 @@ def stop(): default="sqlite:///pywps-logs.sqlite", help="database in PyWPS configuration", ) +@click.option('--outputurl', default='', help='base URL for file downloads') +@click.option('--outputpath', default='', help='base directory where outputs are written') def start( config, bind_host, @@ -184,6 +186,8 @@ def start( log_level, log_file, database, + outputurl, + outputpath, ): """Start PyWPS service. This service is by default available at http://localhost:5000/wps @@ -202,6 +206,8 @@ def start( wps_log_level=log_level, wps_log_file=log_file, wps_database=database, + wps_outputurl = outputurl, + wps_outputpath = outputpath ) ) if config: diff --git a/setup.cfg b/setup.cfg index bb522210..3da41330 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,8 +11,8 @@ search = __version__ = "{current_version}" replace = __version__ = "{new_version}" [bumpversion:file:docs/source/conf.py] -search = release = "{current_version}" -replace = release = "{new_version}" +parse = version|release = {current_version} +replace = {new_version} [bumpversion:file:Dockerfile] search = Version="{current_version}" @@ -22,19 +22,23 @@ replace = Version="{new_version}" search = "version": "{current_version}", replace = "version": "{new_version}", +[bdist_wheel] +universal = 1 + [tool:pytest] -addopts = +addopts = + --ignore=setup.py --strict-markers --tb=native python_files = test_*.py -markers = +markers = online: mark test to need internet connection slow: mark test to be slow smoke: mark test as a smoke/sanity test [flake8] max-line-length = 120 -exclude = +exclude = .git, __pycache__, docs/source/conf.py, @@ -42,7 +46,7 @@ exclude = dist, src, mini-esgf-data, -ignore = +ignore = F401 E402 W503 diff --git a/setup.py b/setup.py index e68bf258..fe7d1a2f 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- """The setup script.""" @@ -16,8 +15,8 @@ with open(os.path.join(here, "rook", "__version__.py"), "r") as f: exec(f.read(), about) -reqs = [line.strip() for line in open("requirements.txt")] -dev_reqs = [line.strip() for line in open("requirements_dev.txt")] +requirements = [line.strip() for line in open('requirements.txt')] +dev_reqs = [line.strip() for line in open('requirements_dev.txt')] classifiers = [ "Development Status :: 3 - Alpha", @@ -37,27 +36,28 @@ ] setup( - name="rook", - version=about["__version__"], + name='roocs-rook', + version=about['__version__'], description="A WPS service for roocs.", - long_description=README + "\n\n" + CHANGES, + long_description=README + '\n\n' + CHANGES, long_description_content_type="text/x-rst", - author=about["__author__"], - author_email=about["__email__"], - url="https://github.com/roocs/rook", + author=about['__author__'], + author_email=about['__email__'], + url='https://github.com/roocs/rook', python_requires=REQUIRES_PYTHON, classifiers=classifiers, license="Apache Software License 2.0", - keywords="wps pywps birdhouse rook", + zip_safe=False, + keywords='wps pywps birdhouse rook', packages=find_packages(), include_package_data=True, - install_requires=reqs, + install_requires=requirements, extras_require={ "dev": dev_reqs, # pip install ".[dev]" }, entry_points={ - "console_scripts": [ - "rook=rook.cli:cli", + 'console_scripts': [ + 'rook=rook.cli:cli', ] }, ) diff --git a/tests/__init__.py b/tests/__init__.py index 522c70a9..43ccb68a 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- - """Unit test package for rook.""" diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..a4703a4d --- /dev/null +++ b/tox.ini @@ -0,0 +1,26 @@ +[tox] +min_version = 4.0 +envlist = + py{39,310,311,312}, + flake8 +requires = pip >= 23.1.0 +opts = -v + +[testenv:flake8] +basepython = python +deps = flake8 +commands = flake8 rook tests + +[testenv] +setenv = + PYTHONPATH = {toxinidir} +install_command = python -m pip install --no-user {opts} {packages} +download = True +deps = + -r{toxinidir}/requirements_dev.txt +; If you want to make tox run the tests with the same versions, create a +; requirements.txt with the pinned versions and uncomment the following line: +; -r{toxinidir}/requirements.txt +commands = + pytest --basetemp={envtmpdir} +