From dcc448306483a4888df21d759a2ca604d6873893 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 21 Dec 2021 16:19:29 -0500 Subject: [PATCH 01/11] Update LICENSE.txt years --- LICENSE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.txt b/LICENSE.txt index 03b5e0938..1dca9866a 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (C) 2014-2016 PyWPS Development Team, represented by Jachym Cepicky +Copyright (C) 2014-2021 PyWPS Development Team, represented by Jachym Cepicky Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to From 1a2f03d21d2ab1e0eb0329a991c2762eaa9648d3 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 21 Dec 2021 18:16:12 -0500 Subject: [PATCH 02/11] Update tox to reflect current package structure, add a "dev" recipe to setup.py, formatting --- setup.py | 90 ++++++++++++++++++++++++++++++++------------------------ tox.ini | 38 ++++++++++++------------ 2 files changed, 69 insertions(+), 59 deletions(-) diff --git a/setup.py b/setup.py index 167787a3b..5d18ed5af 100644 --- a/setup.py +++ b/setup.py @@ -12,57 +12,69 @@ from setuptools import find_packages -with open('VERSION.txt') as ff: +with open("VERSION.txt") as ff: VERSION = ff.read().strip() -DESCRIPTION = ('PyWPS is an implementation of the Web Processing Service ' - 'standard from the Open Geospatial Consortium. PyWPS is ' - 'written in Python.') +DESCRIPTION = ( + "PyWPS is an implementation of the Web Processing Service " + "standard from the Open Geospatial Consortium. PyWPS is " + "written in Python." +) -with open('README.md') as ff: +with open("README.md") as ff: LONG_DESCRIPTION = ff.read() -KEYWORDS = 'PyWPS WPS OGC processing' +KEYWORDS = "PyWPS WPS OGC processing" -with open('requirements.txt') as f: - INSTALL_REQUIRES = f.read().splitlines() +with open("requirements.txt") as fr: + INSTALL_REQUIRES = fr.read().splitlines() + +with open("requirements-dev.txt") as frd: + DEV_REQUIRES = frd.read().splitlines() CONFIG = { - 'name': 'pywps', - 'version': VERSION, - 'description': DESCRIPTION, - 'long_description': LONG_DESCRIPTION, - 'long_description_content_type': 'text/markdown', - 'keywords': KEYWORDS, - 'license': 'MIT', - 'platforms': 'all', - 'author': 'Jachym Cepicky', - 'author_email': 'jachym.cepicky@gmail.com', - 'maintainer': 'Jachym Cepicky', - 'maintainer_email': 'jachym.cepicky@gmail.com', - 'url': 'https://pywps.org', - 'download_url': 'https://github.com/geopython/pywps', - 'classifiers': [ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', + "name": "pywps", + "version": VERSION, + "description": DESCRIPTION, + "long_description": LONG_DESCRIPTION, + "long_description_content_type": "text/markdown", + "keywords": KEYWORDS, + "license": "MIT", + "platforms": "all", + "author": "Jachym Cepicky", + "author_email": "jachym.cepicky@gmail.com", + "maintainer": "Jachym Cepicky", + "maintainer_email": "jachym.cepicky@gmail.com", + "url": "https://pywps.org", + "download_url": "https://github.com/geopython/pywps", + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", - 'Topic :: Scientific/Engineering :: GIS' + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Topic :: Scientific/Engineering :: GIS", ], - 'install_requires': INSTALL_REQUIRES, - 'python_requires': '>=3.6, <4', - 'packages': find_packages(exclude=["docs", "tests.*", "tests"]), - 'include_package_data': True, - 'scripts': [], - 'entry_points': { - 'console_scripts': [ - 'joblauncher=pywps.processing.job:launcher', ]}, + "install_requires": INSTALL_REQUIRES, + "extras_require": dict( + dev=DEV_REQUIRES, + ), + "python_requires": ">=3.6, <4", + "packages": find_packages(exclude=["docs", "tests.*", "tests"]), + "include_package_data": True, + "scripts": [], + "entry_points": { + "console_scripts": [ + "joblauncher=pywps.processing.job:launcher", + ] + }, } setup(**CONFIG) diff --git a/tox.ini b/tox.ini index 990d7b221..372bce58a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,23 +1,21 @@ [tox] -envlist=py36 +envlist = py{36,37,38,39}{-extra,} +requires = pip >= 20.0 +opts = --verbose [testenv] - -pip_pre=True -deps= - lxml - flask - owslib - simplejson - jsonschema - geojson - shapely - unipath - werkzeug - SQLAlchemy - jinja2 - -commands= - # check first which version is installed "gdal-config --version" - pip install GDAL==2.1.0 --global-option=build_ext --global-option="-I/usr/include/gdal" - python -m unittest tests +setenv = + PYTEST_ADDOPTS = "--color=yes" + PYTHONPATH = {toxinidir} + COV_CORE_SOURCE = +passenv = CI GITHUB_* LD_LIBRARY_PATH +download = True +install_command = + python -m pip install --no-user {opts} {packages} +extras = dev +deps = + extra: -rrequirements-extra.txt +commands = +; # magic for gathering the GDAL version within tox +; sh -c 'pip install GDAL=="$(gdal-config --version)" --global-option=build_ext --global-option="-I/usr/include/gdal"' + pytest --cov From 2edcffa9318024a29960b697ca4c0443928c2c44 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 21 Dec 2021 18:17:02 -0500 Subject: [PATCH 03/11] more readable setup.cfg, address a raw string regex warning --- .github/workflows/main.yml | 37 ++++++++++++++++++++++--------------- setup.cfg | 13 ++++++++----- tests/test_exceptions.py | 12 +++++++----- 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 00521d60a..0db1ae1fb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,27 +15,34 @@ jobs: - uses: actions/checkout@v2 - name: Install packages run: | - sudo apt-get update && sudo apt-get -y install libnetcdf-dev libhdf5-dev + sudo apt-get update + sudo apt-get -y install libnetcdf-dev libhdf5-dev - uses: actions/setup-python@v2 name: Setup Python ${{ matrix.python-version }} with: python-version: ${{ matrix.python-version }} - - name: Install requirements 📦 - run: | - pip3 install pip --upgrade - pip3 install -r requirements.txt - pip3 install -r requirements-dev.txt - pip3 install -r requirements-extra.txt - - name: run tests ⚙️ - run: pytest -v tests - - name: run coveralls ⚙️ - run: coveralls +# - name: Install requirements 📦 +# run: | +# pip install pip --upgrade +# pip install -r requirements.txt +# pip install -r requirements-dev.txt +# pip install -r requirements-extra.txt + - name: Install tox + run: pip install tox + - name: Run tests ⚙️ + run: pytest -v tests --cov + - name: Run coveralls ⚙️ if: matrix.python-version == 3.7 - - name: build docs 🏗️ + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Build docs 🏗️ run: | - pip3 install -e . + pip install -e . cd docs && make html if: matrix.python-version == 3.7 - - name: run flake8 ⚙️ - run: flake8 pywps + - name: Run flake8 ⚙️ + run: | + pip install flake8 + flake8 pywps if: matrix.python-version == 3.7 diff --git a/setup.cfg b/setup.cfg index fd036a0ff..b18382f01 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,11 +6,6 @@ parse = (?P\d+)\.(?P\d+).(?P\d+) serialize = {major}.{minor}.{patch} -[flake8] -ignore = F401,E402,W606 -max-line-length = 120 -exclude = tests - [bumpversion:file:pywps/__init__.py] search = __version__ = "{current_version}" replace = __version__ = "{new_version}" @@ -18,3 +13,11 @@ replace = __version__ = "{new_version}" [bumpversion:file:VERSION.txt] search = {current_version} replace = {new_version} + +[flake8] +ignore = + F401 + E402 + W606 +max-line-length = 120 +exclude = tests diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py index d3d639ed1..578568d8e 100644 --- a/tests/test_exceptions.py +++ b/tests/test_exceptions.py @@ -10,10 +10,11 @@ import re -VERSION="1.0.0" +VERSION = "1.0.0" WPS, OWS = get_ElementMakerForVersion(VERSION) xpath_ns = get_xpath_ns(VERSION) + class ExceptionsTest(unittest.TestCase): def setUp(self): @@ -24,7 +25,7 @@ def test_invalid_parameter_value(self): exception_el = resp.xpath('/ows:ExceptionReport/ows:Exception')[0] assert exception_el.attrib['exceptionCode'] == 'InvalidParameterValue' assert resp.status_code == 400 - assert re.match('text/xml(;\s*charset=.*)?', resp.headers['Content-Type']) + assert re.match(r'text/xml(;\s*charset=.*)?', resp.headers['Content-Type']) assert_pywps_version(resp) def test_missing_parameter_value(self): @@ -32,20 +33,21 @@ def test_missing_parameter_value(self): exception_el = resp.xpath('/ows:ExceptionReport/ows:Exception')[0] assert exception_el.attrib['exceptionCode'] == 'MissingParameterValue' assert resp.status_code == 400 - assert re.match('text/xml(;\s*charset=.*)?', resp.headers['Content-Type']) + assert re.match(r'text/xml(;\s*charset=.*)?', resp.headers['Content-Type']) def test_missing_request(self): resp = self.client.get("?service=wps") exception_el = resp.xpath('/ows:ExceptionReport/ows:Exception/ows:ExceptionText')[0] # should mention something about a request assert 'request' in exception_el.text - assert re.match('text/xml(;\s*charset=.*)?', resp.headers['Content-Type']) + assert re.match(r'text/xml(;\s*charset=.*)?', resp.headers['Content-Type']) def test_bad_request(self): resp = self.client.get("?service=wps&request=xyz") exception_el = resp.xpath('/ows:ExceptionReport/ows:Exception')[0] assert exception_el.attrib['exceptionCode'] == 'OperationNotSupported' - assert re.match('text/xml(;\s*charset=.*)?', resp.headers['Content-Type']) + assert re.match(r'text/xml(;\s*charset=.*)?', resp.headers['Content-Type']) + def load_tests(loader=None, tests=None, pattern=None): if not loader: From 44c61c38f17f6768d09753a9fdb9ee40ede8d92b Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 21 Dec 2021 18:20:55 -0500 Subject: [PATCH 04/11] re-enable coveralls in GitHub CI workflow while leveraging tox --- .github/workflows/main.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0db1ae1fb..860b283df 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,10 +7,16 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_SERVICE_NAME: github + include: + - tox-env: py37-extra + python-version: 3.7 + - tox-env: py38-extra + python-version: 3.8 + - tox-env: py39-extra + python-version: 3.9 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# COVERALLS_SERVICE_NAME: github steps: - uses: actions/checkout@v2 - name: Install packages @@ -29,8 +35,8 @@ jobs: # pip install -r requirements-extra.txt - name: Install tox run: pip install tox - - name: Run tests ⚙️ - run: pytest -v tests --cov + - name: Run tests with tox ⚙️ + run: tox -e ${{ matrix.tox-env }} - name: Run coveralls ⚙️ if: matrix.python-version == 3.7 uses: coverallsapp/github-action@master From b139a62cae8ba63dcaa5b74857050ec505402e08 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 21 Dec 2021 18:32:40 -0500 Subject: [PATCH 05/11] add pytest-cov --- requirements-dev.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements-dev.txt b/requirements-dev.txt index 4aeb4bb3d..b91a605d8 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,7 @@ coverage coveralls pytest +pytest-cov flake8 pylint Sphinx From 8f3afd487552ac11ab2dc1a2d6601f865143bb2c Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 21 Dec 2021 18:37:29 -0500 Subject: [PATCH 06/11] indicate to coveralls that repo uses relative_files for coverage --- setup.cfg | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.cfg b/setup.cfg index b18382f01..e31cf23bf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,6 +14,9 @@ replace = __version__ = "{new_version}" search = {current_version} replace = {new_version} +[coverage:run] +relative_files = True + [flake8] ignore = F401 From ee5d3c1072c7c08611e859dd6018402868b7e312 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 21 Dec 2021 18:38:50 -0500 Subject: [PATCH 07/11] Only build on push for main branch --- .github/workflows/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 860b283df..0ba40d8fa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,10 @@ name: build ⚙️ -on: [ push, pull_request ] +on: + push: + branches: + - main + pull_request: jobs: main: From d3313b6db956de6280181b4a90e94cf7415992ff Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 21 Dec 2021 18:44:26 -0500 Subject: [PATCH 08/11] Use coveralls action that works in python --- .github/workflows/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0ba40d8fa..b68f910c0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,9 +43,7 @@ jobs: run: tox -e ${{ matrix.tox-env }} - name: Run coveralls ⚙️ if: matrix.python-version == 3.7 - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} + uses: AndreMiras/coveralls-python-action@develop - name: Build docs 🏗️ run: | pip install -e . From 91472e2a97d6e18bd68a984ab900e2dfaff13726 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 21 Dec 2021 19:53:16 -0500 Subject: [PATCH 09/11] Install dev requirements --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b68f910c0..56a6e56a7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,7 +46,7 @@ jobs: uses: AndreMiras/coveralls-python-action@develop - name: Build docs 🏗️ run: | - pip install -e . + pip install -e .[dev] cd docs && make html if: matrix.python-version == 3.7 - name: Run flake8 ⚙️ From e5ab4aab24444eef19a43f6d4fb2bc0e21d246f9 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 22 Dec 2021 10:41:04 -0500 Subject: [PATCH 10/11] Drop Python3.6 support, make distinct docs build step --- .github/workflows/main.yml | 47 ++++++++++++++++++++------------------ setup.py | 3 +-- tox.ini | 2 +- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 56a6e56a7..1a2a1ffdf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,7 @@ on: pull_request: jobs: - main: + test: runs-on: ubuntu-latest strategy: matrix: @@ -18,12 +18,9 @@ jobs: python-version: 3.8 - tox-env: py39-extra python-version: 3.9 -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# COVERALLS_SERVICE_NAME: github steps: - uses: actions/checkout@v2 - - name: Install packages + - name: Install packages 📦 run: | sudo apt-get update sudo apt-get -y install libnetcdf-dev libhdf5-dev @@ -31,26 +28,32 @@ jobs: name: Setup Python ${{ matrix.python-version }} with: python-version: ${{ matrix.python-version }} -# - name: Install requirements 📦 -# run: | -# pip install pip --upgrade -# pip install -r requirements.txt -# pip install -r requirements-dev.txt -# pip install -r requirements-extra.txt - - name: Install tox + - name: Run flake8 ⚙️ + run: | + pip install flake8 + flake8 pywps + if: matrix.python-version == 3.7 + - name: Install tox 📦 run: pip install tox - name: Run tests with tox ⚙️ run: tox -e ${{ matrix.tox-env }} - name: Run coveralls ⚙️ if: matrix.python-version == 3.7 uses: AndreMiras/coveralls-python-action@develop - - name: Build docs 🏗️ - run: | - pip install -e .[dev] - cd docs && make html - if: matrix.python-version == 3.7 - - name: Run flake8 ⚙️ - run: | - pip install flake8 - flake8 pywps - if: matrix.python-version == 3.7 + + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install packages 📦 + run: | + sudo apt-get update + sudo apt-get -y install libnetcdf-dev libhdf5-dev + - uses: actions/setup-python@v2 + name: Setup Python 3.7 + with: + python-version: 3.7 + - name: Build docs 🏗️ + run: | + pip install -e .[dev] + cd docs && make html diff --git a/setup.py b/setup.py index 5d18ed5af..2d8cc6144 100644 --- a/setup.py +++ b/setup.py @@ -56,7 +56,6 @@ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", @@ -66,7 +65,7 @@ "extras_require": dict( dev=DEV_REQUIRES, ), - "python_requires": ">=3.6, <4", + "python_requires": ">=3.7,<4", "packages": find_packages(exclude=["docs", "tests.*", "tests"]), "include_package_data": True, "scripts": [], diff --git a/tox.ini b/tox.ini index 372bce58a..a37c37e8c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{36,37,38,39}{-extra,} +envlist = py{37,38,39}{-extra,} requires = pip >= 20.0 opts = --verbose From 8f2fcca857bfcb8e2f2424453b92eaef01b9056b Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 22 Dec 2021 10:43:31 -0500 Subject: [PATCH 11/11] No need for libnetcdf in docs --- .github/workflows/main.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1a2a1ffdf..5c593c6bd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,10 +45,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Install packages 📦 - run: | - sudo apt-get update - sudo apt-get -y install libnetcdf-dev libhdf5-dev - uses: actions/setup-python@v2 name: Setup Python 3.7 with: