Skip to content

Commit 76dfa35

Browse files
authored
Merge pull request #245 from bird-house/packaging-fixes
Packaging fixes
2 parents dfe8f2d + 518d1ce commit 76dfa35

24 files changed

+208
-94
lines changed

.github/workflows/main.yml

+14
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ jobs:
5252
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
5353
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
5454
if [ -f requirements_extra.txt ]; then pip install -r requirements_extra.txt; fi
55+
- name: Install Birdy 🐦
56+
run: |
57+
python -m pip install --editable .
58+
- name: Check dependencies
59+
run: |
60+
python -m pip list
61+
python -m pip check
5562
- name: Build docs 🏗️
5663
run: |
5764
make docs
@@ -80,6 +87,13 @@ jobs:
8087
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
8188
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
8289
if [ -f requirements_extra.txt ]; then pip install -r requirements_extra.txt; fi
90+
- name: Install Birdy 🐦
91+
run: |
92+
python -m pip install --editable .
93+
- name: Check dependencies
94+
run: |
95+
python -m pip list
96+
python -m pip check
8397
- name: Test with pytest ⚙️
8498
run: |
8599
make test

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ docs/make.bat
6565
docs/doctrees/
6666
docs/html/
6767
docs/build/
68+
docs/source/apidoc
6869

6970
# External Sources
7071
#src/external

.pre-commit-config.yaml

+10-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repos:
66
rev: v3.15.1
77
hooks:
88
- id: pyupgrade
9-
args: ['--py39-plus']
9+
args: [ '--py39-plus' ]
1010
- repo: https://github.com/pre-commit/pre-commit-hooks
1111
rev: v4.5.0
1212
hooks:
@@ -19,11 +19,6 @@ repos:
1919
hooks:
2020
- id: nbstripout
2121
files: '.ipynb'
22-
- repo: https://github.com/pycqa/flake8
23-
rev: 7.0.0
24-
hooks:
25-
- id: flake8
26-
args: [ '--config=setup.cfg' ]
2722
- repo: https://github.com/psf/black
2823
rev: 24.2.0
2924
hooks:
@@ -34,15 +29,20 @@ repos:
3429
hooks:
3530
- id: isort
3631
args: [ '--profile=black' ]
32+
- repo: https://github.com/pycqa/flake8
33+
rev: 7.0.0
34+
hooks:
35+
- id: flake8
36+
args: [ '--config=setup.cfg' ]
3737
- repo: https://github.com/nbQA-dev/nbQA
3838
rev: 1.8.4
3939
hooks:
40-
- id: nbqa-black
41-
args: [ '--target-version=py37' ]
42-
additional_dependencies: [ 'black==24.2.0' ]
4340
- id: nbqa-pyupgrade
44-
args: [ '--py37-plus' ]
41+
args: [ '--py39-plus' ]
4542
additional_dependencies: [ 'pyupgrade==v3.15.1' ]
43+
- id: nbqa-black
44+
args: [ '--target-version=py39' ]
45+
additional_dependencies: [ 'black==24.2.0' ]
4646
- id: nbqa-isort
4747
args: [ '--profile=black' ]
4848
additional_dependencies: [ 'isort==5.13.2' ]

.readthedocs.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@
66
version: 2
77

88
sphinx:
9-
configuration: docs/source/conf.py
9+
configuration: docs/source/conf.py
1010

1111
build:
1212
os: ubuntu-22.04
1313
tools:
1414
python: "mambaforge-22.9"
15+
jobs:
16+
pre_build:
17+
- sphinx-apidoc -o docs/source/apidoc/ --private --module-first --separate birdy
1518

1619
# Optionally build your docs in additional formats such as PDF and ePub
1720
formats: all
1821

1922
conda:
20-
environment: environment-docs.yml
23+
environment: environment-docs.yml

CHANGES.rst

+15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
Change History
22
**************
33

4+
v0.8.6 (2024-xx-xx)
5+
===================
6+
7+
Changes:
8+
9+
* Restructure the package so that the wheel does not install the testing and docs as non-importable packages.
10+
* Ensure that data required to run tests and build docs is present in the source distribution (via `Manifest.in` changes).
11+
* Documentation now includes a `sphinx-apidoc`-based listing of all installed modules and functions
12+
* 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).
13+
* All documentation build warnings have been addressed.
14+
* Add the `birdy[extra]` pip install recipe to be able to install all extras needed more directly.
15+
* Raise the minimum Python required to 3.9 in the setup block.
16+
* Remove the Python package for `pandoc` (unmaintained).
17+
* Add a documentation entry on using `build` to build the documentation.
18+
419
0.8.5 (2024-03-14)
520
==================
621

MANIFEST.in

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
include *.rst
21
graft birdy
3-
global-exclude __pycache__
4-
global-exclude *.py[co]
52

3+
include *.rst
64
include LICENSE.txt
75
include requirements.txt
86
include requirements_dev.txt
97
include requirements_extra.txt
8+
include setup.cfg
9+
include docs Makefile make.bat
10+
11+
recursive-include docs/source Makefile make.bat *.rst *.py *.ipynb *.svg *.ico *.txt *.yml *.cfg *.md
12+
recursive-include tests *.py *.nc *.tif *.geojson *.xml
13+
14+
recursive-exclude * __pycache__
15+
recursive-exclude * *.py[co]
16+
recursive-exclude * *.ipynb_checkpoints
17+
recursive-exclude docs/build *
18+
recursive-exclude docs/source/apidoc *.rst

Makefile

+10-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ clean-build: ## remove build artifacts
3838
find . -name '*.egg-info' -exec rm -fr {} +
3939
find . -name '*.egg' -exec rm -f {} +
4040

41+
clean-docs: ## remove docs artifacts
42+
rm -f docs/source/apidoc/birdy*.rst
43+
rm -f docs/source/apidoc/modules.rst
44+
$(MAKE) -C docs clean
45+
4146
clean-pyc: ## remove Python file artifacts
4247
find . -name '*.pyc' -exec rm -f {} +
4348
find . -name '*.pyo' -exec rm -f {} +
@@ -72,8 +77,11 @@ coverage: ## check code coverage quickly with the default Python
7277
coverage html
7378
$(BROWSER) htmlcov/index.html
7479

75-
docs: ## generate Sphinx HTML documentation, including API docs
76-
$(MAKE) -C docs clean
80+
autodoc: clean-docs ## create sphinx-apidoc files
81+
mkdir -p docs/source/apidoc/
82+
sphinx-apidoc -o docs/source/apidoc/ --private --module-first --separate birdy
83+
84+
docs: autodoc ## generate Sphinx HTML documentation, including API docs
7785
$(MAKE) -C docs html
7886

7987
servedocs: docs ## compile the docs watching for changes

birdy/cli/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
# noqa: D205, D400
12
"""
3+
Birdy CLI module
4+
================
5+
26
Birdy has a command line interface to interact with a Web Processing Service.
37
48
Example

birdy/client/__init__.py

+24-33
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
1-
"""WPSClient Class.
1+
# noqa: D205, D400
2+
"""
3+
WPSClient Class
4+
===============
25
3-
The :class:`WPSClient` class aims to make working with WPS servers easy,
4-
even without any prior knowledge of WPS.
6+
The :class:`WPSClient` class aims to make working with WPS servers easy, even without any prior knowledge of WPS.
57
6-
Calling the :class:`WPSClient` class creates an instance whose methods call
7-
WPS processes. These methods are generated at runtime based on the
8-
process description provided by the WPS server. Calling a function sends
9-
an `execute` request to the server. The server response is parsed and
10-
returned as a :class:`WPSExecution` instance, which includes information
11-
about the job status, the progress percentage, the starting time, etc. The
12-
actual output from the process are obtained by calling the `get` method.
8+
Calling the :class:`WPSClient` class creates an instance whose methods call WPS processes.
9+
These methods are generated at runtime based on the process description provided by the WPS server.
10+
Calling a function sends an `execute` request to the server. The server response is parsed and
11+
returned as a :class:`WPSExecution` instance, which includes information about the job status, the progress percentage,
12+
the starting time, etc. The actual output from the process are obtained by calling the `get` method.
1313
1414
The output is parsed to convert the outputs in native Python whenever possible.
15-
`LiteralOutput` objects (string, float, integer, boolean) are automatically
16-
converted to their native format. For `ComplexOutput`, the module can either
17-
return a link to the output files stored on the server, or try to
18-
convert the outputs to a Python object based on their mime type. This conversion
19-
will occur with `get(asobj=True)`. So for example, if the mime type is
20-
'application/json', the output would be a `dict`.
21-
22-
Inputs to processes can be native Python types (string, float, int, date, datetime),
23-
http links or local files. Local files can be transferred to a remote server by
24-
including their content into the WPS request. Simply set the input to a valid path
25-
or file object and the client will take care of reading and converting the file.
15+
`LiteralOutput` objects (string, float, integer, boolean) are automatically converted to their native format.
16+
For `ComplexOutput`, the module can either return a link to the output files stored on the server,
17+
or try to convert the outputs to a Python object based on their mime type. This conversion will occur with
18+
`get(asobj=True)`. So for example, if the mime type is 'application/json', the output would be a `dict`.
2619
20+
Inputs to processes can be native Python types (string, float, int, date, datetime), http links or local files.
21+
Local files can be transferred to a remote server by including their content into the WPS request.
22+
Simply set the input to a valid path or file object and the client will take care of reading and converting the file.
2723
2824
Example
2925
-------
@@ -55,10 +51,8 @@
5551
5652
Authentication
5753
--------------
58-
If you want to connect to a server that requires authentication, the
59-
:class:`WPSClient` class accepts an `auth` argument that
60-
behaves exactly like in the popular `requests` module
61-
(see `requests Authentication`_)
54+
If you want to connect to a server that requires authentication, the :class:`WPSClient` class accepts
55+
an `auth` argument that behaves exactly like in the popular `requests` module (see `requests Authentication`_)
6256
6357
The simplest form of authentication is HTTP Basic Auth. Although
6458
wps processes are not commonly protected by this authentication method,
@@ -69,11 +63,10 @@
6963
>>> auth = HTTPBasicAuth('user', 'pass')
7064
>>> wps = WPSClient('http://www.example.com/wps', auth=auth)
7165
72-
Because any `requests`-compatible class is accepted, custom
73-
authentication methods are implemented the same way as in `requests`.
66+
Because any `requests`-compatible class is accepted, custom authentication methods are implemented
67+
the same way as in `requests`.
7468
75-
For example, to connect to a magpie_ protected wps, you can use the
76-
requests-magpie_ module::
69+
For example, to connect to a magpie_ protected wps, you can use the requests-magpie_ module::
7770
7871
>>> from birdy import WPSClient
7972
>>> from requests_magpie import MagpieAuth
@@ -83,11 +76,10 @@
8376
Output format
8477
-------------
8578
86-
Birdy automatically manages process output to reflect it's default values or
87-
Birdy's own defaults.
79+
Birdy automatically manages process output to reflect its default values or Birdy's own defaults.
8880
8981
However, it's possible to customize the output of a process. Each process has an input
90-
named ``output_formats`, that takes a dictionary as a parameter::
82+
named ``output_formats``, that takes a dictionary as a parameter::
9183
9284
# example format = {
9385
# 'output_identifier': {
@@ -122,7 +114,6 @@
122114
.. _requests Authentication: https://2.python-requests.org/en/master/user/authentication/
123115
.. _magpie: https://github.com/ouranosinc/magpie
124116
.. _requests-magpie: https://github.com/ouranosinc/requests-magpie
125-
126117
"""
127118

128119
from birdy.client.notebook import gui # noqa: F401

birdy/dependencies.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
# noqa: D205,D400
12
"""
3+
Dependencies Module
4+
===================
5+
26
Module for managing optional dependencies.
37
48
Example usage::
59
6-
from birdy.dependencies import ipywidgets as widgets
10+
>>> from birdy.dependencies import ipywidgets as widgets
711
"""
812

913
import warnings

birdy/ipyleafletwfs/__init__.py

+30-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1-
# noqa: D104
1+
# noqa: D205,D400
2+
"""
3+
IpyleafletWFS Module
4+
====================
5+
6+
This module facilitates the use of a WFS service through the ipyleaflet module in jupyter notebooks.
7+
It uses owslib to get a geojson out of a WFS service, and then creates an ipyleaflet GeoJSON layer with it.
8+
9+
Dependencies
10+
------------
11+
12+
Ipyleaflet and Ipywidgets dependencies are included in the requirements_extra.txt, at the root of this repository.
13+
To install::
14+
15+
$ pip install -r requirements_extra.txt
16+
17+
Use
18+
---
19+
20+
This module is to be used inside a jupyter notebook, either with a standard server or through vscode/pycharm.
21+
There are notebook examples which show how to use this module and what can be done with it.
22+
23+
The WFS request is filtered by the extent of the visible map, to make large layers easier to work with.
24+
Using the on-map 'Refresh WFS layer' button will make a new request for the current extent.
25+
26+
.. warning::
27+
WFS requests and GeoJSON layers are costly operations to process and render.
28+
Trying to load lake layers at the nationwide extent may take a long time and probably crash.
29+
The more dense and complex the layer, the more zoomed-in the map extent should be.
30+
"""
231

332
from .base import IpyleafletWFS # noqa: F401

birdy/utils.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,11 @@ def is_url(url):
4444

4545

4646
def is_opendap_url(url):
47-
"""
48-
Check if a provided url is an OpenDAP url.
47+
"""Check if a provided url is an OpenDAP url.
4948
5049
The DAP Standard specifies that a specific tag must be included in the
5150
Content-Description header of every request. This tag is one of:
52-
"dods-dds" | "dods-das" | "dods-data" | "dods-error"
51+
"dods-dds" | "dods-das" | "dods-data" | "dods-error"
5352
5453
So we can check if the header starts with `dods`.
5554

docs/source/api.rst

+2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ Using the command line
1212
======================
1313

1414
.. automodule:: birdy.cli
15+
:noindex:
1516

1617
Using the Python library
1718
========================
1819

1920
.. automodule:: birdy.client
21+
:noindex:

0 commit comments

Comments
 (0)