From f23f6a39038276cb442d655abca6ca01c866b6ce Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Thu, 14 Mar 2024 17:05:55 -0400 Subject: [PATCH 01/18] pre-commit adjustments --- .pre-commit-config.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7ed941d..9877520 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: rev: v3.15.1 hooks: - id: pyupgrade - args: ['--py39-plus'] + args: [ '--py39-plus' ] - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: @@ -19,11 +19,6 @@ repos: hooks: - id: nbstripout files: '.ipynb' - - repo: https://github.com/pycqa/flake8 - rev: 7.0.0 - hooks: - - id: flake8 - args: [ '--config=setup.cfg' ] - repo: https://github.com/psf/black rev: 24.2.0 hooks: @@ -34,15 +29,20 @@ repos: hooks: - id: isort args: [ '--profile=black' ] + - repo: https://github.com/pycqa/flake8 + rev: 7.0.0 + hooks: + - id: flake8 + args: [ '--config=setup.cfg' ] - repo: https://github.com/nbQA-dev/nbQA rev: 1.8.4 hooks: - - id: nbqa-black - args: [ '--target-version=py37' ] - additional_dependencies: [ 'black==24.2.0' ] - id: nbqa-pyupgrade - args: [ '--py37-plus' ] + args: [ '--py39-plus' ] additional_dependencies: [ 'pyupgrade==v3.15.1' ] + - id: nbqa-black + args: [ '--target-version=py39' ] + additional_dependencies: [ 'black==24.2.0' ] - id: nbqa-isort args: [ '--profile=black' ] additional_dependencies: [ 'isort==5.13.2' ] From ae2f903a04037e5814468ba9078c018d98a2de9b Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Thu, 14 Mar 2024 17:07:29 -0400 Subject: [PATCH 02/18] use sphinx-autodoc, sphinx-codeautolink, sphinx-copybutton, address documentation warnings, add automodule documentation --- .gitignore | 1 + Makefile | 12 ++++++++++-- birdy/client/__init__.py | 2 +- birdy/utils.py | 5 ++--- docs/source/api.rst | 2 ++ docs/source/conf.py | 21 +++++++++++++++++++-- docs/source/index.rst | 7 +++++++ environment-docs.yml | 4 +++- requirements_dev.txt | 23 ++++++++++++----------- 9 files changed, 57 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 29f0c60..79b3660 100644 --- a/.gitignore +++ b/.gitignore @@ -65,6 +65,7 @@ docs/make.bat docs/doctrees/ docs/html/ docs/build/ +docs/source/apidoc # External Sources #src/external diff --git a/Makefile b/Makefile index 0170f7f..b75973d 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,11 @@ clean-build: ## remove build artifacts find . -name '*.egg-info' -exec rm -fr {} + find . -name '*.egg' -exec rm -f {} + +clean-docs: ## remove docs artifacts + rm -f docs/apidoc/birdy*.rst + rm -f docs/apidoc/modules.rst + $(MAKE) -C docs clean + clean-pyc: ## remove Python file artifacts find . -name '*.pyc' -exec rm -f {} + find . -name '*.pyo' -exec rm -f {} + @@ -72,8 +77,11 @@ coverage: ## check code coverage quickly with the default Python coverage html $(BROWSER) htmlcov/index.html -docs: ## generate Sphinx HTML documentation, including API docs - $(MAKE) -C docs clean +autodoc: clean-docs ## create sphinx-apidoc files + mkdir -p docs/source/apidoc/ + sphinx-apidoc -o docs/source/apidoc/ --private --module-first birdy + +docs: autodoc ## generate Sphinx HTML documentation, including API docs $(MAKE) -C docs html servedocs: docs ## compile the docs watching for changes diff --git a/birdy/client/__init__.py b/birdy/client/__init__.py index 3458a74..c6e0004 100644 --- a/birdy/client/__init__.py +++ b/birdy/client/__init__.py @@ -87,7 +87,7 @@ Birdy's own defaults. However, it's possible to customize the output of a process. Each process has an input -named ``output_formats`, that takes a dictionary as a parameter:: +named ``output_formats``, that takes a dictionary as a parameter:: # example format = { # 'output_identifier': { diff --git a/birdy/utils.py b/birdy/utils.py index 06dde6f..1369b95 100644 --- a/birdy/utils.py +++ b/birdy/utils.py @@ -44,12 +44,11 @@ def is_url(url): def is_opendap_url(url): - """ - Check if a provided url is an OpenDAP url. + """Check if a provided url is an OpenDAP url. The DAP Standard specifies that a specific tag must be included in the Content-Description header of every request. This tag is one of: - "dods-dds" | "dods-das" | "dods-data" | "dods-error" + "dods-dds" | "dods-das" | "dods-data" | "dods-error" So we can check if the header starts with `dods`. diff --git a/docs/source/api.rst b/docs/source/api.rst index 7a44b6c..0de3349 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -12,8 +12,10 @@ Using the command line ====================== .. automodule:: birdy.cli + :noindex: Using the Python library ======================== .. automodule:: birdy.client + :noindex: diff --git a/docs/source/conf.py b/docs/source/conf.py index e5c2736..329183a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -32,6 +32,11 @@ "sphinx.ext.todo", "sphinx.ext.viewcode", "sphinx.ext.autodoc", + "sphinx.ext.autosectionlabel", + "sphinx.ext.napoleon", + "sphinx.ext.todo", + "sphinx_codeautolink", + "sphinx_copybutton", ] autoapi_type = "python" @@ -39,6 +44,9 @@ autoapi_file_pattern = "*.py" autoapi_options = ["members", "undoc-members", "private-members"] +autosectionlabel_prefix_document = True +autosectionlabel_maxdepth = 2 + # To avoid having to install these and burst memory limit on ReadTheDocs. autodoc_mock_imports = [ "click", @@ -86,7 +94,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" # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: @@ -96,7 +104,16 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] +exclude_patterns = [ + "_build", + "Thumbs.db", + ".DS_Store", + "owslib-esgfwps.ipynb", + # Undocumented notebooks + "rook-demo.ipynb", + "twitcher-c3s-magic-demo.ipynb", + "twitcher-magic-cexp-demo.ipynb", +] # The reST default role (used for this markup: `text`) to use for all # documents. diff --git a/docs/source/index.rst b/docs/source/index.rst index 11cbd64..c5026cb 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -8,3 +8,10 @@ development api changes + +Modules + +.. toctree:: + :maxdepth: 1 + + apidoc/modules diff --git a/environment-docs.yml b/environment-docs.yml index 420dbfc..a328507 100644 --- a/environment-docs.yml +++ b/environment-docs.yml @@ -6,4 +6,6 @@ channels: dependencies: - ipython - nbsphinx - - sphinx + - sphinx >=7.0.0 + - sphinx-codeautolink >=0.15.0 + - sphinx-copybutton >=0.5.2 diff --git a/requirements_dev.txt b/requirements_dev.txt index 96b9c67..d745ee4 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,18 +1,19 @@ -black>=20.8b1 +black>=24.2.0 +build>=1.0.0 bumpversion>=0.5.3 coverage>=4.5.1 -flake8>=3.8.4 +flake8>=7.0 ipykernel nbconvert -nbsphinx>=0.7.0 -nbval>=0.9.6 +nbsphinx >=0.7.0 +nbval >=0.9.6 pandoc -pip>=20.0 -pre-commit>=2.7.1 +pip >=23.3.0 +pre-commit>=3.6.2 pytest-runner>=4.2 pytest>=3.8.2 -sphinx>=1.8.1 -tox>=3.5.2 -twine>=1.12.1 -watchdog>=0.9.0 -wheel>=0.32.1 +sphinx-codeautolink>=0.15.0 +sphinx-copybutton>=0.5.2 +sphinx>=7.0.0 +twine>=4.0.0 +watchdog>=3.0.0 From 7026481e37d7663aac50820045aae5d1b1d2c28f Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Thu, 14 Mar 2024 17:07:58 -0400 Subject: [PATCH 03/18] WIP - Update MANIFEST.in to add files missing from packaged sources --- MANIFEST.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MANIFEST.in b/MANIFEST.in index 8a614f4..ced7b4f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -7,3 +7,5 @@ include LICENSE.txt include requirements.txt include requirements_dev.txt include requirements_extra.txt + +recursive-include birdy *.py From 11418ec93c598f9525c68c5d70838c5271601b30 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:46:01 -0400 Subject: [PATCH 04/18] move templates to top-level --- {birdy/templates => templates}/cmd.py.j2 | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {birdy/templates => templates}/cmd.py.j2 (100%) diff --git a/birdy/templates/cmd.py.j2 b/templates/cmd.py.j2 similarity index 100% rename from birdy/templates/cmd.py.j2 rename to templates/cmd.py.j2 From 146987e67be267fd8ad57d9750a8ae9814e73827 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:49:56 -0400 Subject: [PATCH 05/18] update module docstrings --- birdy/cli/__init__.py | 4 +++ birdy/client/__init__.py | 55 ++++++++++++++------------------- birdy/dependencies.py | 6 +++- birdy/ipyleafletwfs/__init__.py | 31 ++++++++++++++++++- 4 files changed, 62 insertions(+), 34 deletions(-) diff --git a/birdy/cli/__init__.py b/birdy/cli/__init__.py index 4f026b2..39384f2 100644 --- a/birdy/cli/__init__.py +++ b/birdy/cli/__init__.py @@ -1,4 +1,8 @@ +# noqa: D205, D400 """ +Birdy CLI module +================ + Birdy has a command line interface to interact with a Web Processing Service. Example diff --git a/birdy/client/__init__.py b/birdy/client/__init__.py index c6e0004..959485e 100644 --- a/birdy/client/__init__.py +++ b/birdy/client/__init__.py @@ -1,29 +1,25 @@ -"""WPSClient Class. +# noqa: D205, D400 +""" +WPSClient Class +=============== -The :class:`WPSClient` class aims to make working with WPS servers easy, -even without any prior knowledge of WPS. +The :class:`WPSClient` class aims to make working with WPS servers easy, even without any prior knowledge of WPS. -Calling the :class:`WPSClient` class creates an instance whose methods call -WPS processes. These methods are generated at runtime based on the -process description provided by the WPS server. Calling a function sends -an `execute` request to the server. The server response is parsed and -returned as a :class:`WPSExecution` instance, which includes information -about the job status, the progress percentage, the starting time, etc. The -actual output from the process are obtained by calling the `get` method. +Calling the :class:`WPSClient` class creates an instance whose methods call WPS processes. +These methods are generated at runtime based on the process description provided by the WPS server. +Calling a function sends an `execute` request to the server. The server response is parsed and +returned as a :class:`WPSExecution` instance, which includes information about the job status, the progress percentage, +the starting time, etc. The actual output from the process are obtained by calling the `get` method. The output is parsed to convert the outputs in native Python whenever possible. -`LiteralOutput` objects (string, float, integer, boolean) are automatically -converted to their native format. For `ComplexOutput`, the module can either -return a link to the output files stored on the server, or try to -convert the outputs to a Python object based on their mime type. This conversion -will occur with `get(asobj=True)`. So for example, if the mime type is -'application/json', the output would be a `dict`. - -Inputs to processes can be native Python types (string, float, int, date, datetime), -http links or local files. Local files can be transferred to a remote server by -including their content into the WPS request. Simply set the input to a valid path -or file object and the client will take care of reading and converting the file. +`LiteralOutput` objects (string, float, integer, boolean) are automatically converted to their native format. +For `ComplexOutput`, the module can either return a link to the output files stored on the server, +or try to convert the outputs to a Python object based on their mime type. This conversion will occur with +`get(asobj=True)`. So for example, if the mime type is 'application/json', the output would be a `dict`. +Inputs to processes can be native Python types (string, float, int, date, datetime), http links or local files. +Local files can be transferred to a remote server by including their content into the WPS request. +Simply set the input to a valid path or file object and the client will take care of reading and converting the file. Example ------- @@ -55,10 +51,8 @@ Authentication -------------- -If you want to connect to a server that requires authentication, the -:class:`WPSClient` class accepts an `auth` argument that -behaves exactly like in the popular `requests` module -(see `requests Authentication`_) +If you want to connect to a server that requires authentication, the :class:`WPSClient` class accepts +an `auth` argument that behaves exactly like in the popular `requests` module (see `requests Authentication`_) The simplest form of authentication is HTTP Basic Auth. Although wps processes are not commonly protected by this authentication method, @@ -69,11 +63,10 @@ >>> auth = HTTPBasicAuth('user', 'pass') >>> wps = WPSClient('http://www.example.com/wps', auth=auth) -Because any `requests`-compatible class is accepted, custom -authentication methods are implemented the same way as in `requests`. +Because any `requests`-compatible class is accepted, custom authentication methods are implemented +the same way as in `requests`. -For example, to connect to a magpie_ protected wps, you can use the -requests-magpie_ module:: +For example, to connect to a magpie_ protected wps, you can use the requests-magpie_ module:: >>> from birdy import WPSClient >>> from requests_magpie import MagpieAuth @@ -83,8 +76,7 @@ Output format ------------- -Birdy automatically manages process output to reflect it's default values or -Birdy's own defaults. +Birdy automatically manages process output to reflect its default values or Birdy's own defaults. However, it's possible to customize the output of a process. Each process has an input named ``output_formats``, that takes a dictionary as a parameter:: @@ -122,7 +114,6 @@ .. _requests Authentication: https://2.python-requests.org/en/master/user/authentication/ .. _magpie: https://github.com/ouranosinc/magpie .. _requests-magpie: https://github.com/ouranosinc/requests-magpie - """ from birdy.client.notebook import gui # noqa: F401 diff --git a/birdy/dependencies.py b/birdy/dependencies.py index 78c517a..0dd6d00 100644 --- a/birdy/dependencies.py +++ b/birdy/dependencies.py @@ -1,9 +1,13 @@ +# noqa: D205,D400 """ +Dependencies Module +=================== + Module for managing optional dependencies. Example usage:: - from birdy.dependencies import ipywidgets as widgets + >>> from birdy.dependencies import ipywidgets as widgets """ import warnings diff --git a/birdy/ipyleafletwfs/__init__.py b/birdy/ipyleafletwfs/__init__.py index 9fbfe55..66ffc2d 100644 --- a/birdy/ipyleafletwfs/__init__.py +++ b/birdy/ipyleafletwfs/__init__.py @@ -1,3 +1,32 @@ -# noqa: D104 +# noqa: D205,D400 +""" +IpyleafletWFS Module +==================== + +This module facilitates the use of a WFS service through the ipyleaflet module in jupyter notebooks. +It uses owslib to get a geojson out of a WFS service, and then creates an ipyleaflet GeoJSON layer with it. + +Dependencies +------------ + +Ipyleaflet and Ipywidgets dependencies are included in the requirements_extra.txt, at the root of this repository. +To install:: + + $ pip install -r requirements_extra.txt + +Use +--- + +This module is to be used inside a jupyter notebook, either with a standard server or through vscode/pycharm. +There are notebook examples which show how to use this module and what can be done with it. + +The WFS request is filtered by the extent of the visible map, to make large layers easier to work with. +Using the on-map 'Refresh WFS layer' button will make a new request for the current extent. + +.. warning:: + WFS requests and GeoJSON layers are costly operations to process and render. + Trying to load lake layers at the nationwide extent may take a long time and probably crash. + The more dense and complex the layer, the more zoomed-in the map extent should be. +""" from .base import IpyleafletWFS # noqa: F401 From faaf7971204eb2bc83d76c617ed50fce897f5b95 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:50:48 -0400 Subject: [PATCH 06/18] documentation structure adjustment, raise minimum sphinx to v7.0 --- docs/source/conf.py | 10 +++++----- docs/source/index.rst | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 329183a..4946379 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -22,7 +22,7 @@ # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -needs_sphinx = "1.8" +needs_sphinx = "7.0" # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom @@ -108,11 +108,11 @@ "_build", "Thumbs.db", ".DS_Store", - "owslib-esgfwps.ipynb", # Undocumented notebooks - "rook-demo.ipynb", - "twitcher-c3s-magic-demo.ipynb", - "twitcher-magic-cexp-demo.ipynb", + "notebooks/examples/owslib-esgfwps.ipynb", + "notebooks/examples/rook-demo.ipynb", + "notebooks/examples/twitcher-c3s-magic-demo.ipynb", + "notebooks/examples/twitcher-magic-cexp-demo.ipynb", ] # The reST default role (used for this markup: `text`) to use for all diff --git a/docs/source/index.rst b/docs/source/index.rst index c5026cb..7790f13 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -9,9 +9,7 @@ api changes -Modules - .. toctree:: - :maxdepth: 1 + :maxdepth: 3 apidoc/modules From c6072c00922fa2cfe46ccab59fc0a52e4da97852 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:51:59 -0400 Subject: [PATCH 07/18] tests and docs should not be installed as sub-packages as wheel but should be fully available in source distribution --- MANIFEST.in | 17 ++++++++++++----- setup.py | 10 +++++++--- tests/__init__.py | 1 - 3 files changed, 19 insertions(+), 9 deletions(-) delete mode 100644 tests/__init__.py diff --git a/MANIFEST.in b/MANIFEST.in index ced7b4f..bb4fe79 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,11 +1,18 @@ -include *.rst -graft birdy -global-exclude __pycache__ -global-exclude *.py[co] +graph birdy +include *.rst include LICENSE.txt include requirements.txt include requirements_dev.txt include requirements_extra.txt +include setup.cfg +include docs Makefile make.bat + +recursive-include docs/source Makefile make.bat *.rst *.py *.ipynb *.svg *.ico *.txt *.yml *.cfg *.md +recursive-include tests *.py *.nc *.tif *.geojson *.xml -recursive-include birdy *.py +recursive-exclude * __pycache__ +recursive-exclude * *.py[co] +recursive-exclude * *.ipynb_checkpoints +recursive-exclude docs/build * +recursive-exclude docs/source/apidoc *.rst diff --git a/setup.py b/setup.py index 6b76cc5..2b0cffb 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import re from pathlib import Path -from setuptools import find_packages, setup +from setuptools import find_namespace_packages, setup def parse_reqs(file): @@ -62,12 +62,16 @@ def parse_reqs(file): license="Apache License v2.0", # This qualifier can be used to selectively exclude Python versions - # in this case early Python 2 and 3 releases - python_requires=">=3.6.0", - packages=find_packages(), + python_requires=">=3.9.0", + packages=find_namespace_packages(exclude=["docs", "docs.*", "tests", "tests.*"]), include_package_data=True, + package_data={ + "birdy": ["ipyleafletwps/examples/*.ipynb"], + }, install_requires=requirements, extras_require={ "dev": dev_requirements, # pip install ".[dev]" }, entry_points={"console_scripts": ["birdy=birdy.cli.run:cli"]}, + zip_safe=False, ) diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index 6e03199..0000000 --- a/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# noqa: D104 From f5b99ec2b9ccaa06387689ab28bbfcf669fd684d Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:52:31 -0400 Subject: [PATCH 08/18] documentation fixes --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b75973d..dc86307 100644 --- a/Makefile +++ b/Makefile @@ -39,8 +39,8 @@ clean-build: ## remove build artifacts find . -name '*.egg' -exec rm -f {} + clean-docs: ## remove docs artifacts - rm -f docs/apidoc/birdy*.rst - rm -f docs/apidoc/modules.rst + rm -f docs/source/apidoc/birdy*.rst + rm -f docs/source/apidoc/modules.rst $(MAKE) -C docs clean clean-pyc: ## remove Python file artifacts @@ -79,7 +79,7 @@ coverage: ## check code coverage quickly with the default Python autodoc: clean-docs ## create sphinx-apidoc files mkdir -p docs/source/apidoc/ - sphinx-apidoc -o docs/source/apidoc/ --private --module-first birdy + sphinx-apidoc -o docs/source/apidoc/ --private --module-first --separate birdy docs: autodoc ## generate Sphinx HTML documentation, including API docs $(MAKE) -C docs html From 81fe03227e5a663691cefe8e1a9fada81c7deeea Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:57:23 -0400 Subject: [PATCH 09/18] add install steps to GitHub workflows --- .github/workflows/main.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6578150..d4d7b0b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -52,6 +52,13 @@ jobs: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi if [ -f requirements_extra.txt ]; then pip install -r requirements_extra.txt; fi + - name: Install Birdy 🐦 + run: | + python pip install --editable . + - name: Check dependencies + run: | + python -m pip list + python -m pip check - name: Build docs 🏗️ run: | make docs @@ -80,6 +87,13 @@ jobs: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi if [ -f requirements_extra.txt ]; then pip install -r requirements_extra.txt; fi + - name: Install Birdy 🐦 + run: | + python pip install --editable . + - name: Check dependencies + run: | + python -m pip list + python -m pip check - name: Test with pytest ⚙️ run: | make test From 4fbbe4e18f2d8f3fbbf515a63c7358292f070ad1 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:59:04 -0400 Subject: [PATCH 10/18] -m --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d4d7b0b..c4c3bc5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,7 +54,7 @@ jobs: if [ -f requirements_extra.txt ]; then pip install -r requirements_extra.txt; fi - name: Install Birdy 🐦 run: | - python pip install --editable . + python -m pip install --editable . - name: Check dependencies run: | python -m pip list @@ -89,7 +89,7 @@ jobs: if [ -f requirements_extra.txt ]; then pip install -r requirements_extra.txt; fi - name: Install Birdy 🐦 run: | - python pip install --editable . + python -m pip install --editable . - name: Check dependencies run: | python -m pip list From 6a17a3d38acac117bc13a63c5739eaef4af044ea Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Mar 2024 12:08:24 -0400 Subject: [PATCH 11/18] remove obsolete python pandoc package --- requirements_dev.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index d745ee4..8718c74 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -7,7 +7,6 @@ ipykernel nbconvert nbsphinx >=0.7.0 nbval >=0.9.6 -pandoc pip >=23.3.0 pre-commit>=3.6.2 pytest-runner>=4.2 From 6db4b7610a76423dc1f7cdd3c60c349daa754e91 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Mar 2024 12:08:44 -0400 Subject: [PATCH 12/18] undo move of templates outside of package --- {templates => birdy/templates}/cmd.py.j2 | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {templates => birdy/templates}/cmd.py.j2 (100%) diff --git a/templates/cmd.py.j2 b/birdy/templates/cmd.py.j2 similarity index 100% rename from templates/cmd.py.j2 rename to birdy/templates/cmd.py.j2 From 4bccaa9b4013b86fc7a60109b5600553307a5183 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Mar 2024 12:09:20 -0400 Subject: [PATCH 13/18] relative imports are now absolute imports in tests --- tests/test_cli.py | 3 +-- tests/test_client.py | 6 +----- tests/test_converters.py | 3 +-- tests/test_utils.py | 5 ++--- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 55bf659..069264d 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -2,11 +2,10 @@ import pytest from click.testing import CliRunner +from common import EMU_CAPS_XML, URL_EMU import birdy.cli.run -from .common import EMU_CAPS_XML, URL_EMU - cli = birdy.cli.run.cli cli.url = URL_EMU cli.caps_xml = EMU_CAPS_XML diff --git a/tests/test_client.py b/tests/test_client.py index 6c958b6..e67df71 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -7,17 +7,13 @@ import owslib.wps import pytest +from common import EMU_CAPS_XML, EMU_DESC_XML, URL_EMU, resource_file from birdy import WPSClient from birdy.client import nb_form from birdy.client.base import sort_inputs_key from birdy.client.utils import is_embedded_in_request -from .common import EMU_CAPS_XML, EMU_DESC_XML, URL_EMU, resource_file - -# from owslib import crs - - # 52 north WPS url_52n = "http://geoprocessing.demo.52north.org:8080/wps/WebProcessingService?service=WPS&version=1.0.0&request=GetCapabilities" # noqa: E501 diff --git a/tests/test_converters.py b/tests/test_converters.py index fd4c229..0acca1b 100644 --- a/tests/test_converters.py +++ b/tests/test_converters.py @@ -5,11 +5,10 @@ import tempfile import pytest +from common import resource_file from birdy.client import converters -from .common import resource_file - def test_all_subclasses(): # noqa: D103 c = converters.all_subclasses(converters.BaseConverter) diff --git a/tests/test_utils.py b/tests/test_utils.py index 312d681..2a6fc89 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,13 +1,12 @@ -# noqa +# noqa: D100 from pathlib import Path import pytest +from common import resource_file from birdy import utils -from .common import resource_file - def test_is_url(): # noqa: D103 assert utils.is_url("http://localhost:5000/wps") From 74023d63dbffe927ee4d4cd7708ca9513d4282f7 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Mar 2024 12:14:34 -0400 Subject: [PATCH 14/18] add requirements_extra to pip installation method --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index 2b0cffb..6bb0fe8 100644 --- a/setup.py +++ b/setup.py @@ -33,6 +33,7 @@ def parse_reqs(file): requirements = parse_reqs("requirements.txt") dev_requirements = parse_reqs("requirements_dev.txt") +extra_requirements = parse_reqs("requirements_extra.txt") classifiers = [ "Development Status :: 4 - Beta", @@ -71,6 +72,7 @@ def parse_reqs(file): install_requires=requirements, extras_require={ "dev": dev_requirements, # pip install ".[dev]" + "extra": extra_requirements, # pip install ".[extra]" }, entry_points={"console_scripts": ["birdy=birdy.cli.run:cli"]}, zip_safe=False, From 5f7d93f8cbbd59219ffe2d00973eb276ba5415c1 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Mar 2024 12:28:38 -0400 Subject: [PATCH 15/18] run sphinx-apidoc on ReadTheDocs --- .readthedocs.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 5d2589c..c2f27db 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -6,15 +6,18 @@ version: 2 sphinx: - configuration: docs/source/conf.py + configuration: docs/source/conf.py build: os: ubuntu-22.04 tools: python: "mambaforge-22.9" + jobs: + pre_build: + - sphinx-apidoc -o docs/source/apidoc/ --private --module-first --separate birdy # Optionally build your docs in additional formats such as PDF and ePub formats: all conda: - environment: environment-docs.yml + environment: environment-docs.yml From 7636fd3178100baefa4ea7f9334d2f0c68f2a4f3 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Mar 2024 12:50:29 -0400 Subject: [PATCH 16/18] add build documentation --- docs/source/development.rst | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/docs/source/development.rst b/docs/source/development.rst index f952795..5a6f973 100644 --- a/docs/source/development.rst +++ b/docs/source/development.rst @@ -9,19 +9,19 @@ Get Started! Check out code from the birdy GitHub repo and start the installation:: - $ git clone https://github.com/bird-house/birdy.git - $ cd birdy - $ conda env create -f environment.yml - $ pip install --editable . + $ git clone https://github.com/bird-house/birdy.git + $ cd birdy + $ conda env create -f environment.yml + $ pip install --editable . Install additional dependencies:: - $ pip install -r requirements_dev.txt + $ pip install -r requirements_dev.txt When you're done making changes, check that your changes pass `black`, `flake8` and the tests:: - $ black birdy tests $ flake8 birdy tests + $ black --check --target-version py39 birdy tests $ pytest -v tests Or use the Makefile:: @@ -46,7 +46,7 @@ Write Documentation You can find the documentation in the `docs/source` folder. To generate the Sphinx documentation locally you can use the `Makefile`:: - $ make docs + $ make docs Bump a new version =================== @@ -64,6 +64,19 @@ See the bumpversion_ documentation for details. .. _bumpversion: https://pypi.org/project/bumpversion/ +Build a source distribution and wheel +===================================== + +To build a source distribution (`.sdist`) and wheel (`.whl`) locally, run the following command:: + + $ python -m build + +This will create a `dist` folder with the source distribution and wheel. + +See the `build`_ documentation for details. + +.. _build: https://build.pypa.io/en/latest/ + Release a new version ===================== From b2ed896c98836d5d98e03d933a98e9ef595410ad Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 18 Mar 2024 10:42:52 -0400 Subject: [PATCH 17/18] Update MANIFEST.in --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index bb4fe79..2670216 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -graph birdy +graft birdy include *.rst include LICENSE.txt From 518d1ce127eb4e31e367de2221b0a74f40159645 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 18 Mar 2024 11:21:54 -0400 Subject: [PATCH 18/18] update CHANGES.rst --- CHANGES.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 74b1c3f..0334599 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,21 @@ Change History ************** +v0.8.6 (2024-xx-xx) +=================== + +Changes: + +* Restructure the package so that the wheel does not install the testing and docs as non-importable packages. +* Ensure that data required to run tests and build docs is present in the source distribution (via `Manifest.in` changes). +* Documentation now includes a `sphinx-apidoc`-based listing of all installed modules and functions +* Add `sphinx-copybutton` and `sphinx-codeautolink` in order to increase the usefulness of code-blocks in the example documentation (copying of code blocks and ability to click on `birdy` objects and go straight to the documentation entry for the object). +* All documentation build warnings have been addressed. +* Add the `birdy[extra]` pip install recipe to be able to install all extras needed more directly. +* Raise the minimum Python required to 3.9 in the setup block. +* Remove the Python package for `pandoc` (unmaintained). +* Add a documentation entry on using `build` to build the documentation. + 0.8.5 (2024-03-14) ==================