diff --git a/.cruft.json b/.cruft.json index 102589b..195a63e 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,36 +1,39 @@ { - "template": "https://github.com/bird-house/cookiecutter-birdhouse.git", - "commit": "f157ea8419fd4e32a9e4d52e613c90c807190e7e", - "skip": [ - "emu/processes/wps_say_hello.py", - "tests/test_wps_hello.py", - "docs/source/notebooks/example.ipynb", - "environment.yml", - "requirements.txt", - "AUTHORS.rst", - "CHANGES.rst", - "docs/source/notebooks/index.rst", - "docs/source/processes.rst", - "emu/processes/__init__.py", - "tests/test_wps_caps.py" - ], - "context": { - "cookiecutter": { - "full_name": "Carsten Ehbrecht", - "email": "ehbrecht@dkrz.de", - "github_username": "bird-house", - "project_name": "Emu", - "project_slug": "emu", - "project_repo_name": "emu", - "project_readthedocs_name": "emu", - "project_short_description": "WPS processes for testing and demos.", - "version": "0.12.0", - "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": "bc8a389e02a3e55e55dad7657671d91e2f238ed9", + "skip": [ + "emu/processes/wps_say_hello.py", + "tests/test_wps_hello.py", + "docs/source/notebooks/example.ipynb", + "environment.yml", + "requirements.txt", + "AUTHORS.rst", + "CHANGES.rst", + "docs/source/notebooks/index.rst", + "docs/source/processes.rst", + "emu/processes/__init__.py", + "tests/test_wps_caps.py" + ], + "context": { + "cookiecutter": { + "full_name": "Carsten Ehbrecht", + "email": "ehbrecht@dkrz.de", + "github_username": "bird-house", + "project_name": "Emu", + "project_slug": "emu", + "project_repo_name": "emu", + "project_readthedocs_name": "emu", + "project_short_description": "WPS processes for testing and demos.", + "version": "0.12.0", + "open_source_license": "Apache Software License 2.0", + "http_port": "5000", + "use_pytest": "y", + "create_author_file": "y", + "_copy_without_render": [ + "{{cookiecutter.project_slug}}/templates/*.cfg" + ], + "_template": "https://github.com/bird-house/cookiecutter-birdhouse.git" } -} \ No newline at end of file + }, + "checkout": null +} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d79afbd..a497445 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - name: Checkout repository and submodules uses: actions/checkout@v2 @@ -31,15 +31,15 @@ jobs: run: make test - name: Lint with flake8 ⚙️ run: make lint - if: matrix.python-version == 3.7 + if: matrix.python-version == 3.8 # - name: Check formatting with black ⚙️ - # run: black --check --target-version py37 birdy tests + # run: black --check --target-version py38 birdy tests # if: matrix.python-version == 3.7 - name: Build docs 🏗️ run: make docs - if: matrix.python-version == 3.7 + if: matrix.python-version == 3.8 # - name: Run smoke tests ⚙️ # run: | # export PYWPS_CFG=$PWD/etc/smoke-pywps.cfg # make smoke - # if: matrix.python-version == 3.7 + # if: matrix.python-version == 3.8 diff --git a/.gitignore b/.gitignore index 571ef18..c9c2581 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,19 @@ testdata.json # Merge conflict *.orig + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +# IDE settings +.vscode/ diff --git a/.readthedocs.yml b/.readthedocs.yml index d92d702..e4719b5 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -17,14 +17,17 @@ sphinx: # configuration: mkdocs.yml # Optionally build your docs in additional formats such as PDF and ePub -formats: all +formats: [] -# 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: + - requirements: requirements_dev.txt diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 336464e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ -dist: xenial # required for Python >= 3.7 -language: python -os: - - linux -python: - - "3.6" - - "3.7" - - "3.8" -# - osx -sudo: false -before_install: - # Useful for debugging Travis CI environment - - printenv -install: - # Python 3.x is default - - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh - - bash miniconda.sh -b -p $HOME/miniconda - - export PATH="$HOME/miniconda/bin:$PATH" - - hash -r - - conda config --set always_yes yes --set changeps1 no - - conda install setuptools - - conda update -q conda - # Useful for debugging any issues with conda - - conda info -a - # Prepare env with Python version - - conda create -n emu -c conda-forge python=$TRAVIS_PYTHON_VERSION - # Update now the env with our environment - - conda env update -f environment.yml - - source activate emu - # Packages for testing, generating docs and installing WPS - - make develop -before_script: - # Start WPS service on port 5000 on 0.0.0.0 - - emu start --daemon --bind-host 0.0.0.0 --port 5000 - - sleep 2 -script: - - pytest -v -m 'not online' tests/ - # No notebooks in emu yet. - #- make test-notebooks - - flake8 - - make docs # default html - - make SPHINXOPTS='-b epub' docs # to match RtD - - make SPHINXOPTS='-b latex' docs # to match RtD diff --git a/LICENSE.txt b/LICENSE similarity index 94% rename from LICENSE.txt rename to LICENSE index 54a2700..dec829d 100644 --- a/LICENSE.txt +++ b/LICENSE @@ -1,4 +1,20 @@ -Apache License +Apache Software License 2.0 + +Copyright (c) 2023, Carsten Ehbrecht + +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. + + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ diff --git a/MANIFEST.in b/MANIFEST.in index 8121610..29e1c74 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,7 @@ include Makefile include *.txt include *.rst +include tox.ini recursive-include emu * global-exclude __pycache__ global-exclude *.py[co] diff --git a/README.rst b/README.rst index 28d7eb9..2a008b2 100644 --- a/README.rst +++ b/README.rst @@ -45,10 +45,13 @@ You can find information about contributing in our `Developer Guide`_. Please use bumpversion_ to release a new version. + License ------- -Free software: Apache Software License 2.0 +* Free software: Apache Software License 2.0 +* Documentation: https://emu.readthedocs.io. + Credits ------- diff --git a/docs/source/.gitignore b/docs/source/.gitignore deleted file mode 100644 index 44dadd1..0000000 --- a/docs/source/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/emu.rst -/emu.*.rst -/modules.rst diff --git a/docs/source/authors.rst b/docs/source/authors.rst new file mode 100644 index 0000000..7739272 --- /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 2726d97..82fad26 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # # emu documentation build configuration file, created by # sphinx-quickstart on Fri Jun 9 13:47:02 2017. @@ -51,22 +50,52 @@ # 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 # inherit without having to test which work which do not. -autodoc_mock_imports = ["numpy", "xarray", "fiona", "rasterio", "shapely", - "osgeo", "geopandas", "pandas", "statsmodels", - "affine", "rasterstats", "spotpy", "matplotlib", - "scipy", "unidecode", "gdal", "sentry_sdk", "dask", - "numba", "parse", "siphon", "sklearn", "cftime", - "netCDF4", "bottleneck", "ocgis", "geotiff", "geos", - "hdf4", "hdf5", "zlib", "pyproj", "proj", "cartopy", - "scikit-learn", "cairo"] +autodoc_mock_imports = [ + "numpy", + "xarray", + "fiona", + "rasterio", + "shapely", + "osgeo", + "geopandas", + "pandas", + "statsmodels", + "affine", + "rasterstats", + "spotpy", + "matplotlib", + "scipy", + "unidecode", + "gdal", + "sentry_sdk", + "dask", + "numba", + "parse", + "siphon", + "sklearn", + "cftime", + "netCDF4", + "bottleneck", + "ocgis", + "geotiff", + "geos", + "hdf4", + "hdf5", + "zlib", + "pyproj", + "proj", + "cartopy", + "scikit-learn", + "cairo", +] # Monkeypatch constant because the following are mock imports. # Only works if numpy is actually installed and at the same time being mocked. -#import numpy -#numpy.pi = 3.1416 +# import numpy +# numpy.pi = 3.1416 # We are using mock imports in readthedocs, so probably safer to not run the notebooks -nbsphinx_execute = 'never' +nbsphinx_execute = "never" # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] @@ -82,7 +111,7 @@ # General information about the project. project = "Emu" -copyright = "2018-2020, Carsten Ehbrecht" +copyright = "2018-2023, Carsten Ehbrecht" author = "Carsten Ehbrecht" # The version info for the project you're documenting, acts as replacement @@ -99,7 +128,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. @@ -113,7 +142,7 @@ todo_include_todos = False # Suppress "WARNING: unknown mimetype for ..." when building EPUB. -suppress_warnings = ['epub.unknown_project_files'] +suppress_warnings = ["epub.unknown_project_files"] # Avoid "configuration.rst:4:duplicate label configuration, other instance in configuration.rst" autosectionlabel_prefix_document = True diff --git a/docs/source/index.rst b/docs/source/index.rst index cf12d70..88abb05 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -9,6 +9,7 @@ dev_guide tutorial processes + authors changes Indices and tables diff --git a/emu/__version__.py b/emu/__version__.py index 9fce8b0..5428f8d 100644 --- a/emu/__version__.py +++ b/emu/__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""" -__email__ = 'ehbrecht@dkrz.de' -__version__ = '0.12.0' +__author__ = "Carsten Ehbrecht" +__email__ = "ehbrecht@dkrz.de" +__version__ = "0.12.0" diff --git a/emu/cli.py b/emu/cli.py index 2004be6..4129ea2 100644 --- a/emu/cli.py +++ b/emu/cli.py @@ -131,9 +131,11 @@ def stop(): @click.option('--log-level', metavar='LEVEL', default='INFO', help='log level in PyWPS configuration.') @click.option('--log-file', metavar='PATH', default='pywps.log', help='log file in PyWPS configuration.') @click.option('--database', 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, daemon, hostname, port, maxsingleinputsize, maxprocesses, parallelprocesses, - log_level, log_file, database): + log_level, log_file, database, outputurl, outputpath): """Start PyWPS service. This service is by default available at http://localhost:5000/wps """ @@ -150,6 +152,8 @@ def start(config, bind_host, daemon, hostname, port, wps_log_level=log_level, wps_log_file=log_file, wps_database=database, + wps_outputurl=outputurl, + wps_outputpath=outputpath )) if config: cfgfiles.append(config) diff --git a/environment-docs.yml b/environment-docs.yml index cf289d8..0a09dcb 100644 --- a/environment-docs.yml +++ b/environment-docs.yml @@ -2,9 +2,9 @@ name: emu-docs channels: - conda-forge -- defaults dependencies: -- pywps=4.4.0 +- python >=3.8,<3.11 +- pywps >=4.5.2 - sphinx - nbsphinx - ipython diff --git a/environment.yml b/environment.yml index f44db79..a69169c 100644 --- a/environment.yml +++ b/environment.yml @@ -4,8 +4,8 @@ channels: - defaults dependencies: - pip -- python>=3.7,<3.10 -- pywps>=4.5.1,<4.6 +- python>=3.8,<3.12 +- pywps>=4.5.2,<4.7 - jinja2 - click - psutil diff --git a/requirements.txt b/requirements.txt index 59bc20a..147d6b7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pywps>=4.5.1 +pywps>=4.5.2 jinja2 click psutil diff --git a/requirements_dev.txt b/requirements_dev.txt index 5ba6c76..450752c 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,14 +1,15 @@ pytest>=6.0 +pytest-cov flake8 +tox pytest-flake8 ipython pytest-notebook nbsphinx nbval>=0.9.6 nbconvert -sphinx>=1.7 -bumpversion -twine +sphinx>=1.8.5 +bump-my-version cruft # Changing dependencies above this comment will create merge conflicts when updating the cookiecutter template with cruft. Add extra requirements below this line. locust diff --git a/setup.cfg b/setup.cfg index b0f45be..af0482b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,7 +11,7 @@ search = __version__ = '{current_version}' replace = __version__ = '{new_version}' [bumpversion:file:docs/source/conf.py] -search = version|release = {current_version} +parse = version|release = {current_version} replace = {new_version} [bumpversion:file:Dockerfile] @@ -23,12 +23,12 @@ search = "version": "{current_version}", replace = "version": "{new_version}", [tool:pytest] -addopts = +addopts = + --color=yes --strict --tb=native - tests/ python_files = test_*.py -markers = +markers = online: mark test to need internet connection slow: mark test to be slow flaky: mark test to be flaky @@ -45,6 +45,6 @@ exclude = dist, src, -[doc8] -ignore-path = docs/build,docs/source/_templates,docs/source/_static -max-line-length = 120 +[aliases] +# Define setup.py command aliases here +test = pytest diff --git a/setup.py b/setup.py index bdf1f8d..e97c5d2 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- """The setup script.""" @@ -8,54 +7,58 @@ from setuptools import setup, find_packages 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.7.0" +README = open(os.path.join(here, "README.rst")).read() +CHANGES = open(os.path.join(here, "CHANGES.rst")).read() +REQUIRES_PYTHON = ">=3.8.0" about = {} -with open(os.path.join(here, 'emu', '__version__.py'), 'r') as f: +with open(os.path.join(here, "emu", "__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')] +reqs = [line.strip() for line in open("requirements.txt")] +dev_reqs = [line.strip() for line in open("requirements_dev.txt")] extra_reqs = [line.strip() for line in open("requirements_extra.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.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Topic :: Scientific/Engineering :: Atmospheric Science', - 'License :: OSI Approved :: Apache Software License', + "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.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering :: Atmospheric Science", + "License :: OSI Approved :: Apache Software License", ] -setup(name='emu', - version=about['__version__'], - description="WPS processes for testing and demo", - long_description=README + '\n\n' + CHANGES, - long_description_content_type="text/x-rst", - author=about['__author__'], - author_email=about['__email__'], - url='https://github.com/bird-house/emu', - python_requires=REQUIRES_PYTHON, - classifiers=classifiers, - license="Apache Software License 2.0", - keywords='wps pywps birdhouse emu', - packages=find_packages(), - include_package_data=True, - install_requires=reqs, - extras_require={ - "extra:": extra_reqs, - "dev": dev_reqs, # pip install ".[dev]" - }, - entry_points={ - 'console_scripts': [ - 'emu=emu.cli:cli', - ]},) +setup( + name="emu", + version=about["__version__"], + description="WPS processes for testing and demo", + long_description=README + "\n\n" + CHANGES, + long_description_content_type="text/x-rst", + author=about["__author__"], + author_email=about["__email__"], + url="https://github.com/bird-house/emu", + python_requires=REQUIRES_PYTHON, + classifiers=classifiers, + license="Apache Software License 2.0", + keywords="wps pywps birdhouse emu", + packages=find_packages(), + include_package_data=True, + install_requires=reqs, + extras_require={ + "extra:": extra_reqs, + "dev": dev_reqs, # pip install ".[dev]" + }, + entry_points={ + "console_scripts": [ + "emu=emu.cli:cli", + ] + }, +) diff --git a/tests/__init__.py b/tests/__init__.py index 1d1c435..1f41eb7 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- - """Unit test package for emu."""