Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Python3.10/3.11, documentation fixes, and general codebase cleanup #677

Merged
merged 15 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,22 @@ jobs:
matrix:
include:
- tox-env: py37-extra
python-version: 3.7
python-version: "3.7"
- tox-env: py38-extra
python-version: 3.8
python-version: "3.8"
- tox-env: py39-extra
python-version: 3.9
python-version: "3.9"
- tox-env: py310-extra
python-version: "3.10"
- tox-env: py311-extra
python-version: "3.11"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install packages 📦
run: |
sudo apt-get update
sudo apt-get -y install libnetcdf-dev libhdf5-dev
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
name: Setup Python ${{ matrix.python-version }}
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -44,8 +48,8 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
name: Setup Python 3.7
with:
python-version: 3.7
Expand Down
76 changes: 36 additions & 40 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ Code of Conduct
---------------

Contributors to this project are expected to act respectfully towards others in
accordance with the `OSGeo Code of Conduct
<https://www.osgeo.org/code_of_conduct>`_.
accordance with the `OSGeo Code of Conduct <https://www.osgeo.org/code_of_conduct>`_.

Contributions and Licensing
---------------------------

Contributors are asked to confirm that they comply with the project `license
<https://github.com/geopython/PyWPS/blob/master/LICENSE.txt>`_ guidelines.
<https://github.com/geopython/PyWPS/blob/main/LICENSE.txt>`_ guidelines.

GitHub Commit Access
^^^^^^^^^^^^^^^^^^^^
Expand All @@ -32,10 +31,11 @@ GitHub Commit Access
the pywps-devel `mailing list`_. Proposals shall be approved by the PyWPS
development team. Committers shall be added by the project admin
- removal of commit access shall be handled in the same manner
- each committer must send an email to the PyWPS mailing list agreeing to the license guidelines (see
`Contributions and Licensing Agreement Template
<#contributions-and-licensing-agreement-template>`_). **This is only required once**
- each committer shall be listed in https://github.com/geopython/pywps/blob/master/COMMITTERS.txt
- each committer must send an email to the PyWPS mailing list agreeing to the
license guidelines (see
`Contributions and Licensing Agreement Template <#contributions-and-licensing-agreement-template>`_).
**This is only required once**
- each committer shall be listed in https://github.com/geopython/pywps/blob/main/COMMITTERS.txt

GitHub Pull Requests
^^^^^^^^^^^^^^^^^^^^
Expand All @@ -52,10 +52,10 @@ GitHub Pull Requests
- all contributors shall be listed at
https://github.com/geopython/pywps/graphs/contributors
- unclaimed copyright, by default, is assigned to the main copyright holders as
specified in https://github.com/geopython/pywps/blob/master/LICENSE.txt
- make sure, the tests are passing on [travis-ci](https://travis-ci.org/geopython/pywps) sevice, as well as on your local machine `tox`::
specified in https://github.com/geopython/pywps/blob/main/LICENSE.txt
- make sure, the tests are passing on [GitHub CI](https://github.com/geopython/pywps/actions/workflows/main.yml) service, as well as on your local machine `tox`::

tox
$ tox

Contributions and Licensing Agreement Template
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -64,7 +64,6 @@ Contributions and Licensing Agreement Template
PyWPS. I confirm that my contributions to PyWPS will be compatible with the
PyWPS license guidelines at the time of contribution.``


GitHub
------

Expand All @@ -82,8 +81,8 @@ Documentation

- documentation is managed in ``docs/``, in reStructuredText format
- `Sphinx`_ is used to generate the documentation
- See the `reStructuredText Primer <http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`_ on rST
markup and syntax
- See the `reStructuredText Primer <https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`_
on reST markup and syntax

Bugs
----
Expand All @@ -109,8 +108,8 @@ GitHub Commit Guidelines
- enhancements and bug fixes should be identified with a GitHub issue
- commits should be granular enough for other developers to understand the
nature / implications of the change(s)
- for trivial commits that do not need `Travis CI
<https://travis-ci.org/geopython/pywps>`_ to run, include ``[ci skip]`` as
- for trivial commits that do not need `GitHub CI
<https://github.com/geopython/pywps/actions/workflows/main.yml>`_ to run, include ``[ci skip]`` as
part of the commit message
- non-trivial Git commits shall be associated with a GitHub issue. As
documentation can always be improved, tickets need not be opened for improving
Expand All @@ -129,7 +128,7 @@ Coding Guidelines
^^^^^^^^^^^^^^^^^

- PyWPS instead of pywps, pyWPS, Pywps, PYWPS
- always code with `PEP 8`_ conventions
- always code with `PEP8`_ conventions
- always run source code through ``flake8``
- for exceptions which make their way to OGC ``ows:ExceptionReport`` XML, always
specify the appropriate ``locator`` and ``code`` parameters
Expand All @@ -139,61 +138,58 @@ Submitting a Pull Request

This section will guide you through steps of working on PyWPS. This section
assumes you have forked PyWPS into your own GitHub repository. Note that
``master`` is the main development branch in PyWPS.
``main`` is the main development branch in PyWPS.
for stable releases and managed exclusively by the PyWPS team.

.. code-block:: bash
.. code-block:: console

# setup a virtualenv
virtualenv mypywps && cd mypywps
. ./bin/activate
$ virtualenv mypywps && cd mypywps
$ . ./bin/activate

# clone the repository locally
git clone [email protected]:USERNAME/pywps.git
cd pywps
pip install -e . && pip install -r requirements.txt
$ git clone [email protected]:USERNAME/pywps.git
$ cd pywps
$ pip install -e . && pip install -r requirements.txt

# add the main PyWPS development branch to keep up to date with upstream changes
git remote add upstream https://github.com/geopython/pywps.git
git pull upstream master
$ git remote add upstream https://github.com/geopython/pywps.git
$ git pull upstream main

# create a local branch off master
# create a local branch off main
# The name of the branch should include the issue number if it exists
git branch issue-72
git checkout issue-72
$ git branch issue-72
$ git checkout issue-72


# make code/doc changes
git commit -am 'fix xyz (#72)'
git push origin issue-72
$ git commit -am 'fix xyz (#72)'
$ git push origin issue-72

Your changes are now visible on your PyWPS repository on GitHub. You are now
ready to create a pull request. A member of the PyWPS team will review the pull
ready to create a pull request. A member of the PyWPS team will review the pull
request and provide feedback / suggestions if required. If changes are
required, make them against the same branch and push as per above (all changes
to the branch in the pull request apply).

The pull request will then be merged by the PyWPS team. You can then delete
your local branch (on GitHub), and then update
your own repository to ensure your PyWPS repository is up to date with PyWPS
master:
your local branch (on GitHub), and then update your own repository to ensure
your PyWPS repository is up to date with PyWPS main:

.. code-block:: bash
.. code-block:: console

git checkout master
git pull upstream master
$ git checkout main
$ git pull upstream main

Release Packaging
-----------------

Release packaging notes are maintained at https://github.com/geopython/pywps/wiki/ReleasePackaging


.. _`Corporate`: http://www.osgeo.org/sites/osgeo.org/files/Page/corporate_contributor.txt
.. _`Individual`: http://www.osgeo.org/sites/osgeo.org/files/Page/individual_contributor.txt
.. _`[email protected]`: mailto:[email protected]
.. _`OSGeo`: http://www.osgeo.org/content/foundation/legal/licenses.html
.. _`PEP 8`: https://www.python.org/dev/peps/pep-0008/
.. _`PEP8`: https://www.python.org/dev/peps/pep-0008/
.. _`flake8`: https://flake8.readthedocs.io/en/latest/
.. _`Sphinx`: http://sphinx-doc.org/
.. _`mailing list`: https://pywps.org/community
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* @jonas-eberle Jonas Eberle
* @cehbrecht Carsten Ehbrecht
* @idanmiara Idan Miara
* @Zeitsperre Trevor James Smith

# Contributor to older versions of PyWPS (< 4.x)

Expand Down
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ Install PyWPS 4

Using pip:

$ sudo pip install -e git+https://github.com/geopython/pywps.git@master#egg=pywps
$ sudo pip install -e git+https://github.com/geopython/pywps.git@main#egg=pywps

Or in alternative install it manually:

$ git clone https://github.com/geopython/pywps.git

$ cd pywps/

$ sudo python setup.py install
$ sudo pip install .

Install example service
-----------------------
Expand Down
8 changes: 4 additions & 4 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ to **geopython-security nospam @ lists.osgeo.org** - (remove the blanks and 'nos
The PyWPS Project Steering Committee will release patches for security vulnerabilities for the following versions:

| Version | Supported |
| ------- | ------------------ |
| 4.5.x | :white_check_mark: |
| 4.4.x | :white_check_mark: |
| < 4.4 | previous versions | :x: |
|---------|--------------------|
| 4.5.x | :white_check_mark: |
| 4.4.x | :white_check_mark: |
| < 4.4 | previous versions |
40 changes: 24 additions & 16 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,39 @@
Installation
============

.. note:: PyWPS is not tested on the MS Windows platform. Please join the
development team if you need this platform to be supported. This is mainly
because of the lack of a multiprocessing library. It is used to process
asynchronous execution, i.e., when making requests storing the response
document and updating a status document displaying the progress of
execution.
.. note:: PyWPS is not tested on the Microsoft Windows platform. Please join the development team
if you need this platform to be supported. This is mainly because of the lack of a multiprocessing
library. It is used to process asynchronous execution, i.e., when making requests storing the response
document and updating a status document displaying the progress of execution.


Dependencies and requirements
-----------------------------

PyWPS runs on Python 2.7, 3.3 or higher. PyWPS is currently tested and
developed on Linux (mostly Ubuntu). In the documentation we take this
distribution as reference.
PyWPS runs on Python 3.7 or higher. PyWPS is currently tested and developed on Linux (mostly Ubuntu).
In the documentation we take this distribution as reference.

Prior to installing PyWPS, Git and the Python bindings for GDAL must be
installed in the system. In Debian based systems these packages can be
installed in the system. On Debian based systems, these packages can be
installed with a tool like *apt*::

$ sudo apt-get install git python-gdal

Alternatively, if GDAL is already installed on your system you can
install the GDAL Python bindings via pip with::
Alternatively, if GDAL is already installed on your system you can install the GDAL Python bindings via pip with::

$ pip install GDAL==1.10.0 --global-option=build_ext --global-option="-I/usr/include/gdal"
# Determine version of GDAL installed on your system
$ export GDAL_VERSION="$(gdal-config --version)"
# Install GDAL Python bindings
$ pip install gdal==$GDAL_VERSION --global-option=build_ext --global-option="-I/usr/include/gdal"

.. Warning::
If you are using setuptools 63.0 or higher, you need to install the
GDAL Python bindings with the following command::

# Determine version of GDAL installed on your system
$ export GDAL_VERSION="$(gdal-config --version)"
# Install GDAL Python bindings
$ pip install --upgrade --force-reinstall --no-cache-dir gdal==$GDAL_VERSION --no-binary gdal

Download and install
--------------------
Expand All @@ -38,7 +46,7 @@ Using pip
automatically in the system. This might require superuser permissions
(e.g. *sudo* in Debian based systems)::

$ sudo pip install -e git+https://github.com/geopython/pywps.git@master#egg=pywps-dev
$ sudo pip install -e git+https://github.com/geopython/pywps.git@main#egg=pywps

.. todo::

Expand All @@ -61,7 +69,7 @@ Manual installation

To install PyWPS system-wide run::

$ sudo python setup.py install
$ sudo pip install .

For Developers
Installation of the source code using Git and Python's virtualenv tool::
Expand All @@ -75,7 +83,7 @@ For Developers
Then install the package dependencies using pip as described in the Manual installation section. To install
PyWPS::

$ python setup.py install
$ pip install .

Note that installing PyWPS via a virtualenv environment keeps the installation of PyWPS and its
dependencies isolated to the virtual environment and does not affect other parts of the system. This
Expand Down
7 changes: 3 additions & 4 deletions pywps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
##################################################################

import logging

import os

from lxml.builder import ElementMaker
Expand Down Expand Up @@ -90,10 +89,10 @@ def get_version_from_ns(ns):

from pywps.app import Process, Service, WPSRequest
from pywps.app.WPSRequest import get_inputs_from_xml, get_output_from_xml
from pywps.inout.inputs import LiteralInput, ComplexInput, BoundingBoxInput
from pywps.inout.outputs import LiteralOutput, ComplexOutput, BoundingBoxOutput
from pywps.inout.formats import Format, FORMATS, get_format
from pywps.inout import UOM
from pywps.inout.formats import FORMATS, Format, get_format
from pywps.inout.inputs import BoundingBoxInput, ComplexInput, LiteralInput
from pywps.inout.outputs import BoundingBoxOutput, ComplexOutput, LiteralOutput

if __name__ == "__main__":
pass
10 changes: 4 additions & 6 deletions pywps/app/Common.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@


class Metadata(object):
"""
ows:Metadata content model.
"""ows:Metadata content model.

:param title: Metadata title, human readable string
:param title: Metadata title, human-readable string
:param href: fully qualified URL
:param role: fully qualified URL
:param type_: fully qualified URL
Expand All @@ -36,8 +35,7 @@ def __iter__(self):

@property
def json(self):
"""Get JSON representation of the metadata
"""
"""Get JSON representation of the metadata."""
data = {
'title': self.title,
'href': self.href,
Expand Down Expand Up @@ -70,7 +68,7 @@ class MetadataUrl(Metadata):

Useful to avoid Sphinx "Duplicate explicit target name" warning.

See https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#anonymous-hyperlinks.
See: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#anonymous-hyperlinks.

Meant to use in documentation only, not needed in the xml response, nor being serialized or
deserialized to/from json. So that's why it is not directly in the base class.
Expand Down
Loading