From e8aaf79740eecebebadfabb02558c7df8bac47df Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 27 Sep 2024 11:46:39 -0400 Subject: [PATCH 01/21] cookiecutter update --- .cruft.json | 44 +++++----- .gitignore | 140 ++++++++++++++++++++++++-------- .readthedocs.yml | 18 +++-- CHANGES.rst | 18 ++--- CONTRIBUTING.rst | 123 ++++++++++++++++++++++++++++ LICENSE.txt => LICENSE | 5 +- MANIFEST.in | 1 + Makefile | 175 +++++++++++++++++++++------------------- README.rst | 26 +++--- docker-compose.yml | 1 - docs/source/.gitignore | 3 - docs/source/authors.rst | 1 + docs/source/conf.py | 28 +++---- docs/source/index.rst | 1 + environment-docs.yml | 12 +-- environment.yml | 74 ++++++++--------- requirements.txt | 4 +- requirements_dev.txt | 18 +++-- rook/__version__.py | 2 +- rook/cli.py | 6 ++ setup.cfg | 16 ++-- setup.py | 26 +++--- tests/__init__.py | 2 - tox.ini | 26 ++++++ 24 files changed, 510 insertions(+), 260 deletions(-) create mode 100644 CONTRIBUTING.rst rename LICENSE.txt => LICENSE (99%) delete mode 100644 docs/source/.gitignore create mode 100644 docs/source/authors.rst create mode 100644 tox.ini 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} + From 0b80785bdf3865c2bd75b561b058a40e803250e5 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 27 Sep 2024 11:58:22 -0400 Subject: [PATCH 02/21] pre-commit update --- .pre-commit-config.yaml | 48 +++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aa9d2eeb..4b438cf4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,31 +1,25 @@ default_language_version: - python: python3 + python: python3 repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.2.0 + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 hooks: - - id: trailing-whitespace - language_version: python3 + - id: trailing-whitespace exclude: setup.cfg - - id: end-of-file-fixer - language_version: python3 + - id: end-of-file-fixer exclude: setup.cfg - - id: check-yaml - language_version: python3 - - id: debug-statements - language_version: python3 -- repo: https://github.com/ambv/black - rev: 22.3.0 + - id: check-yaml + - id: debug-statements + - repo: https://github.com/ambv/black + rev: 24.8.0 hooks: - - id: black - language_version: python3 - args: ["--target-version", "py37"] -- repo: https://github.com/pycqa/flake8 - rev: 3.9.1 + - id: black + args: ["--target-version", "py39"] + - repo: https://github.com/pycqa/flake8 + rev: 7.1.1 hooks: - - id: flake8 - language_version: python3 + - id: flake8 args: ['--config=setup.cfg'] #- repo: https://github.com/pre-commit/mirrors-autopep8 # rev: v1.4.4 @@ -36,22 +30,20 @@ repos: # rev: 5.6.4 # hooks: # - id: isort -# language_version: python3 # args: ['--profile', 'black'] #- repo: https://github.com/pycqa/pydocstyle # rev: 5.0.2 # hooks: # - id: pydocstyle # args: ["--conventions=numpy"] -- repo: https://github.com/asottile/pyupgrade - rev: v2.14.0 + - repo: https://github.com/asottile/pyupgrade + rev: v3.17.0 hooks: - - id: pyupgrade - language_version: python3 -- repo: meta + - id: pyupgrade + - repo: meta hooks: - - id: check-hooks-apply - - id: check-useless-excludes + - id: check-hooks-apply + - id: check-useless-excludes # - repo: https://github.com/kynan/nbstripout # rev: 0.3.9 # hooks: From 43412e12143c864c7711c9ec4836d103d918622e Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 27 Sep 2024 12:00:05 -0400 Subject: [PATCH 03/21] run pre-commit formatting --- CONTRIBUTING.rst | 1 - docs/source/conf.py | 4 ++-- rook/__init__.py | 2 -- rook/__version__.py | 2 -- rook/catalog/db.py | 2 +- rook/cli.py | 20 ++++++++++++++------ rook/dashboard/templates/dashboard.html | 2 +- rook/operator.py | 2 +- rook/processes/wps_average_dim.py | 2 +- rook/processes/wps_average_shape.py | 4 ++-- rook/processes/wps_average_time.py | 2 +- rook/processes/wps_average_weighted.py | 2 +- rook/processes/wps_concat.py | 2 +- rook/processes/wps_dashboard.py | 2 +- rook/processes/wps_orchestrate.py | 2 +- rook/processes/wps_regrid.py | 4 ++-- rook/processes/wps_subset.py | 2 +- rook/processes/wps_usage.py | 2 +- rook/provenance.py | 2 +- rook/workflow.py | 4 ++-- setup.py | 24 ++++++++++++------------ tests/common.py | 4 ++-- tests/test_wps_average_shape.py | 20 ++++++++++++-------- tests/test_wps_orchestrate.py | 2 +- tests/test_wps_subset.py | 2 +- tox.ini | 1 - 26 files changed, 62 insertions(+), 56 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 8cc422f1..3cd4084a 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -120,4 +120,3 @@ Then run:: $ bump2version patch # possible: major / minor / patch $ git push $ git push --tags - diff --git a/docs/source/conf.py b/docs/source/conf.py index f038dfde..2874aa06 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -42,7 +42,7 @@ "IPython.sphinxext.ipython_console_highlighting", "nbsphinx", "pywps.ext_autodoc", - ] +] # 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 @@ -102,7 +102,7 @@ # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: -source_suffix = {'.rst': 'restructuredtext'} +source_suffix = {".rst": "restructuredtext"} # The master toctree document. master_doc = "index" diff --git a/rook/__init__.py b/rook/__init__.py index 323bb7dd..c252c9fb 100644 --- a/rook/__init__.py +++ b/rook/__init__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """Top-level package for rook.""" from .__version__ import __author__, __email__, __version__ # noqa: F401 diff --git a/rook/__version__.py b/rook/__version__.py index 5b0549b2..c977c495 100644 --- a/rook/__version__.py +++ b/rook/__version__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - # This information is located in its own file so that it can be loaded # without importing the main package when its dependencies are not installed. # See: https://packaging.python.org/guides/single-sourcing-package-version diff --git a/rook/catalog/db.py b/rook/catalog/db.py index 4111c781..eeea5c21 100644 --- a/rook/catalog/db.py +++ b/rook/catalog/db.py @@ -15,7 +15,7 @@ class DBCatalog(Catalog): def __init__(self, project, url=None): - super(DBCatalog, self).__init__(project) + super().__init__(project) self.table_name = f"rook_catalog_{self.project}".replace("-", "_") self.intake_catalog = IntakeCatalog(project, url) diff --git a/rook/cli.py b/rook/cli.py index b50d4cc6..6e308f28 100644 --- a/rook/cli.py +++ b/rook/cli.py @@ -51,7 +51,7 @@ def run_process_action(action=None): and return a status message.""" action = action or "status" try: - with open(PID_FILE, "r") as fp: + with open(PID_FILE) as fp: pid = int(fp.read()) p = psutil.Process(pid) if action == "stop": @@ -65,7 +65,7 @@ def run_process_action(action=None): ) if action == "stop": os.remove(PID_FILE) - except IOError: + except OSError: msg = 'No PID file found. Service not running? Try "netstat -nlp | grep :5000".' except psutil.NoSuchProcess as e: msg = e.msg @@ -172,8 +172,16 @@ 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') +@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, @@ -206,8 +214,8 @@ def start( wps_log_level=log_level, wps_log_file=log_file, wps_database=database, - wps_outputurl = outputurl, - wps_outputpath = outputpath + wps_outputurl=outputurl, + wps_outputpath=outputpath, ) ) if config: diff --git a/rook/dashboard/templates/dashboard.html b/rook/dashboard/templates/dashboard.html index 16aa2d5f..950a1a57 100644 --- a/rook/dashboard/templates/dashboard.html +++ b/rook/dashboard/templates/dashboard.html @@ -49,4 +49,4 @@

Data Transfer

{{ script_t1 | safe }} {{ script_t2 | safe }} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/rook/operator.py b/rook/operator.py index 45ec6e56..a374bb5e 100644 --- a/rook/operator.py +++ b/rook/operator.py @@ -17,7 +17,7 @@ from roocs_utils.utils.file_utils import is_file_list, FileMapper -class Operator(object): +class Operator: # Sub-classes require "prefix" property prefix = NotImplemented diff --git a/rook/processes/wps_average_dim.py b/rook/processes/wps_average_dim.py index 9a545a64..275bd400 100644 --- a/rook/processes/wps_average_dim.py +++ b/rook/processes/wps_average_dim.py @@ -87,7 +87,7 @@ def __init__(self): ), ] - super(AverageByDimension, self).__init__( + super().__init__( self._handler, identifier="average", title="Average by Dimensions", diff --git a/rook/processes/wps_average_shape.py b/rook/processes/wps_average_shape.py index 21916129..76b50b71 100644 --- a/rook/processes/wps_average_shape.py +++ b/rook/processes/wps_average_shape.py @@ -31,7 +31,7 @@ def __init__(self): "shape", "Vector Shape", abstract="An ESRI Shapefile, GML, GeoPackage, JSON or GeoJSON file." - " The ESRI Shapefile must be zipped and contain the .shp, .shx, and .dbf.", + " The ESRI Shapefile must be zipped and contain the .shp, .shx, and .dbf.", supported_formats=[ FORMATS.GML, FORMATS.GEOJSON, @@ -87,7 +87,7 @@ def __init__(self): ), ] - super(AverageByShape, self).__init__( + super().__init__( self._handler, identifier="average_shape", title="Average over polygonal shape", diff --git a/rook/processes/wps_average_time.py b/rook/processes/wps_average_time.py index bce33e4f..31aaef32 100644 --- a/rook/processes/wps_average_time.py +++ b/rook/processes/wps_average_time.py @@ -81,7 +81,7 @@ def __init__(self): ), ] - super(AverageByTime, self).__init__( + super().__init__( self._handler, identifier="average_time", title="Average by Time", diff --git a/rook/processes/wps_average_weighted.py b/rook/processes/wps_average_weighted.py index 9e4578cc..ee34612b 100644 --- a/rook/processes/wps_average_weighted.py +++ b/rook/processes/wps_average_weighted.py @@ -54,7 +54,7 @@ def __init__(self): ), ] - super(WeightedAverage, self).__init__( + super().__init__( self._handler, identifier="weighted_average", title="Weighted Average", diff --git a/rook/processes/wps_concat.py b/rook/processes/wps_concat.py index d30c1870..aa1d68cf 100644 --- a/rook/processes/wps_concat.py +++ b/rook/processes/wps_concat.py @@ -114,7 +114,7 @@ def __init__(self): ), ] - super(Concat, self).__init__( + super().__init__( self._handler, identifier="concat", title="Concat", diff --git a/rook/processes/wps_dashboard.py b/rook/processes/wps_dashboard.py index 6a6f6b4f..aab6932f 100644 --- a/rook/processes/wps_dashboard.py +++ b/rook/processes/wps_dashboard.py @@ -45,7 +45,7 @@ def __init__(self): ), ] - super(DashboardProcess, self).__init__( + super().__init__( self._handler, identifier="dashboard", title="Dashboard", diff --git a/rook/processes/wps_orchestrate.py b/rook/processes/wps_orchestrate.py index fefea81e..084c06b0 100644 --- a/rook/processes/wps_orchestrate.py +++ b/rook/processes/wps_orchestrate.py @@ -49,7 +49,7 @@ def __init__(self): ), ] - super(Orchestrate, self).__init__( + super().__init__( self._handler, identifier="orchestrate", title="Orchestrate", diff --git a/rook/processes/wps_regrid.py b/rook/processes/wps_regrid.py index 88d36ae5..89f33582 100644 --- a/rook/processes/wps_regrid.py +++ b/rook/processes/wps_regrid.py @@ -52,7 +52,7 @@ def __init__(self): "0pt75deg", "1deg", "1pt25deg", - "2pt5deg" + "2pt5deg", ], default="auto", ), @@ -83,7 +83,7 @@ def __init__(self): ), ] - super(Regrid, self).__init__( + super().__init__( self._handler, identifier="regrid", title="Regrid", diff --git a/rook/processes/wps_subset.py b/rook/processes/wps_subset.py index bfad589b..f3b432de 100644 --- a/rook/processes/wps_subset.py +++ b/rook/processes/wps_subset.py @@ -120,7 +120,7 @@ def __init__(self): ), ] - super(Subset, self).__init__( + super().__init__( self._handler, identifier="subset", title="Subset", diff --git a/rook/processes/wps_usage.py b/rook/processes/wps_usage.py index 79943aa0..b7c8ae70 100644 --- a/rook/processes/wps_usage.py +++ b/rook/processes/wps_usage.py @@ -46,7 +46,7 @@ def __init__(self): ), ] - super(Usage, self).__init__( + super().__init__( self._handler, identifier="usage", title="Usage", diff --git a/rook/provenance.py b/rook/provenance.py index 98534a56..0859dae2 100644 --- a/rook/provenance.py +++ b/rook/provenance.py @@ -28,7 +28,7 @@ ROOCS = Namespace("roocs", uri="urn:roocs:") -class Provenance(object): +class Provenance: def __init__(self, output_dir): if isinstance(output_dir, pathlib.Path): self.output_dir = output_dir diff --git a/rook/workflow.py b/rook/workflow.py index fce2697e..3bae7fe9 100644 --- a/rook/workflow.py +++ b/rook/workflow.py @@ -65,7 +65,7 @@ def build_tree(wfdoc): return tree -class WorkflowRunner(object): +class WorkflowRunner: def __init__(self, output_dir): self.workflow = Workflow(output_dir) @@ -80,7 +80,7 @@ def provenance(self): return self.workflow.prov -class BaseWorkflow(object): +class BaseWorkflow: def __init__(self, output_dir): self.concat_op = Concat(output_dir) self.subset_op = Subset(output_dir) diff --git a/setup.py b/setup.py index fe7d1a2f..80d2f2ee 100644 --- a/setup.py +++ b/setup.py @@ -12,11 +12,11 @@ REQUIRES_PYTHON = ">=3.9.0" about = {} -with open(os.path.join(here, "rook", "__version__.py"), "r") as f: +with open(os.path.join(here, "rook", "__version__.py")) as f: exec(f.read(), about) -requirements = [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", @@ -36,19 +36,19 @@ ] setup( - name='roocs-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", zip_safe=False, - keywords='wps pywps birdhouse rook', + keywords="wps pywps birdhouse rook", packages=find_packages(), include_package_data=True, install_requires=requirements, @@ -56,8 +56,8 @@ "dev": dev_reqs, # pip install ".[dev]" }, entry_points={ - 'console_scripts': [ - 'rook=rook.cli:cli', + "console_scripts": [ + "rook=rook.cli:cli", ] }, ) diff --git a/tests/common.py b/tests/common.py index 749e290e..36bb4c2f 100644 --- a/tests/common.py +++ b/tests/common.py @@ -67,7 +67,7 @@ def get(self, *args, **kwargs): query = "?" for key, value in kwargs.items(): query += "{}={}&".format(key, value) - return super(WpsTestClient, self).get(query) + return super().get(query) def client_for(service): @@ -100,6 +100,6 @@ def get_output(doc): def extract_paths_from_metalink(path): path = path.replace("file://", "") - doc = BeautifulSoup(open(path, "r").read(), "xml") + doc = BeautifulSoup(open(path).read(), "xml") paths = [el.text.replace("file://", "") for el in doc.find_all("metaurl")] return paths diff --git a/tests/test_wps_average_shape.py b/tests/test_wps_average_shape.py index 6cb30395..faee02cf 100644 --- a/tests/test_wps_average_shape.py +++ b/tests/test_wps_average_shape.py @@ -11,19 +11,23 @@ from .common import PYWPS_CFG, get_output, extract_paths_from_metalink -POLY = Polygon([[5.8671874999999996, 57.326521225217064], - [-15.468749999999998, 48.45835188280866], - [-16.171875, 24.84656534821976], - [-3.8671874999999996, 13.581920900545844], - [21.796875, 25.799891182088334], - [22.8515625, 52.482780222078226], - [5.8671874999999996, 57.326521225217064]]) +POLY = Polygon( + [ + [5.8671874999999996, 57.326521225217064], + [-15.468749999999998, 48.45835188280866], + [-16.171875, 24.84656534821976], + [-3.8671874999999996, 13.581920900545844], + [21.796875, 25.799891182088334], + [22.8515625, 52.482780222078226], + [5.8671874999999996, 57.326521225217064], + ] +) def test_wps_average_shape_cmip6(tmp_path): # Save POLY to tmpdir tmp_poly_path = tmp_path / "tmppoly.json" - gpd.GeoDataFrame([{'geometry': POLY}]).to_file(tmp_poly_path) + gpd.GeoDataFrame([{"geometry": POLY}]).to_file(tmp_poly_path) # test the case where the inventory is used client = client_for(Service(processes=[AverageByShape()], cfgfiles=[PYWPS_CFG])) diff --git a/tests/test_wps_orchestrate.py b/tests/test_wps_orchestrate.py index 4820e603..dd782335 100644 --- a/tests/test_wps_orchestrate.py +++ b/tests/test_wps_orchestrate.py @@ -125,7 +125,7 @@ def test_wps_orchestrate_c3s_cmip6_subset_metadata(): m_path = get_output(resp.xml)["output"] # print(m_path) # parse metalink - xml = open(m_path[7:], "r").read() + xml = open(m_path[7:]).read() urls = parse_metalink(xml) # print(urls) ds = xr.open_dataset(urls[0][7:], use_cftime=True) diff --git a/tests/test_wps_subset.py b/tests/test_wps_subset.py index 7ec94c76..1eed47fd 100644 --- a/tests/test_wps_subset.py +++ b/tests/test_wps_subset.py @@ -100,7 +100,7 @@ def test_wps_subset_c3s_cmip6_metadata(): m_path = get_output(resp.xml)["output"] assert "meta4" in m_path # parse metalink - xml = open(m_path[7:], "r").read() + xml = open(m_path[7:]).read() urls = parse_metalink(xml) # print(urls) ds = xr.open_dataset(urls[0][7:], use_cftime=True) diff --git a/tox.ini b/tox.ini index a4703a4d..b73f23cc 100644 --- a/tox.ini +++ b/tox.ini @@ -23,4 +23,3 @@ deps = ; -r{toxinidir}/requirements.txt commands = pytest --basetemp={envtmpdir} - From 7767cbc5f2da00bf35a2b87f3c7cb291350dd92e Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 27 Sep 2024 12:16:20 -0400 Subject: [PATCH 04/21] synchronize dependencies --- .github/workflows/main.yml | 4 ++-- environment-docs.yml | 5 ++--- environment.yml | 17 ++++++++--------- requirements.txt | 22 ++++++++++++---------- requirements_dev.txt | 3 ++- 5 files changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 49b75e0b..b4dfcf27 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -103,9 +103,9 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: pip - - name: Install dev requirements 📦 + - name: Install rook with dev requirements 📦 run: | - python -m pip install -r requirements_dev.txt + python -m pip install -e ".[dev]" - name: Build Docs 📚 run: | make docs diff --git a/environment-docs.yml b/environment-docs.yml index 4462e081..d8364982 100644 --- a/environment-docs.yml +++ b/environment-docs.yml @@ -2,10 +2,9 @@ name: rook channels: - conda-forge - - defaults dependencies: - python >=3.9,<3.10 - pywps >=4.5.2,<4.7 - sphinx >=7.0.0 - - nbsphinx - - ipython + - nbsphinx >=0.9.5 + - ipython >=8.13.0 diff --git a/environment.yml b/environment.yml index 8f6f89be..9be153f5 100644 --- a/environment.yml +++ b/environment.yml @@ -1,7 +1,6 @@ name: rook channels: - conda-forge - - defaults dependencies: - python >=3.9,<3.13 - pywps >=4.5.2,<4.7 @@ -16,10 +15,10 @@ dependencies: - 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 + - bottleneck >=1.3.1,<1.4.0 + - daops >=0.11.0,<0.12.0 + - clisops >=0.12.2,<0.13.0 + - roocs-utils >=0.6.9,<0.7.0 - roocs-grids >=0.1.2 # workflow - networkx @@ -28,12 +27,12 @@ dependencies: - pydot - graphviz # catalog - - intake >=0.7.0,<2.0 - - pandas >=1.3.5,<2.0 - - sqlalchemy >=1.4.45,<2.0 + - intake + - pandas + - sqlalchemy - aiohttp # dashboard - - bokeh >=2.4.2,<2.5 + - bokeh >=3.4.3 # tests - pytest - pytest-timeout diff --git a/requirements.txt b/requirements.txt index a7840e07..bedbf68e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,19 +1,21 @@ click jinja2 psutil -pywps>=4.5.1,<4.6 +pywps>=4.5.2,<4.7 # daops -daops>=0.11.0,<0.12 +daops>=0.11.0,<0.12.0 # daops @ git+https://github.com/roocs/daops.git@regrid-main-ce#egg=daops -clisops>=0.12.2,<0.13 +clisops>=0.12.2,<0.13.0 # clisops @ git+https://github.com/roocs/clisops.git@master#egg=clisops -roocs-utils>=0.6.9,<0.7 +roocs-utils>=0.6.9,<0.7.0 # roocs-utils @ git+https://github.com/roocs/roocs-utils.git@master#egg=roocs_utils roocs_grids>=0.1.2 -xarray>=0.21 +xarray>=0.21,<2023.3.0 # https://github.com/pydata/xarray/issues/7794 cf-xarray>=0.7 -dask[complete] -netcdf4 +cftime>=1.2.1 +bottleneck>=1.3.1,<1.4.0 +dask[complete]>=2021.12.0 +netcdf4>=1.4 # workflow networkx # provenance @@ -21,9 +23,9 @@ prov>=2.0.0 pydot # catalog intake -pandas>=1.3.5,<2.0 -SQLAlchemy>=1.4.45,<2.0 +pandas +SQLAlchemy aiohttp # dashboard -bokeh>=2.4.2,<2.5 +bokeh>=3.4.3 humanize diff --git a/requirements_dev.txt b/requirements_dev.txt index 6b0a9b0a..712e0185 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -4,12 +4,13 @@ coverage>=4.5.4 click>=7.0 cruft flake8 +ipython>=8.13.0 nbval>=0.10.0 pytest>=6.2.4 pytest-cov pytest-flake8 pytest-notebook -nbsphinx +nbsphinx>=0.9.5 nbval>=0.9.6 nbconvert sphinx>=1.8.5 From 454309e7120fe963ee9350d5f28b97b758c02740 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 27 Sep 2024 12:18:12 -0400 Subject: [PATCH 05/21] unpin bokeh --- environment.yml | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index 9be153f5..578727c7 100644 --- a/environment.yml +++ b/environment.yml @@ -32,7 +32,7 @@ dependencies: - sqlalchemy - aiohttp # dashboard - - bokeh >=3.4.3 + - bokeh # tests - pytest - pytest-timeout diff --git a/requirements.txt b/requirements.txt index bedbf68e..6990491c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -27,5 +27,5 @@ pandas SQLAlchemy aiohttp # dashboard -bokeh>=3.4.3 +bokeh humanize From 065c0e1f1e8d888efa37652dec487a470cb88e85 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 27 Sep 2024 12:22:26 -0400 Subject: [PATCH 06/21] unpin clisops --- environment.yml | 3 +-- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/environment.yml b/environment.yml index 578727c7..ca2868b0 100644 --- a/environment.yml +++ b/environment.yml @@ -8,7 +8,6 @@ dependencies: - 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 @@ -17,7 +16,7 @@ dependencies: - netcdf4 >=1.4 - bottleneck >=1.3.1,<1.4.0 - daops >=0.11.0,<0.12.0 - - clisops >=0.12.2,<0.13.0 + - clisops - roocs-utils >=0.6.9,<0.7.0 - roocs-grids >=0.1.2 # workflow diff --git a/requirements.txt b/requirements.txt index 6990491c..d91c527b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ pywps>=4.5.2,<4.7 # daops daops>=0.11.0,<0.12.0 # daops @ git+https://github.com/roocs/daops.git@regrid-main-ce#egg=daops -clisops>=0.12.2,<0.13.0 +clisops # clisops @ git+https://github.com/roocs/clisops.git@master#egg=clisops roocs-utils>=0.6.9,<0.7.0 # roocs-utils @ git+https://github.com/roocs/roocs-utils.git@master#egg=roocs_utils From 450b29a1e759112572b25ae060103f0396ed2bef Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 27 Sep 2024 12:30:34 -0400 Subject: [PATCH 07/21] drop Python3.12 builds --- .github/workflows/main.yml | 2 +- setup.py | 2 +- tox.ini | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b4dfcf27..d5f47a6e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -52,7 +52,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11" ] # "3.12" defaults: run: shell: bash -l {0} diff --git a/setup.py b/setup.py index 80d2f2ee..f0d39816 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", + # "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Atmospheric Science", "License :: OSI Approved :: Apache Software License", ] diff --git a/tox.ini b/tox.ini index b73f23cc..2cadf791 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] min_version = 4.0 envlist = - py{39,310,311,312}, + py{39,310,311}, flake8 requires = pip >= 23.1.0 opts = -v From b793e39a0db626a356433cecd1f884451162bb16 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 27 Sep 2024 12:39:35 -0400 Subject: [PATCH 08/21] pin micromamba --- .github/workflows/main.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d5f47a6e..94f3a594 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -70,11 +70,10 @@ jobs: environment-file: environment.yml create-args: >- python=${{ matrix.python-version }} + micromamba-version: 1.5.10-0 # Pin micromamba version because of following issue: https://github.com/mamba-org/setup-micromamba/issues/225 - name: Install requirements 📦 run: | - python -m pip install -e . - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi + python -m pip install -e ".[dev]" - name: Test with pytest ⚙️ run: make test From 22734edefb42b4d254458435080addfa71d5020b Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 27 Sep 2024 13:08:36 -0400 Subject: [PATCH 09/21] adjust testing calls, skip smoke tests --- .github/workflows/main.yml | 3 ++- setup.cfg | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 94f3a594..446d897c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -75,7 +75,8 @@ jobs: run: | python -m pip install -e ".[dev]" - name: Test with pytest ⚙️ - run: make test + run: | + pytest -v -m "not slow and not online and not smoke" tests docs: name: Docs (Python${{ matrix.python-version }}) diff --git a/setup.cfg b/setup.cfg index 3da41330..1b6d82b6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -27,6 +27,9 @@ universal = 1 [tool:pytest] addopts = + --color=yes + --cov=rook + --cov-report=term-missing --ignore=setup.py --strict-markers --tb=native From 5c5a50c6d4530456129cb9e48f6ed9566632bea7 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 27 Sep 2024 14:28:15 -0400 Subject: [PATCH 10/21] dependency adjustments --- .github/workflows/main.yml | 2 +- environment.yml | 7 +++---- requirements.txt | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 446d897c..22db2925 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -76,7 +76,7 @@ jobs: python -m pip install -e ".[dev]" - name: Test with pytest ⚙️ run: | - pytest -v -m "not slow and not online and not smoke" tests + pytest -v -m "not slow and not online" tests docs: name: Docs (Python${{ matrix.python-version }}) diff --git a/environment.yml b/environment.yml index ca2868b0..b1f02635 100644 --- a/environment.yml +++ b/environment.yml @@ -2,7 +2,7 @@ name: rook channels: - conda-forge dependencies: - - python >=3.9,<3.13 + - python >=3.9,<3.12 - pywps >=4.5.2,<4.7 - jinja2 - click @@ -14,9 +14,8 @@ dependencies: - cf_xarray >=0.7 - dask >=2021.12 - netcdf4 >=1.4 - - bottleneck >=1.3.1,<1.4.0 - daops >=0.11.0,<0.12.0 - - clisops + - clisops >=0.11.0 - roocs-utils >=0.6.9,<0.7.0 - roocs-grids >=0.1.2 # workflow @@ -28,7 +27,7 @@ dependencies: # catalog - intake - pandas - - sqlalchemy + - sqlalchemy >=1.4.45,<2.0 # Needed to pass existing tests - aiohttp # dashboard - bokeh diff --git a/requirements.txt b/requirements.txt index d91c527b..6ccde6b9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,6 @@ roocs_grids>=0.1.2 xarray>=0.21,<2023.3.0 # https://github.com/pydata/xarray/issues/7794 cf-xarray>=0.7 cftime>=1.2.1 -bottleneck>=1.3.1,<1.4.0 dask[complete]>=2021.12.0 netcdf4>=1.4 # workflow @@ -24,7 +23,7 @@ pydot # catalog intake pandas -SQLAlchemy +SQLAlchemy>=1.4.45,<2.0 aiohttp # dashboard bokeh From 0cd9b037a95338379bcb03bee2fbdc6f07eed21a Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 27 Sep 2024 16:36:27 -0400 Subject: [PATCH 11/21] modernize Dockerfile --- Dockerfile | 32 +++++++++++++++++--------------- rook/cli.py | 29 ++++++++--------------------- 2 files changed, 25 insertions(+), 36 deletions(-) diff --git a/Dockerfile b/Dockerfile index ba41fe43..8ff560df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,30 @@ # vim:set ft=dockerfile: -FROM continuumio/miniconda3 +FROM condaforge/mambaforge +ARG DEBIAN_FRONTEND=noninteractive +ENV PIP_ROOT_USER_ACTION=ignore +LABEL org.opencontainers.image.authors="https://github.com/roocs/rook" LABEL Description="rook WPS" Vendor="Birdhouse" Version="0.13.1" -# Update Debian system -RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/* +# Set the working directory to /code +WORKDIR /code -# Update conda -RUN conda update -n base conda +# Create conda environment +COPY environment.yml . +RUN mamba env create -n rook -f environment.yml && mamba install -n rook gunicorn && mamba clean --all --yes -# Copy WPS project -COPY . /opt/wps +# Add the rook conda environment to the path +ENV PATH=/opt/conda/envs/rook/bin:$PATH -WORKDIR /opt/wps +# Copy rook source code +COPY . /code -# Create conda environment with PyWPS -RUN ["conda", "env", "create", "-n", "wps", "-f", "environment.yml"] - -# Install WPS -RUN ["/bin/bash", "-c", "source activate wps && pip install -e ."] +# Install rook +RUN pip install . --no-deps # Start WPS service on port 5000 on 0.0.0.0 EXPOSE 5000 -ENTRYPOINT ["/bin/bash", "-c"] -CMD ["source activate wps && exec rook start -b 0.0.0.0 -c /opt/wps/etc/demo.cfg"] + +CMD ["gunicorn", "--bind=0.0.0.0:5000", "rook.wsgi:application"] # docker build -t roocs/rook . # docker run -p 5000:5000 roocs/rook diff --git a/rook/cli.py b/rook/cli.py index 6e308f28..9498c6cd 100644 --- a/rook/cli.py +++ b/rook/cli.py @@ -6,13 +6,14 @@ ########################################################### import os -import psutil +from urllib.parse import urlparse + import click +import psutil from jinja2 import Environment, PackageLoader from pywps import configuration from . import wsgi -from urllib.parse import urlparse PID_FILE = os.path.abspath(os.path.join(os.path.curdir, "pywps.pid")) @@ -34,7 +35,7 @@ def get_host(): url = configuration.get_config_value("server", "url") url = url or "http://localhost:5000/wps" - click.echo("starting WPS service on {}".format(url)) + click.echo(f"starting WPS service on {url}") parsed_url = urlparse(url) if ":" in parsed_url.netloc: @@ -56,7 +57,7 @@ def run_process_action(action=None): p = psutil.Process(pid) if action == "stop": p.terminate() - msg = "pid={}, status=terminated".format(p.pid) + msg = f"pid={p.pid}, status=terminated" else: from psutil import _pprint_secs @@ -172,16 +173,6 @@ 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, @@ -194,14 +185,12 @@ def start( log_level, log_file, database, - outputurl, - outputpath, ): """Start PyWPS service. This service is by default available at http://localhost:5000/wps """ if os.path.exists(PID_FILE): - click.echo('PID file exists: "{}". Service still running?'.format(PID_FILE)) + click.echo(f'PID file exists: "{PID_FILE}". Service still running?') os._exit(0) cfgfiles = [] cfgfiles.append( @@ -214,8 +203,6 @@ def start( wps_log_level=log_level, wps_log_file=log_file, wps_database=database, - wps_outputurl=outputurl, - wps_outputpath=outputpath, ) ) if config: @@ -231,9 +218,9 @@ def start( try: pid = os.fork() if pid: - click.echo("forked process id: {}".format(pid)) + click.echo(f"forked process id: {pid}") with open(PID_FILE, "w") as fp: - fp.write("{}".format(pid)) + fp.write(f"{pid}") except OSError as e: raise Exception("%s [%d]" % (e.strerror, e.errno)) From 40d619964a2ab486d7082a4d730a1829e79e6a98 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 27 Sep 2024 16:45:39 -0400 Subject: [PATCH 12/21] add username and password --- .github/workflows/docker-testing.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker-testing.yml b/.github/workflows/docker-testing.yml index 98d9f8ca..936815e0 100644 --- a/.github/workflows/docker-testing.yml +++ b/.github/workflows/docker-testing.yml @@ -41,6 +41,8 @@ jobs: - name: Run Docker image uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3 with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} image: localrook:latest options: -p 5000:5000 run: | From efc9cd11ac53933331b77f8abe13223d065014d3 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 27 Sep 2024 17:01:42 -0400 Subject: [PATCH 13/21] remove username and password --- .github/workflows/docker-testing.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/docker-testing.yml b/.github/workflows/docker-testing.yml index 936815e0..98d9f8ca 100644 --- a/.github/workflows/docker-testing.yml +++ b/.github/workflows/docker-testing.yml @@ -41,8 +41,6 @@ jobs: - name: Run Docker image uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} image: localrook:latest options: -p 5000:5000 run: | From 141cfbaa4fd9ce6081da094500ccd656d7e96c0b Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 27 Sep 2024 17:20:51 -0400 Subject: [PATCH 14/21] add docker login action --- .github/workflows/docker-testing.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/docker-testing.yml b/.github/workflows/docker-testing.yml index 98d9f8ca..16e1b40b 100644 --- a/.github/workflows/docker-testing.yml +++ b/.github/workflows/docker-testing.yml @@ -26,6 +26,11 @@ jobs: egress-policy: audit - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - name: Login to Docker Hub + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 - name: Build Docker image (no push) From 9881f831fdd70bf3e233c9b4d5287f31f3429f88 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 27 Sep 2024 17:21:34 -0400 Subject: [PATCH 15/21] secret name fix --- .github/workflows/docker-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-testing.yml b/.github/workflows/docker-testing.yml index 16e1b40b..c8900042 100644 --- a/.github/workflows/docker-testing.yml +++ b/.github/workflows/docker-testing.yml @@ -29,8 +29,8 @@ jobs: - name: Login to Docker Hub uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 - name: Build Docker image (no push) From 215e282ad1f289f7ecc5c9f1e56e2085466827df Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 27 Sep 2024 17:22:29 -0400 Subject: [PATCH 16/21] secret name fix --- .github/workflows/docker-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-testing.yml b/.github/workflows/docker-testing.yml index c8900042..218db1af 100644 --- a/.github/workflows/docker-testing.yml +++ b/.github/workflows/docker-testing.yml @@ -30,7 +30,7 @@ jobs: uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 with: username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} + password: ${{ secrets.DOCKER_PASSWORD }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 - name: Build Docker image (no push) From ef0f842aed6d851b38ff37b52cee15435fe9cf71 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 1 Oct 2024 16:53:36 -0400 Subject: [PATCH 17/21] fix documentation build failures, remove obsolete imports --- .readthedocs.yml | 2 +- docs/source/conf.py | 60 +++++++++++++------------- docs/source/processes.rst | 14 +++++- rook/__init__.py | 8 +++- rook/dashboard/plots/activity.py | 2 +- rook/processes/wps_average_dim.py | 3 -- rook/processes/wps_average_shape.py | 2 - rook/processes/wps_average_time.py | 2 - rook/processes/wps_average_weighted.py | 4 -- rook/processes/wps_concat.py | 3 -- 10 files changed, 52 insertions(+), 48 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index a6a210c1..99cb8827 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -10,7 +10,7 @@ sphinx: configuration: docs/source/conf.py # fail_on_warning might generate hard to fix error, in this case it can be # disabled but this also means those errors will fail silently, choose wisely. - fail_on_warning: false + fail_on_warning: true # Optionally build your docs in additional formats such as PDF and ePub formats: all diff --git a/docs/source/conf.py b/docs/source/conf.py index 2874aa06..148142b5 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -48,45 +48,47 @@ # List of all tested working mock imports from all birds so new birds can # inherit without having to test which work which do not. autodoc_mock_imports = [ - "numpy", - "xarray", + "affine", + "bottleneck", + "cairo", + "cartopy", + "cftime", + "dask", "fiona", - "rasterio", - "shapely", - "osgeo", + "gdal", "geopandas", + "geos", + "geotiff", + "hdf4", + "hdf5", + "matplotlib", + "netCDF4", + "networkx", + "numba", + "numpy", + "ocgis", + "osgeo", "pandas", - "statsmodels", - "affine", + "parse", + "proj", + "pyproj", + "rasterio", "rasterstats", - "spotpy", - "matplotlib", + "scikit-learn", "scipy", - "unidecode", - "gdal", "sentry_sdk", - "dask", - "numba", - "parse", + "shapely", "siphon", "sklearn", - "cftime", - "netCDF4", - "bottleneck", - "ocgis", - "geotiff", - "geos", - "hdf4", - "hdf5", + "spotpy", + "statsmodels", + "unidecode", + "xarray", "zlib", - "pyproj", - "proj", - "cartopy", - "scikit-learn", - "cairo", - "networkx", - "roocs_utils", + # roocs + "clisops" "daops", + "roocs_utils", ] # Monkeypatch constant because the following are mock imports. diff --git a/docs/source/processes.rst b/docs/source/processes.rst index 72a162a3..1b616592 100644 --- a/docs/source/processes.rst +++ b/docs/source/processes.rst @@ -17,7 +17,19 @@ Subset Average ------- -.. autoprocess:: rook.processes.wps_average.Average +.. autoprocess:: rook.processes.wps_average_dim.AverageByDimension + :docstring: + :skiplines: 1 + +.. autoprocess:: rook.processes.wps_average_shape.AverageByShape + :docstring: + :skiplines: 1 + +.. autoprocess:: rook.processes.wps_average_time.AverageByTime + :docstring: + :skiplines: 1 + +.. autoprocess:: rook.processes.wps_average_weighted.WeightedAverage :docstring: :skiplines: 1 diff --git a/rook/__init__.py b/rook/__init__.py index c252c9fb..d8a3b499 100644 --- a/rook/__init__.py +++ b/rook/__init__.py @@ -3,8 +3,12 @@ from roocs_utils.config import get_config -import rook +# Workaround for roocs_utils to not re-import rook +class Package: + __file__ = __file__ # noqa -CONFIG = get_config(rook) + +package = Package() +CONFIG = get_config(package) from .wsgi import application # noqa: F401 diff --git a/rook/dashboard/plots/activity.py b/rook/dashboard/plots/activity.py index 1f69d1c7..6c92d85f 100644 --- a/rook/dashboard/plots/activity.py +++ b/rook/dashboard/plots/activity.py @@ -25,7 +25,7 @@ def plot(self): toolbar_location=None, x_axis_type="datetime", sizing_mode="scale_width", - plot_height=100, + height=100, ) status = ["success", "failed"] colors = ["green", "red"] diff --git a/rook/processes/wps_average_dim.py b/rook/processes/wps_average_dim.py index 275bd400..9e641a1e 100644 --- a/rook/processes/wps_average_dim.py +++ b/rook/processes/wps_average_dim.py @@ -3,8 +3,6 @@ from pywps import FORMATS, ComplexOutput, Format, LiteralInput, Process from pywps.app.Common import Metadata -from pywps.app.exceptions import ProcessError -from pywps.inout.outputs import MetaFile, MetaLink4 from ..director import wrap_director from ..utils.input_utils import parse_wps_input @@ -122,7 +120,6 @@ def _handler(self, request, response): request.inputs, "dims", as_sequence=True, default=None ), } - # print(inputs) # Let the director manage the processing or redirection to original files director = wrap_director(collection, inputs, run_average_by_dim) diff --git a/rook/processes/wps_average_shape.py b/rook/processes/wps_average_shape.py index 76b50b71..ec63ada9 100644 --- a/rook/processes/wps_average_shape.py +++ b/rook/processes/wps_average_shape.py @@ -3,8 +3,6 @@ from pywps import FORMATS, ComplexOutput, Format, LiteralInput, Process, ComplexInput from pywps.app.Common import Metadata -from pywps.app.exceptions import ProcessError -from pywps.inout.outputs import MetaFile, MetaLink4 from ..director import wrap_director from ..utils.input_utils import parse_wps_input diff --git a/rook/processes/wps_average_time.py b/rook/processes/wps_average_time.py index 31aaef32..c3181330 100644 --- a/rook/processes/wps_average_time.py +++ b/rook/processes/wps_average_time.py @@ -3,8 +3,6 @@ from pywps import FORMATS, ComplexOutput, Format, LiteralInput, Process from pywps.app.Common import Metadata -from pywps.app.exceptions import ProcessError -from pywps.inout.outputs import MetaFile, MetaLink4 from ..director import wrap_director from ..utils.input_utils import parse_wps_input diff --git a/rook/processes/wps_average_weighted.py b/rook/processes/wps_average_weighted.py index ee34612b..bc32d405 100644 --- a/rook/processes/wps_average_weighted.py +++ b/rook/processes/wps_average_weighted.py @@ -1,10 +1,7 @@ import logging -import os from pywps import FORMATS, ComplexOutput, Format, LiteralInput, Process from pywps.app.Common import Metadata -from pywps.app.exceptions import ProcessError -from pywps.inout.outputs import MetaFile, MetaLink4 from ..director import wrap_director from ..utils.input_utils import parse_wps_input @@ -82,7 +79,6 @@ def _handler(self, request, response): "apply_fixes": False, "pre_checked": False, } - # print(inputs) # Let the director manage the processing or redirection to original files director = wrap_director(collection, inputs, run_weighted_average) diff --git a/rook/processes/wps_concat.py b/rook/processes/wps_concat.py index aa1d68cf..fc8962e6 100644 --- a/rook/processes/wps_concat.py +++ b/rook/processes/wps_concat.py @@ -3,9 +3,6 @@ from pywps import FORMATS, ComplexOutput, Format, LiteralInput, Process from pywps.app.Common import Metadata -# from pywps.app.exceptions import ProcessError -# from pywps.inout.outputs import MetaFile, MetaLink4 - from ..director import wrap_director from ..utils.input_utils import parse_wps_input from ..utils.metalink_utils import build_metalink From e8196285536e54377e8429117058c5a6785cc9bf Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 1 Oct 2024 16:55:33 -0400 Subject: [PATCH 18/21] fix typos --- docs/source/conf.py | 2 +- rook/__init__.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 148142b5..921c0653 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -86,7 +86,7 @@ "xarray", "zlib", # roocs - "clisops" + "clisops", "daops", "roocs_utils", ] diff --git a/rook/__init__.py b/rook/__init__.py index d8a3b499..02021982 100644 --- a/rook/__init__.py +++ b/rook/__init__.py @@ -1,8 +1,10 @@ """Top-level package for rook.""" + from .__version__ import __author__, __email__, __version__ # noqa: F401 from roocs_utils.config import get_config + # Workaround for roocs_utils to not re-import rook class Package: __file__ = __file__ # noqa From d981ccadfe3965f5d4bb8756ebac93bef955de40 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 7 Oct 2024 16:01:11 -0400 Subject: [PATCH 19/21] fast-forward cookiecutter, update pre-commit --- .codacy.yml | 6 +- .cruft.json | 3 +- .gitignore | 3 + .pre-commit-config.yaml | 4 +- .yamllint.yaml | 39 +++ CHANGES.rst => CHANGELOG.rst | 0 CODE_OF_CONDUCT.rst | 84 +++++++ CONTRIBUTING.rst | 22 +- MANIFEST.in | 7 - Makefile | 14 +- README.rst | 6 +- docs/source/changelog.rst | 1 + docs/source/changes.rst | 1 - docs/source/conf.py | 1 - docs/source/index.rst | 2 +- environment-dev.yml | 22 ++ environment-docs.yml | 7 +- environment.yml | 13 +- pyproject.toml | 224 ++++++++++++++++++ rook/__init__.py | 16 -- setup.cfg | 45 ---- setup.py | 63 ----- src/rook/__init__.py | 34 +++ {rook => src/rook}/__version__.py | 4 +- {rook => src/rook}/catalog/__init__.py | 0 {rook => src/rook}/catalog/db.py | 0 {rook => src/rook}/cli.py | 63 +++-- {rook => src/rook}/dashboard/__init__.py | 0 {rook => src/rook}/dashboard/base.py | 0 {rook => src/rook}/dashboard/dashboard.py | 0 {rook => src/rook}/dashboard/models.py | 0 .../rook}/dashboard/plots/__init__.py | 0 .../rook}/dashboard/plots/activity.py | 0 .../rook}/dashboard/plots/activity2.py | 0 {rook => src/rook}/dashboard/plots/base.py | 0 .../rook}/dashboard/plots/concurrency.py | 0 {rook => src/rook}/dashboard/plots/day.py | 0 .../rook}/dashboard/plots/downloads.py | 0 .../rook}/dashboard/plots/duration.py | 0 {rook => src/rook}/dashboard/plots/hour.py | 0 {rook => src/rook}/dashboard/plots/pulse.py | 0 .../rook}/dashboard/plots/transfer.py | 0 .../rook}/dashboard/tables/__init__.py | 0 {rook => src/rook}/dashboard/tables/base.py | 0 .../rook}/dashboard/tables/messages.py | 0 .../rook}/dashboard/tables/overview.py | 0 .../rook}/dashboard/templates/base.html | 0 .../rook}/dashboard/templates/dashboard.html | 0 .../rook}/dashboard/templates/navbar.html | 0 {rook => src/rook}/default.cfg | 0 {rook => src/rook}/director/__init__.py | 0 {rook => src/rook}/director/alignment.py | 0 {rook => src/rook}/director/director.py | 0 {rook => src/rook}/etc/roocs.ini | 0 {rook => src/rook}/exceptions.py | 0 {rook => src/rook}/operator.py | 0 {rook => src/rook}/processes/__init__.py | 4 + .../rook}/processes/wps_average_dim.py | 0 .../rook}/processes/wps_average_shape.py | 0 .../rook}/processes/wps_average_time.py | 0 .../rook}/processes/wps_average_weighted.py | 0 {rook => src/rook}/processes/wps_concat.py | 0 {rook => src/rook}/processes/wps_dashboard.py | 0 .../rook}/processes/wps_orchestrate.py | 0 {rook => src/rook}/processes/wps_regrid.py | 0 {rook => src/rook}/processes/wps_subset.py | 0 {rook => src/rook}/processes/wps_usage.py | 0 {rook => src/rook}/provenance.py | 0 src/rook/rook.py | 1 + {rook => src/rook}/templates/pywps.cfg | 6 +- {rook => src/rook}/usage/__init__.py | 0 {rook => src/rook}/usage/base.py | 0 {rook => src/rook}/usage/combine.py | 0 {rook => src/rook}/usage/downloads.py | 0 {rook => src/rook}/usage/wpsusage.py | 0 {rook => src/rook}/utils/__init__.py | 0 {rook => src/rook}/utils/apply_fixes.py | 0 {rook => src/rook}/utils/atlas_fixes.py | 0 {rook => src/rook}/utils/average_utils.py | 0 {rook => src/rook}/utils/concat_utils.py | 0 {rook => src/rook}/utils/decadal_fixes.py | 0 {rook => src/rook}/utils/input_utils.py | 0 {rook => src/rook}/utils/metalink_utils.py | 0 {rook => src/rook}/utils/regrid_utils.py | 0 {rook => src/rook}/utils/response_utils.py | 0 {rook => src/rook}/utils/subset_utils.py | 0 .../rook}/utils/weighted_average_utils.py | 0 {rook => src/rook}/workflow.py | 0 {rook => src/rook}/wsgi.py | 4 +- tests/common.py | 12 +- tox.ini | 31 ++- 91 files changed, 523 insertions(+), 219 deletions(-) create mode 100644 .yamllint.yaml rename CHANGES.rst => CHANGELOG.rst (100%) create mode 100644 CODE_OF_CONDUCT.rst delete mode 100644 MANIFEST.in create mode 100644 docs/source/changelog.rst delete mode 100644 docs/source/changes.rst create mode 100644 environment-dev.yml create mode 100644 pyproject.toml delete mode 100644 rook/__init__.py delete mode 100644 setup.py create mode 100644 src/rook/__init__.py rename {rook => src/rook}/__version__.py (80%) rename {rook => src/rook}/catalog/__init__.py (100%) rename {rook => src/rook}/catalog/db.py (100%) rename {rook => src/rook}/cli.py (80%) rename {rook => src/rook}/dashboard/__init__.py (100%) rename {rook => src/rook}/dashboard/base.py (100%) rename {rook => src/rook}/dashboard/dashboard.py (100%) rename {rook => src/rook}/dashboard/models.py (100%) rename {rook => src/rook}/dashboard/plots/__init__.py (100%) rename {rook => src/rook}/dashboard/plots/activity.py (100%) rename {rook => src/rook}/dashboard/plots/activity2.py (100%) rename {rook => src/rook}/dashboard/plots/base.py (100%) rename {rook => src/rook}/dashboard/plots/concurrency.py (100%) rename {rook => src/rook}/dashboard/plots/day.py (100%) rename {rook => src/rook}/dashboard/plots/downloads.py (100%) rename {rook => src/rook}/dashboard/plots/duration.py (100%) rename {rook => src/rook}/dashboard/plots/hour.py (100%) rename {rook => src/rook}/dashboard/plots/pulse.py (100%) rename {rook => src/rook}/dashboard/plots/transfer.py (100%) rename {rook => src/rook}/dashboard/tables/__init__.py (100%) rename {rook => src/rook}/dashboard/tables/base.py (100%) rename {rook => src/rook}/dashboard/tables/messages.py (100%) rename {rook => src/rook}/dashboard/tables/overview.py (100%) rename {rook => src/rook}/dashboard/templates/base.html (100%) rename {rook => src/rook}/dashboard/templates/dashboard.html (100%) rename {rook => src/rook}/dashboard/templates/navbar.html (100%) rename {rook => src/rook}/default.cfg (100%) rename {rook => src/rook}/director/__init__.py (100%) rename {rook => src/rook}/director/alignment.py (100%) rename {rook => src/rook}/director/director.py (100%) rename {rook => src/rook}/etc/roocs.ini (100%) rename {rook => src/rook}/exceptions.py (100%) rename {rook => src/rook}/operator.py (100%) rename {rook => src/rook}/processes/__init__.py (95%) rename {rook => src/rook}/processes/wps_average_dim.py (100%) rename {rook => src/rook}/processes/wps_average_shape.py (100%) rename {rook => src/rook}/processes/wps_average_time.py (100%) rename {rook => src/rook}/processes/wps_average_weighted.py (100%) rename {rook => src/rook}/processes/wps_concat.py (100%) rename {rook => src/rook}/processes/wps_dashboard.py (100%) rename {rook => src/rook}/processes/wps_orchestrate.py (100%) rename {rook => src/rook}/processes/wps_regrid.py (100%) rename {rook => src/rook}/processes/wps_subset.py (100%) rename {rook => src/rook}/processes/wps_usage.py (100%) rename {rook => src/rook}/provenance.py (100%) create mode 100644 src/rook/rook.py rename {rook => src/rook}/templates/pywps.cfg (81%) rename {rook => src/rook}/usage/__init__.py (100%) rename {rook => src/rook}/usage/base.py (100%) rename {rook => src/rook}/usage/combine.py (100%) rename {rook => src/rook}/usage/downloads.py (100%) rename {rook => src/rook}/usage/wpsusage.py (100%) rename {rook => src/rook}/utils/__init__.py (100%) rename {rook => src/rook}/utils/apply_fixes.py (100%) rename {rook => src/rook}/utils/atlas_fixes.py (100%) rename {rook => src/rook}/utils/average_utils.py (100%) rename {rook => src/rook}/utils/concat_utils.py (100%) rename {rook => src/rook}/utils/decadal_fixes.py (100%) rename {rook => src/rook}/utils/input_utils.py (100%) rename {rook => src/rook}/utils/metalink_utils.py (100%) rename {rook => src/rook}/utils/regrid_utils.py (100%) rename {rook => src/rook}/utils/response_utils.py (100%) rename {rook => src/rook}/utils/subset_utils.py (100%) rename {rook => src/rook}/utils/weighted_average_utils.py (100%) rename {rook => src/rook}/workflow.py (100%) rename {rook => src/rook}/wsgi.py (74%) diff --git a/.codacy.yml b/.codacy.yml index 9700d78b..34195902 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -1,8 +1,8 @@ --- engines: - pylint: - enabled: true - python_version: 3 + pylint: + enabled: true + python_version: 3 exclude_paths: - 'tests/**' - 'docs/source/conf.py' diff --git a/.cruft.json b/.cruft.json index 8a7dc3d2..e45612ba 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/bird-house/cookiecutter-birdhouse.git", - "commit": "231d17eca6986f606d280cc25262d0153efd92c4", + "commit": "d25191ecc41c091d9b4a392f0ac89d70ff27db55", "context": { "cookiecutter": { "full_name": "Carsten Ehbrecht", @@ -20,6 +20,7 @@ "_copy_without_render": [ "{{cookiecutter.project_slug}}/templates/*.cfg" ], + "__gh_slug": "roocs/rook", "_template": "https://github.com/bird-house/cookiecutter-birdhouse.git" } }, diff --git a/.gitignore b/.gitignore index c420ecab..f0427f5b 100644 --- a/.gitignore +++ b/.gitignore @@ -122,6 +122,9 @@ target/ # pyenv .python-version +# Dask worker cache +dask-worker-space/ + # celery beat schedule file celerybeat-schedule diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4b438cf4..2be5745a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ default_language_version: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: trailing-whitespace exclude: setup.cfg @@ -12,7 +12,7 @@ repos: - id: check-yaml - id: debug-statements - repo: https://github.com/ambv/black - rev: 24.8.0 + rev: 24.10.0 hooks: - id: black args: ["--target-version", "py39"] diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 00000000..ce25c395 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,39 @@ +--- + +rules: + + brackets: + forbid: false + min-spaces-inside: 1 + max-spaces-inside: 1 + + commas: + min-spaces-after: 1 + + document-start: disable + + float-values: + require-numeral-before-decimal: true + + hyphens: + max-spaces-after: 1 + + indentation: + indent-sequences: whatever + spaces: consistent + + key-duplicates: + forbid-duplicated-merge-keys: true + + line-length: + allow-non-breakable-words: true + allow-non-breakable-inline-mappings: true + max: 180 + level: warning + + new-lines: + type: unix + + trailing-spaces: {} + + truthy: disable diff --git a/CHANGES.rst b/CHANGELOG.rst similarity index 100% rename from CHANGES.rst rename to CHANGELOG.rst diff --git a/CODE_OF_CONDUCT.rst b/CODE_OF_CONDUCT.rst new file mode 100644 index 00000000..d11c563e --- /dev/null +++ b/CODE_OF_CONDUCT.rst @@ -0,0 +1,84 @@ +==================================== +Contributor Covenant Code of Conduct +==================================== + +Our Pledge +---------- + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to make participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +Our Standards +------------- + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +Our Responsibilities +-------------------- + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +Scope +----- + +This Code of Conduct applies within all project spaces, and it also applies when +an individual is representing the project or its community in public spaces. +Examples of representing a project or community include using an official +project e-mail address, posting via an official social media account, or acting +as an appointed representative at an online or offline event. Representation of +a project may be further defined and clarified by project maintainers. + +Enforcement +----------- + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at [INSERT EMAIL ADDRESS]. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +Attribution +----------- + +This Code of Conduct is adapted from the `Contributor Covenant`_, version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq + +.. _`Contributor Covenant`: https://www.contributor-covenant.org diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 3cd4084a..80575855 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -51,8 +51,7 @@ 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 :) +* Remember that this is a volunteer-driven project, and that contributions are welcome :) Get Started! ------------ @@ -79,9 +78,10 @@ Ready to contribute? Here's how to set up `rook` for local development. 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 + $ make lint + $ make test + Or + $ make test-all To get flake8 and tox, just pip install them into your virtualenv. @@ -100,7 +100,7 @@ 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. +3. The pull request should work for all supported Python versions. Check https://github.com/roocs/rook/actions and make sure that the tests pass for all supported Python versions. Tips ---- @@ -117,6 +117,14 @@ 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 + $ bump-my-version bump patch # possible: major / minor / patch $ git push $ git push --tags + +Code of Conduct +--------------- + +Please note that this project is released with a `Contributor Code of Conduct`_. +By participating in this project you agree to abide by its terms. + +.. _`Contributor Code of Conduct`: CODE_OF_CONDUCT.rst diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 1dadbc44..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,7 +0,0 @@ -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 cf01be63..8c1aa807 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,7 @@ clean-docs: ## remove documentation artifacts lint/flake8: ## check style with flake8 @echo "Running flake8 code style checks ..." - @bash -c 'flake8 rook tests' + @bash -c 'ruff check rook tests' lint: lint/flake8 ## check style @@ -128,7 +128,6 @@ 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" - test-notebooks: notebook-sanitizer ## run notebook-based tests @echo "Running notebook-based tests" @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" @@ -156,11 +155,7 @@ 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 +refresh-notebooks: notebook-sanitizer ## 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)' @@ -168,10 +163,9 @@ refresh-notebooks: ## refreshing all notebook outputs under docs/source/notebook dist: clean ## build source and wheel package @echo "Building source and wheel package ..." - @python setup.py sdist - @python setup.py bdist_wheel + @python -m build --sdist @bash -c 'ls -l dist/' release: dist ## upload source and wheel packages @echo "Uploading source and wheel packages ..." - @bash -c 'twine upload dist/*' + @python -m flit publish dist/* diff --git a/README.rst b/README.rst index 69e44e99..9d0da464 100644 --- a/README.rst +++ b/README.rst @@ -40,7 +40,7 @@ Contributing You can find information about contributing in our `Developer Guide`_. -Please use bump2version_ to release a new version. +Please use bump-my-version_ to release a new version. Tests ----- @@ -61,9 +61,9 @@ Credits This package was created with Cookiecutter_ and the `bird-house/cookiecutter-birdhouse`_ project template. -.. _Cookiecutter: https://github.com/audreyr/cookiecutter +.. _Cookiecutter: https://github.com/cookiecutter/cookiecutter .. _`bird-house/cookiecutter-birdhouse`: https://github.com/bird-house/cookiecutter-birdhouse .. _`Developer Guide`: https://rook-wps.readthedocs.io/en/latest/dev_guide.html -.. _bump2version: https://rook.readthedocs.io/en/latest/dev_guide.html#bump-a-new-version +.. _bump-my-version: 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/docs/source/changelog.rst b/docs/source/changelog.rst new file mode 100644 index 00000000..09929fe4 --- /dev/null +++ b/docs/source/changelog.rst @@ -0,0 +1 @@ +.. include:: ../../CHANGELOG.rst diff --git a/docs/source/changes.rst b/docs/source/changes.rst deleted file mode 100644 index d76c92b6..00000000 --- a/docs/source/changes.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../../CHANGES.rst diff --git a/docs/source/conf.py b/docs/source/conf.py index 921c0653..f7a6cee6 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -63,7 +63,6 @@ "hdf5", "matplotlib", "netCDF4", - "networkx", "numba", "numpy", "ocgis", diff --git a/docs/source/index.rst b/docs/source/index.rst index 31913448..d1ce0b53 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -11,7 +11,7 @@ processes authors prov - changes + changelog Indices and tables ================== diff --git a/environment-dev.yml b/environment-dev.yml new file mode 100644 index 00000000..44f55ab1 --- /dev/null +++ b/environment-dev.yml @@ -0,0 +1,22 @@ +name: rook-dev +channels: + - conda-forge + - defaults +dependencies: + - python >=3.9,<3.13 + # development + - bump-my-version >=0.26.0 + - coverage >=7.5.0 + - cruft >=2.15.0 + - flit >=3.9.0,<4.0 + - nbsphinx >=0.9.5 + - nbval >=0.10.0 + - ruff >=0.5.7 + - sphinx >=7.0.0 + - tox >=4.18.0 + - watchdog >=4.0.0 + # tests + - pytest >=8.0.0 + - pytest-cov >=5.0.0 + - pytest-timeout >=2.3.1 + - beautifulsoup4 >4.12.3 diff --git a/environment-docs.yml b/environment-docs.yml index d8364982..f14cb63e 100644 --- a/environment-docs.yml +++ b/environment-docs.yml @@ -2,9 +2,10 @@ name: rook channels: - conda-forge + - defaults dependencies: - - python >=3.9,<3.10 - - pywps >=4.5.2,<4.7 + - python >=3.9,<3.12 + - pywps >=4.6 - sphinx >=7.0.0 - nbsphinx >=0.9.5 - - ipython >=8.13.0 + - ipython >=8.5.0 diff --git a/environment.yml b/environment.yml index b1f02635..6143fed9 100644 --- a/environment.yml +++ b/environment.yml @@ -1,12 +1,13 @@ name: rook channels: - conda-forge + - defaults dependencies: - python >=3.9,<3.12 - - pywps >=4.5.2,<4.7 - - jinja2 - - click - - psutil + - pywps >=4.6 + - jinja2 >=3.1.4 + - click >=8.1.7 + - psutil >=6.0.0 - requests - cftime >=1.2.1 - xarray >=0.21,<2023.3.0 # https://github.com/pydata/xarray/issues/7794 @@ -31,7 +32,3 @@ dependencies: - aiohttp # dashboard - bokeh - # tests - - pytest - - pytest-timeout - - beautifulsoup4 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..e6e5ac9f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,224 @@ +[build-system] +requires = ["flit_core >=3.9,<4"] +build-backend = "flit_core.buildapi" + +[project] +name = "rook" +authors = [ + {name = "Carsten Ehbrecht", email = "ehbrecht@dkrz.de"} +] +maintainers = [ + {name = "Carsten Ehbrecht", email = "ehbrecht@dkrz.de"} +] +readme = {file = "README.rst", content-type = "text/x-rst"} +requires-python = ">=3.9.0" +keywords = ["wps", "pywps", "birdhouse", "rook"] +license = {file = "LICENSE"} +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: Apache Software License", + "Operating System :: MacOS :: MacOS X", + "Operating System :: POSIX", + "Programming Language :: Python", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + # "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Atmospheric Science" +] +dynamic = ["description", "version"] +dependencies = [ + "click >=8.1.7", + "jinja2 >=3.1.4", + "psutil >=6.0.0", + "pywps >=4.5.1,<4.6" +] + +[project.optional-dependencies] +dev = [ + "pip >=24.2.0", + "bump-my-version >=0.26.0", + "coverage >=7.5.0", + "cruft >=2.15.0", + "flit >=3.9.0,<4.0", + "nbsphinx >=0.9.5", + "nbval >=0.10.0", + "pytest >=8.0.0", + "pytest-cov >=5.0.0", + "ruff >=0.5.7", + "sphinx >=7.0.0", + "tox >=4.18.0", + "watchdog >=4.0.0" +] + +[project.scripts] +rook = "rook.cli:cli" + +[project.urls] +"Issue tracker" = "https://github.com/roocs/rook/issues" +"Changelog" = "https://github.com/roocs/rook/blob/master/changelog.rst" +"Homepage" = "https://github.com/roocs/rook" + +[tool] + +[tool.bumpversion] +current_version = "0.13.1" +commit = true +commit_args = "--no-verify" +tag = true +tag_name = "v{new_version}" +allow_dirty = true + +[[tool.bumpversion.files]] +filename = "src/rook/__version__.py" +search = "__version__ = \"{current_version}\"" +replace = "__version__ = \"{new_version}\"" + +[[tool.bumpversion.files]] +filenam = "Dockerfile" +search = "Version=\"{current_version}\"" +replace = "Version=\"{new_version}\"" + +[[tool.bumpversion.files]] +filename = ".cruft.json" +search = "\"version\": \"{current_version}\"" +replace = "\"version\": \"{new_version}\"" + +[tool.coverage.paths] +source = ["src/rook/", "*/site-packages/rook/"] + +[tool.coverage.run] +omit = ["tests/*.py"] +relative_files = true +source = ["rook"] + +[tool.flit.sdist] +include = [ + ".zenodo.json", + "AUTHORS.rst", + "CHANGELOG.rst", + "CONTRIBUTING.rst", + "LICENSE", + "Makefile", + "README.rst", + "environment.yml", + "environment-dev.yml", + "environment-docs.yml", + "docs/_static/_images/*.gif", + "docs/_static/_images/*.jpg", + "docs/_static/_images/*.png", + "docs/_static/_images/*.rst", + "docs/Makefile", + "docs/conf.py", + "docs/make.bat", + "src/rook", + "tests/*.py", + "tox.ini" +] +exclude = [ + "*.py[co]", + "__pycache__", + ".codacy.yml", + ".dockerignore", + ".editorconfig", + ".gitignore", + ".pre-commit-config.yaml", + ".readthedocs.yml", + ".yamllint.yaml", + "Dockerfile", + "docker-compose.yml", + "docs/_*", + "docs/apidoc/modules.rst", + "docs/apidoc/rook*.rst" +] + +[tool.mypy] +files = "." +# Use strict defaults +strict = true +warn_unreachable = true +warn_no_return = true + +[[tool.mypy.overrides]] +# Don't require test functions to include types +module = "tests.*" +allow_untyped_defs = true +disable_error_code = "attr-defined" + +[tool.pytest.ini_options] +addopts = [ + "--color=yes", + "--cov=rook", + "--cov-report=term-missing", + "--ignore=setup.py", + "--strict-markers", + "--tb=native" +] +python_files = ["test_*.py"] +markers = [ + "online: mark test to need internet connection", + "slow: mark test to be slow", + "smoke: mark test as a smoke/sanity test" +] + +[tool.ruff] +src = ["rook"] +line-length = 150 +exclude = [ + ".eggs", + ".git", + "build", + "docs" +] + +[tool.ruff.format] +line-ending = "auto" + +[tool.ruff.lint] +extend-select = [ + "RUF022" # unsorted-dunder-all +] +ignore = [ + "COM", # commas + "D205", # blank-line-after-summary + "D400", # ends-in-period + "D401" # non-imperative-mood +] +preview = true +select = [ + "BLE", # blind-except + "C90", # mccabe-complexity + "D", # docstrings + "E", # pycodestyle errors + "FLY002", # static-join-to-fstring + "G", # logging-format + "N", # naming conventions + "PERF", # iterator performance + "PTH", # pathlib + "RUF010", # explicit-f-string-type-conversion + "RUF013", # implicit-optional + "S", # bandit + "UP", # python version conventions + "W" # pycodestyle warnings +] + +[tool.ruff.lint.flake8-bandit] +check-typed-exception = true + +[tool.ruff.lint.mccabe] +max-complexity = 15 + +[tool.ruff.lint.per-file-ignores] +"docs/**" = ["E402"] +"src/rook/**/__init__.py" = ["F401", "F403"] +"tests/**" = ["D100", "D101", "D102", "D103", "S101"] + +[tool.ruff.lint.pycodestyle] +max-doc-length = 180 + +[tool.ruff.lint.pydocstyle] +convention = "numpy" diff --git a/rook/__init__.py b/rook/__init__.py deleted file mode 100644 index 02021982..00000000 --- a/rook/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -"""Top-level package for rook.""" - -from .__version__ import __author__, __email__, __version__ # noqa: F401 - -from roocs_utils.config import get_config - - -# Workaround for roocs_utils to not re-import rook -class Package: - __file__ = __file__ # noqa - - -package = Package() -CONFIG = get_config(package) - -from .wsgi import application # noqa: F401 diff --git a/setup.cfg b/setup.cfg index 1b6d82b6..35cb38c4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,44 +1,3 @@ -[bumpversion] -current_version = 0.13.1 -commit = True -tag = True - -[metadata] -description-file = README.rst - -[bumpversion:file:rook/__version__.py] -search = __version__ = "{current_version}" -replace = __version__ = "{new_version}" - -[bumpversion:file:docs/source/conf.py] -parse = version|release = {current_version} -replace = {new_version} - -[bumpversion:file:Dockerfile] -search = Version="{current_version}" -replace = Version="{new_version}" - -[bumpversion:file:.cruft.json] -search = "version": "{current_version}", -replace = "version": "{new_version}", - -[bdist_wheel] -universal = 1 - -[tool:pytest] -addopts = - --color=yes - --cov=rook - --cov-report=term-missing - --ignore=setup.py - --strict-markers - --tb=native -python_files = test_*.py -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 = @@ -54,7 +13,3 @@ ignore = E402 W503 E203 - -[doc8] -ignore-path = docs/build,docs/source/_templates,docs/source/_static -max-line-length = 120 diff --git a/setup.py b/setup.py deleted file mode 100644 index f0d39816..00000000 --- a/setup.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python - -"""The setup script.""" - -import os - -from setuptools import find_packages, setup - -here = os.path.abspath(os.path.dirname(__file__)) -README = open(os.path.join(here, "README.rst")).read() -CHANGES = open(os.path.join(here, "CHANGES.rst")).read() -REQUIRES_PYTHON = ">=3.9.0" - -about = {} -with open(os.path.join(here, "rook", "__version__.py")) as f: - exec(f.read(), about) - -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", - "Intended Audience :: Developers", - "Intended Audience :: Science/Research", - "Operating System :: MacOS :: MacOS X", - "Operating System :: POSIX", - "Programming Language :: Python", - "Natural Language :: English", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - # "Programming Language :: Python :: 3.12", - "Topic :: Scientific/Engineering :: Atmospheric Science", - "License :: OSI Approved :: Apache Software License", -] - -setup( - name="roocs-rook", - version=about["__version__"], - description="A WPS service for roocs.", - 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", - python_requires=REQUIRES_PYTHON, - classifiers=classifiers, - license="Apache Software License 2.0", - zip_safe=False, - keywords="wps pywps birdhouse rook", - packages=find_packages(), - include_package_data=True, - install_requires=requirements, - extras_require={ - "dev": dev_reqs, # pip install ".[dev]" - }, - entry_points={ - "console_scripts": [ - "rook=rook.cli:cli", - ] - }, -) diff --git a/src/rook/__init__.py b/src/rook/__init__.py new file mode 100644 index 00000000..da2ddd0e --- /dev/null +++ b/src/rook/__init__.py @@ -0,0 +1,34 @@ +"""A WPS service for roocs.""" + +################################################################################### +# Apache Software License 2.0 +# +# Copyright (c) 2024, Carsten Ehbrecht, Eleanor Smith, Ag Stephens +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################### + +from .__version__ import __author__, __email__, __version__ # noqa: F401 + +from roocs_utils.config import get_config + + +# Workaround for roocs_utils to not re-import rook +class Package: + __file__ = __file__ # noqa + + +package = Package() +CONFIG = get_config(package) + +from .wsgi import application # noqa: F401 diff --git a/rook/__version__.py b/src/rook/__version__.py similarity index 80% rename from rook/__version__.py rename to src/rook/__version__.py index c977c495..e58b435b 100644 --- a/rook/__version__.py +++ b/src/rook/__version__.py @@ -1,7 +1,9 @@ +"""rook version information.""" + # This information is located in its own file so that it can be loaded # 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/catalog/__init__.py b/src/rook/catalog/__init__.py similarity index 100% rename from rook/catalog/__init__.py rename to src/rook/catalog/__init__.py diff --git a/rook/catalog/db.py b/src/rook/catalog/db.py similarity index 100% rename from rook/catalog/db.py rename to src/rook/catalog/db.py diff --git a/rook/cli.py b/src/rook/cli.py similarity index 80% rename from rook/cli.py rename to src/rook/cli.py index 9498c6cd..77905857 100644 --- a/rook/cli.py +++ b/src/rook/cli.py @@ -1,37 +1,43 @@ +"""Demo WPS service for testing and debugging.""" + ########################################################### -# Demo WPS service for testing and debugging. -# # See the werkzeug documentation on how to use the debugger: # http://werkzeug.pocoo.org/docs/0.12/debug/ ########################################################### import os -from urllib.parse import urlparse +from pathlib import Path -import click import psutil +import click from jinja2 import Environment, PackageLoader from pywps import configuration from . import wsgi +from urllib.parse import urlparse -PID_FILE = os.path.abspath(os.path.join(os.path.curdir, "pywps.pid")) +PID_FILE = Path(__file__).parent.joinpath("pywps.pid").resolve() CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"]) -template_env = Environment(loader=PackageLoader("rook", "templates"), autoescape=True) +template_env = Environment( + loader=PackageLoader("rook", "templates"), + autoescape=True, +) def write_user_config(**kwargs): + """Write a custom configuration file.""" config_templ = template_env.get_template("pywps.cfg") rendered_config = config_templ.render(**kwargs) - config_file = os.path.abspath(os.path.join(os.path.curdir, ".custom.cfg")) - with open(config_file, "w") as fp: + config_file = Path(__file__).parent.joinpath(".custom.cfg").resolve() + with config_file.open("w") as fp: fp.write(rendered_config) return config_file def get_host(): + """Gather host information.""" url = configuration.get_config_value("server", "url") url = url or "http://localhost:5000/wps" @@ -48,11 +54,10 @@ def get_host(): def run_process_action(action=None): - """Run an action with psutil on current process - and return a status message.""" + """Run an action with psutil on current process and return a status message.""" action = action or "status" try: - with open(PID_FILE) as fp: + with PID_FILE.open() as fp: pid = int(fp.read()) p = psutil.Process(pid) if action == "stop": @@ -61,11 +66,9 @@ def run_process_action(action=None): else: from psutil import _pprint_secs - msg = "pid={}, status={}, created={}".format( - p.pid, p.status(), _pprint_secs(p.create_time()) - ) + msg = f"pid={p.pid}, status={p.status()}, created={_pprint_secs(p.create_time())}" if action == "stop": - os.remove(PID_FILE) + PID_FILE.unlink() except OSError: msg = 'No PID file found. Service not running? Try "netstat -nlp | grep :5000".' except psutil.NoSuchProcess as e: @@ -97,24 +100,25 @@ def _run(application, bind_host=None, daemon=False): @click.group(context_settings=CONTEXT_SETTINGS) @click.version_option() def cli(): - """Command line to start/stop a PyWPS service. + """ + Command line to start/stop a PyWPS service. Do not use this service in a production environment. It's intended to be running in a test environment only! - For more documentation, visit http://pywps.org/doc + For more documentation, visit https://pywps.org/doc """ pass @cli.command() def status(): - """Show status of PyWPS service""" + """Show status of PyWPS service.""" run_process_action(action="status") @cli.command() def stop(): - """Stop PyWPS service""" + """Stop PyWPS service.""" run_process_action(action="stop") @@ -173,6 +177,10 @@ 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, @@ -185,15 +193,18 @@ def start( log_level, log_file, database, + outputurl, + outputpath, ): - """Start PyWPS service. + """ + Start PyWPS service. + This service is by default available at http://localhost:5000/wps """ - if os.path.exists(PID_FILE): + if PID_FILE.exists(): click.echo(f'PID file exists: "{PID_FILE}". Service still running?') os._exit(0) - cfgfiles = [] - cfgfiles.append( + cfgfiles = [ write_user_config( wps_hostname=hostname, wps_port=port, @@ -203,8 +214,10 @@ def start( wps_log_level=log_level, wps_log_file=log_file, wps_database=database, + wps_outputurl=outputurl, + wps_outputpath=outputpath, ) - ) + ] if config: cfgfiles.append(config) app = wsgi.create_app(cfgfiles) @@ -219,7 +232,7 @@ def start( pid = os.fork() if pid: click.echo(f"forked process id: {pid}") - with open(PID_FILE, "w") as fp: + with PID_FILE.open("w") as fp: fp.write(f"{pid}") except OSError as e: raise Exception("%s [%d]" % (e.strerror, e.errno)) diff --git a/rook/dashboard/__init__.py b/src/rook/dashboard/__init__.py similarity index 100% rename from rook/dashboard/__init__.py rename to src/rook/dashboard/__init__.py diff --git a/rook/dashboard/base.py b/src/rook/dashboard/base.py similarity index 100% rename from rook/dashboard/base.py rename to src/rook/dashboard/base.py diff --git a/rook/dashboard/dashboard.py b/src/rook/dashboard/dashboard.py similarity index 100% rename from rook/dashboard/dashboard.py rename to src/rook/dashboard/dashboard.py diff --git a/rook/dashboard/models.py b/src/rook/dashboard/models.py similarity index 100% rename from rook/dashboard/models.py rename to src/rook/dashboard/models.py diff --git a/rook/dashboard/plots/__init__.py b/src/rook/dashboard/plots/__init__.py similarity index 100% rename from rook/dashboard/plots/__init__.py rename to src/rook/dashboard/plots/__init__.py diff --git a/rook/dashboard/plots/activity.py b/src/rook/dashboard/plots/activity.py similarity index 100% rename from rook/dashboard/plots/activity.py rename to src/rook/dashboard/plots/activity.py diff --git a/rook/dashboard/plots/activity2.py b/src/rook/dashboard/plots/activity2.py similarity index 100% rename from rook/dashboard/plots/activity2.py rename to src/rook/dashboard/plots/activity2.py diff --git a/rook/dashboard/plots/base.py b/src/rook/dashboard/plots/base.py similarity index 100% rename from rook/dashboard/plots/base.py rename to src/rook/dashboard/plots/base.py diff --git a/rook/dashboard/plots/concurrency.py b/src/rook/dashboard/plots/concurrency.py similarity index 100% rename from rook/dashboard/plots/concurrency.py rename to src/rook/dashboard/plots/concurrency.py diff --git a/rook/dashboard/plots/day.py b/src/rook/dashboard/plots/day.py similarity index 100% rename from rook/dashboard/plots/day.py rename to src/rook/dashboard/plots/day.py diff --git a/rook/dashboard/plots/downloads.py b/src/rook/dashboard/plots/downloads.py similarity index 100% rename from rook/dashboard/plots/downloads.py rename to src/rook/dashboard/plots/downloads.py diff --git a/rook/dashboard/plots/duration.py b/src/rook/dashboard/plots/duration.py similarity index 100% rename from rook/dashboard/plots/duration.py rename to src/rook/dashboard/plots/duration.py diff --git a/rook/dashboard/plots/hour.py b/src/rook/dashboard/plots/hour.py similarity index 100% rename from rook/dashboard/plots/hour.py rename to src/rook/dashboard/plots/hour.py diff --git a/rook/dashboard/plots/pulse.py b/src/rook/dashboard/plots/pulse.py similarity index 100% rename from rook/dashboard/plots/pulse.py rename to src/rook/dashboard/plots/pulse.py diff --git a/rook/dashboard/plots/transfer.py b/src/rook/dashboard/plots/transfer.py similarity index 100% rename from rook/dashboard/plots/transfer.py rename to src/rook/dashboard/plots/transfer.py diff --git a/rook/dashboard/tables/__init__.py b/src/rook/dashboard/tables/__init__.py similarity index 100% rename from rook/dashboard/tables/__init__.py rename to src/rook/dashboard/tables/__init__.py diff --git a/rook/dashboard/tables/base.py b/src/rook/dashboard/tables/base.py similarity index 100% rename from rook/dashboard/tables/base.py rename to src/rook/dashboard/tables/base.py diff --git a/rook/dashboard/tables/messages.py b/src/rook/dashboard/tables/messages.py similarity index 100% rename from rook/dashboard/tables/messages.py rename to src/rook/dashboard/tables/messages.py diff --git a/rook/dashboard/tables/overview.py b/src/rook/dashboard/tables/overview.py similarity index 100% rename from rook/dashboard/tables/overview.py rename to src/rook/dashboard/tables/overview.py diff --git a/rook/dashboard/templates/base.html b/src/rook/dashboard/templates/base.html similarity index 100% rename from rook/dashboard/templates/base.html rename to src/rook/dashboard/templates/base.html diff --git a/rook/dashboard/templates/dashboard.html b/src/rook/dashboard/templates/dashboard.html similarity index 100% rename from rook/dashboard/templates/dashboard.html rename to src/rook/dashboard/templates/dashboard.html diff --git a/rook/dashboard/templates/navbar.html b/src/rook/dashboard/templates/navbar.html similarity index 100% rename from rook/dashboard/templates/navbar.html rename to src/rook/dashboard/templates/navbar.html diff --git a/rook/default.cfg b/src/rook/default.cfg similarity index 100% rename from rook/default.cfg rename to src/rook/default.cfg diff --git a/rook/director/__init__.py b/src/rook/director/__init__.py similarity index 100% rename from rook/director/__init__.py rename to src/rook/director/__init__.py diff --git a/rook/director/alignment.py b/src/rook/director/alignment.py similarity index 100% rename from rook/director/alignment.py rename to src/rook/director/alignment.py diff --git a/rook/director/director.py b/src/rook/director/director.py similarity index 100% rename from rook/director/director.py rename to src/rook/director/director.py diff --git a/rook/etc/roocs.ini b/src/rook/etc/roocs.ini similarity index 100% rename from rook/etc/roocs.ini rename to src/rook/etc/roocs.ini diff --git a/rook/exceptions.py b/src/rook/exceptions.py similarity index 100% rename from rook/exceptions.py rename to src/rook/exceptions.py diff --git a/rook/operator.py b/src/rook/operator.py similarity index 100% rename from rook/operator.py rename to src/rook/operator.py diff --git a/rook/processes/__init__.py b/src/rook/processes/__init__.py similarity index 95% rename from rook/processes/__init__.py rename to src/rook/processes/__init__.py index c60ad589..6a07f3ce 100644 --- a/rook/processes/__init__.py +++ b/src/rook/processes/__init__.py @@ -1,3 +1,5 @@ +"""Processes module.""" + from .wps_usage import Usage from .wps_dashboard import DashboardProcess from .wps_average_time import AverageByTime @@ -7,6 +9,8 @@ from .wps_orchestrate import Orchestrate from .wps_subset import Subset from .wps_concat import Concat + + from .wps_regrid import Regrid processes = [ diff --git a/rook/processes/wps_average_dim.py b/src/rook/processes/wps_average_dim.py similarity index 100% rename from rook/processes/wps_average_dim.py rename to src/rook/processes/wps_average_dim.py diff --git a/rook/processes/wps_average_shape.py b/src/rook/processes/wps_average_shape.py similarity index 100% rename from rook/processes/wps_average_shape.py rename to src/rook/processes/wps_average_shape.py diff --git a/rook/processes/wps_average_time.py b/src/rook/processes/wps_average_time.py similarity index 100% rename from rook/processes/wps_average_time.py rename to src/rook/processes/wps_average_time.py diff --git a/rook/processes/wps_average_weighted.py b/src/rook/processes/wps_average_weighted.py similarity index 100% rename from rook/processes/wps_average_weighted.py rename to src/rook/processes/wps_average_weighted.py diff --git a/rook/processes/wps_concat.py b/src/rook/processes/wps_concat.py similarity index 100% rename from rook/processes/wps_concat.py rename to src/rook/processes/wps_concat.py diff --git a/rook/processes/wps_dashboard.py b/src/rook/processes/wps_dashboard.py similarity index 100% rename from rook/processes/wps_dashboard.py rename to src/rook/processes/wps_dashboard.py diff --git a/rook/processes/wps_orchestrate.py b/src/rook/processes/wps_orchestrate.py similarity index 100% rename from rook/processes/wps_orchestrate.py rename to src/rook/processes/wps_orchestrate.py diff --git a/rook/processes/wps_regrid.py b/src/rook/processes/wps_regrid.py similarity index 100% rename from rook/processes/wps_regrid.py rename to src/rook/processes/wps_regrid.py diff --git a/rook/processes/wps_subset.py b/src/rook/processes/wps_subset.py similarity index 100% rename from rook/processes/wps_subset.py rename to src/rook/processes/wps_subset.py diff --git a/rook/processes/wps_usage.py b/src/rook/processes/wps_usage.py similarity index 100% rename from rook/processes/wps_usage.py rename to src/rook/processes/wps_usage.py diff --git a/rook/provenance.py b/src/rook/provenance.py similarity index 100% rename from rook/provenance.py rename to src/rook/provenance.py diff --git a/src/rook/rook.py b/src/rook/rook.py new file mode 100644 index 00000000..dd0b80ed --- /dev/null +++ b/src/rook/rook.py @@ -0,0 +1 @@ +"""Main module.""" diff --git a/rook/templates/pywps.cfg b/src/rook/templates/pywps.cfg similarity index 81% rename from rook/templates/pywps.cfg rename to src/rook/templates/pywps.cfg index 20951f8a..c4ed66ce 100644 --- a/rook/templates/pywps.cfg +++ b/src/rook/templates/pywps.cfg @@ -21,7 +21,7 @@ workdir={{ wps_workdir }} {% endif %} [logging] -level = {{ wps_log_level|default('INFO') }} -file = {{ wps_log_file|default('pywps.log') }} -database = {{ wps_database|default('sqlite:///pywps-logs.sqlite') }} +level = INFO +file = pywps.log +database = sqlite:///pywps-logs.sqlite format = %(asctime)s] [%(levelname)s] line=%(lineno)s module=%(module)s %(message)s diff --git a/rook/usage/__init__.py b/src/rook/usage/__init__.py similarity index 100% rename from rook/usage/__init__.py rename to src/rook/usage/__init__.py diff --git a/rook/usage/base.py b/src/rook/usage/base.py similarity index 100% rename from rook/usage/base.py rename to src/rook/usage/base.py diff --git a/rook/usage/combine.py b/src/rook/usage/combine.py similarity index 100% rename from rook/usage/combine.py rename to src/rook/usage/combine.py diff --git a/rook/usage/downloads.py b/src/rook/usage/downloads.py similarity index 100% rename from rook/usage/downloads.py rename to src/rook/usage/downloads.py diff --git a/rook/usage/wpsusage.py b/src/rook/usage/wpsusage.py similarity index 100% rename from rook/usage/wpsusage.py rename to src/rook/usage/wpsusage.py diff --git a/rook/utils/__init__.py b/src/rook/utils/__init__.py similarity index 100% rename from rook/utils/__init__.py rename to src/rook/utils/__init__.py diff --git a/rook/utils/apply_fixes.py b/src/rook/utils/apply_fixes.py similarity index 100% rename from rook/utils/apply_fixes.py rename to src/rook/utils/apply_fixes.py diff --git a/rook/utils/atlas_fixes.py b/src/rook/utils/atlas_fixes.py similarity index 100% rename from rook/utils/atlas_fixes.py rename to src/rook/utils/atlas_fixes.py diff --git a/rook/utils/average_utils.py b/src/rook/utils/average_utils.py similarity index 100% rename from rook/utils/average_utils.py rename to src/rook/utils/average_utils.py diff --git a/rook/utils/concat_utils.py b/src/rook/utils/concat_utils.py similarity index 100% rename from rook/utils/concat_utils.py rename to src/rook/utils/concat_utils.py diff --git a/rook/utils/decadal_fixes.py b/src/rook/utils/decadal_fixes.py similarity index 100% rename from rook/utils/decadal_fixes.py rename to src/rook/utils/decadal_fixes.py diff --git a/rook/utils/input_utils.py b/src/rook/utils/input_utils.py similarity index 100% rename from rook/utils/input_utils.py rename to src/rook/utils/input_utils.py diff --git a/rook/utils/metalink_utils.py b/src/rook/utils/metalink_utils.py similarity index 100% rename from rook/utils/metalink_utils.py rename to src/rook/utils/metalink_utils.py diff --git a/rook/utils/regrid_utils.py b/src/rook/utils/regrid_utils.py similarity index 100% rename from rook/utils/regrid_utils.py rename to src/rook/utils/regrid_utils.py diff --git a/rook/utils/response_utils.py b/src/rook/utils/response_utils.py similarity index 100% rename from rook/utils/response_utils.py rename to src/rook/utils/response_utils.py diff --git a/rook/utils/subset_utils.py b/src/rook/utils/subset_utils.py similarity index 100% rename from rook/utils/subset_utils.py rename to src/rook/utils/subset_utils.py diff --git a/rook/utils/weighted_average_utils.py b/src/rook/utils/weighted_average_utils.py similarity index 100% rename from rook/utils/weighted_average_utils.py rename to src/rook/utils/weighted_average_utils.py diff --git a/rook/workflow.py b/src/rook/workflow.py similarity index 100% rename from rook/workflow.py rename to src/rook/workflow.py diff --git a/rook/wsgi.py b/src/rook/wsgi.py similarity index 74% rename from rook/wsgi.py rename to src/rook/wsgi.py index 12677601..0464b071 100644 --- a/rook/wsgi.py +++ b/src/rook/wsgi.py @@ -1,4 +1,5 @@ import os +from pathlib import Path from pywps.app.Service import Service @@ -6,7 +7,8 @@ def create_app(cfgfiles=None): - config_files = [os.path.join(os.path.dirname(__file__), "default.cfg")] + """Create PyWPS application.""" + config_files = [Path(__file__).parent.joinpath("default.cfg")] if cfgfiles: config_files.extend(cfgfiles) if "PYWPS_CFG" in os.environ: diff --git a/tests/common.py b/tests/common.py index 36bb4c2f..f6a4b0bd 100644 --- a/tests/common.py +++ b/tests/common.py @@ -66,7 +66,7 @@ class WpsTestClient(WpsClient): def get(self, *args, **kwargs): query = "?" for key, value in kwargs.items(): - query += "{}={}&".format(key, value) + query += f"{key}={value}&" return super().get(query) @@ -75,8 +75,8 @@ def client_for(service): def get_output(doc): - """Copied from pywps/tests/test_execute.py. - TODO: make this helper method public in pywps.""" + """Copied from pywps/tests/test_execute.py.""" + # TODO: make this helper method public in pywps. output = {} for output_el in xpath_ns( doc, "/wps:ExecuteResponse" "/wps:ProcessOutputs/wps:Output" @@ -84,15 +84,15 @@ def get_output(doc): [identifier_el] = xpath_ns(output_el, "./ows:Identifier") lit_el = xpath_ns(output_el, "./wps:Data/wps:LiteralData") - if lit_el != []: + if lit_el: output[identifier_el.text] = lit_el[0].text ref_el = xpath_ns(output_el, "./wps:Reference") - if ref_el != []: + if ref_el: output[identifier_el.text] = ref_el[0].attrib["href"] data_el = xpath_ns(output_el, "./wps:Data/wps:ComplexData") - if data_el != []: + if data_el: output[identifier_el.text] = data_el[0].text return output diff --git a/tox.ini b/tox.ini index 2cadf791..fbe3a836 100644 --- a/tox.ini +++ b/tox.ini @@ -1,25 +1,32 @@ [tox] -min_version = 4.0 +min_version = 4.18.0 envlist = - py{39,310,311}, - flake8 -requires = pip >= 23.1.0 + py{39,310,311,312}, + lint +requires = pip >= 24.2.0 opts = -v -[testenv:flake8] +[testenv:lint] basepython = python -deps = flake8 -commands = flake8 rook tests +skip_install = true +deps = + ruff >=0.5.7 +commands = + make lint +allowlist_externals = + make [testenv] setenv = PYTHONPATH = {toxinidir} +passenv = + GITHUB_* 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 +extras = dev +commands_pre = + python -m pip list + python -m pip check commands = - pytest --basetemp={envtmpdir} + python -m pytest --basetemp={envtmpdir} From cea3c9c3f27298485bb61efc7880fba0d8b39295 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 7 Oct 2024 16:17:25 -0400 Subject: [PATCH 20/21] stage ruff checks, add correct css file --- .github/workflows/main.yml | 2 +- Makefile | 3 ++- {rook => src/rook}/dashboard/templates/css/main.css | 0 3 files changed, 3 insertions(+), 2 deletions(-) rename {rook => src/rook}/dashboard/templates/css/main.css (100%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 22db2925..6422e384 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,7 +39,7 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: pip - - name: Install flake8 + - name: Install linting libraries run: | python -m pip install flake8 - name: Run Lint 📦 diff --git a/Makefile b/Makefile index 8c1aa807..5f5a0865 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,8 @@ clean-docs: ## remove documentation artifacts lint/flake8: ## check style with flake8 @echo "Running flake8 code style checks ..." - @bash -c 'ruff check rook tests' + @bash -c 'flake8 rook tests' + @#bash -c 'ruff check rook tests' lint: lint/flake8 ## check style diff --git a/rook/dashboard/templates/css/main.css b/src/rook/dashboard/templates/css/main.css similarity index 100% rename from rook/dashboard/templates/css/main.css rename to src/rook/dashboard/templates/css/main.css From 96e12640e1bdec118aa958334b888c19c5649959 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 7 Oct 2024 16:19:44 -0400 Subject: [PATCH 21/21] check src --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5f5a0865..9d6a08d2 100644 --- a/Makefile +++ b/Makefile @@ -101,8 +101,8 @@ clean-docs: ## remove documentation artifacts lint/flake8: ## check style with flake8 @echo "Running flake8 code style checks ..." - @bash -c 'flake8 rook tests' - @#bash -c 'ruff check rook tests' + @bash -c 'flake8 src/rook tests' + @#bash -c 'ruff check src/rook tests' lint: lint/flake8 ## check style