Skip to content

Commit b455a94

Browse files
authored
Updated documentation to include release instructions, plus minor formatting updates (#502)
* set column width in tables, for use in latex * added title clearpage * Added instructions on building docs and running doctests * changed the size of certain graphics * added new sections to index * changed RTD to github actions * changed graphic size * updated apidocs for timeoptions * added release date * added software release instructions * minor update to docs * Updated release instructions * Updated release instructions * added library section to the latex docs * Removed version number from html title
1 parent 01ae740 commit b455a94

14 files changed

+192
-48
lines changed

documentation/conf.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def setup(app):
236236

237237
# The name for this set of Sphinx documents. If None, it defaults to
238238
# "<project> v<release> documentation".
239-
#html_title = None
239+
html_title = "WNTR documentation"
240240

241241
# A shorter title for the navigation bar. Default is the same as html_title.
242242
#html_short_title = None
@@ -336,6 +336,11 @@ def setup(app):
336336
# The font size ('10pt', '11pt' or '12pt').
337337
'pointsize': '10pt',
338338

339+
'maketitle': r'''
340+
\sphinxmaketitle
341+
\clearpage
342+
''',
343+
339344
# Additional stuff for the LaTeX preamble.
340345
'preamble': r'''
341346
\usepackage{tcolorbox}

documentation/developers.rst

+139-11
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,39 @@ WNTR is also tested on private servers using several large water utility network
4848

4949
Documentation
5050
---------------------
51-
WNTR includes a user manual that is built using the Read the Docs service.
51+
WNTR includes a user manual that is built using GitHub Actions.
5252
The user manual is automatically rebuilt each time changes are made to the code.
5353
The documentation is publicly available at https://usepa.github.io/WNTR/.
5454
The user manual includes an overview, installation instructions, simple examples,
5555
and information on the code structure and functions.
5656
WNTR includes documentation on the API for all
57-
public functions, methods, and classes.
57+
public functions, methods, and classes using NumPy Style Python Docstrings.
5858
New content is marked `Draft`.
5959
Python documentation string formatting can be found at
6060
https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html
6161

62-
To build the documentation locally, run the following command in a
63-
command line/PowerShell prompt from the documentation directory::
62+
* To build HTML files of the documentation locally, run the following command in a
63+
command line/PowerShell prompt from the documentation directory::
6464

65-
make html
65+
make html
6666

67-
HTML files are created in the ``documentation/_build/html`` directory.
68-
Open ``index.html`` to view the documentation.
67+
HTML files are created in the ``documentation/_build/html`` directory.
68+
Open ``index.html`` to view the HTML documentation in a browser.
69+
70+
* To build Latex files of the documentation locally, run the following command in a
71+
command line/PowerShell prompt from the documentation directory::
72+
73+
make latex
74+
75+
Latex files are created in the ``documentation/_build/latex`` directory.
76+
Copy all the files into Overleaf and build wntr.tex to create a PDF.
77+
78+
* To run the doctests locally, run the following command in a
79+
command line/PowerShell prompt from the documentation directory::
80+
81+
pytest --doctest-glob="*.rst" .
82+
83+
Note that this also creates graphics used in the documentation.
6984

7085
Examples
7186
---------------------
@@ -92,18 +107,131 @@ by opening a new issue on https://github.com/USEPA/WNTR/issues.
92107

93108
Pull requests must meet the following minimum requirements to be included in WNTR:
94109

95-
* Code is expected to be documented using Read the Docs.
110+
* Code is expected to be documented using NumPy Style Python Docstrings.
96111

97112
* Code is expected have sufficient tests. `Sufficient` is judged by the strength of the test and code coverage. An 80% code coverage is recommended.
98113

99114
* Large files (> 1Mb) will not be committed to the repository without prior approval.
100115

101116
* Network model files will not be duplicated in the repository. Network files are stored in examples/network and wntr/tests/networks_for_testing only.
102117

118+
Software release
119+
------------------
120+
The software release process requires administrative privileges and knowledge about the external services used in the release process.
121+
The release creates wheels that are available on PyPI and conda-forge.
122+
A release candidate (with version number rc1, rc2, ...) should be created prior to an official release.
123+
Changes to WNTR (Steps 1, 2, and 12) can be completed using pull requests, or through direct edits on GitHub.
124+
Since the release depends on external services, the instructions below often need slight modification between release cycles.
125+
126+
1. **Check the version number**: The version number is defined in WNTR/wntr/__init__.py.
127+
The version number is denoted <version> in the instructions below and is in X.Y.Z format, where X is the major release number,
128+
Y is the minor release number, and Z is a bug fix release number.
129+
130+
If creating a release candidate, include rc1, rc2, etc at the end of the version number.
131+
132+
2. **Check or create release notes**: The release notes are in WNTR/documentation/whatsnew/<version>.rst
133+
(see Step 3 to autogenerate release notes) and make sure the
134+
<version>.rst file is included in WNTR\documentation\whatsnew.rst.
135+
Update the release date in <version>.rst.
136+
137+
3. **Create a new release on GitHub**: Go to https://github.com/USEPA/WNTR/releases and select “Draft a new release”.
138+
Create a new tag (named <version>) and title (“Version <version> Release”).
139+
Autogenerate release notes by selecting “Generate release notes”, clean up the text to have consistent language.
140+
The same text can go in <version>.rst.
141+
142+
If this is a release candidate, select "Set as a pre-release", otherwise select "Set as the latest release".
143+
Select "Publish release".
144+
145+
4. **Push wheels to PyPI**: The new release will initiate GitHub Actions to run workflows,
146+
this includes a step to push wheels to PyPI.
147+
148+
If the wheels are not pushed to PyPI (because of the PyPI token or some other reason),
149+
download the artifact from the release (the file is named wntr-<version>.zip), unzip the file and use https://github.com/pypa/twine
150+
to upload the files to PyPI. See instructions at https://twine.readthedocs.io/.
151+
152+
5. **Create a personal fork of the conda-forge wntr-feedstock**:
153+
The conda-forge wntr-feedstock is located at https://github.com/conda-forge/wntr-feedstock.
154+
The personal fork will be named https://github.com/<username>/wntr-feedstock,
155+
where <username> is your github username.
156+
157+
6. **Clone the wntr-feedstock and create a new branch**: Clone your personal fork of the wntr-feedstock and checkout a new branch.
158+
For examples, the <branchname> could be named "release-<version>". The following commands clone wntr-feedstock and create a branch::
159+
160+
git clone https://github.com/<username>/wntr-feedstock.git
161+
cd wntr-feedstock
162+
git checkout –b <branchname>
163+
164+
7. **Update the feedstock recipe**: The feedstock recipe is stored in wntr-feedstock/recipe/meta.yaml.
165+
The following steps are needed to update the file.
166+
167+
a. Update the version number in ``{% set version = <version> %}``
168+
169+
b. Update the source url to point to correct version in ``url: https://github.com/USEPA/WNTR/archive/<version>.zip``
170+
171+
c. Update the SHA256 key in ``sha256: 78aa135219...``.
172+
Generate the SHA256 key for the source code archive using openssl.
173+
More info can be found at http://conda-forge.org/docs/maintainer/adding_pkgs.html or in the example
174+
recipe at https://github.com/conda-forge/staged-recipes/blob/master/recipes/example/meta.yaml.
175+
176+
Download the zip by copying and pasting the following address into a browser window::
177+
178+
https://github.com/USEPA/WNTR/archive/<version>.zip
179+
180+
You should now have a downloaded file named WNTR-<version>.zip.
181+
Generate the SHA256 key by running the following command, in the same folder as the file::
182+
183+
openssl sha256 WNTR-<version>.zip
184+
185+
Copy the resulting SHA256 key and paste it on the sha256 line.
186+
187+
d. Reset the build number to 0 in ``number: 0``. The build number only needs to be increased if a new build is needed for the same source version.
188+
See https://github.com/conda-forge/staged-recipes/wiki/Frequently-asked-questions.
189+
190+
e. Ensure requirements are correct. Use pin compatibility to specify specific versions, for example::
191+
192+
{{ pin_compatible('geopandas', upper_bound='1.0') }}
193+
194+
f. Commit changes to meta.yml::
195+
196+
git commit -m "update meta.yaml" recipe/meta.yaml
197+
198+
g. Push changes to your fork/branch::
199+
200+
git push <username> <branchname>
201+
202+
10. **Render the feedstock recipe on conda-forge**: Create a pull request to https://github.com/conda-forge/wntr-feedstock. Review the checklist,
203+
and have the conda-forge-admin rerender the files by adding ``@conda-forge-admin, please rerender`` to the pull request.
204+
Once all tests have passed, merge the pull request. The pull request description should include the following checks and message for the conda-forge-admin::
205+
206+
* [x] Used a personal fork of the feedstock to propose changes
207+
* [x] Bumped the build number (if the version is unchanged)
208+
* [x] Reset the build number to 0 (if the version changed)
209+
* [ ] Re-rendered with the latest conda-smithy
210+
* [x] Ensured the license file is being packaged.
211+
@conda-forge-admin, please rerender
212+
213+
11. **Test the release (or release candidate)**: Create a new conda environment with a WNTR supported version of Python and no default packages,
214+
and then install WNTR and then print the version number (pytest can also be run locally to further test the release).
215+
To test the PyPI installation::
216+
217+
conda create --name test1 python=3.12 --no-default-packages
218+
conda activate test1
219+
pip install wntr
220+
python -c "import wntr; print(wntr.__version__)"
221+
222+
To test the conda installation::
223+
224+
conda create --name test2 python=3.12 --no-default-packages
225+
conda activate test2
226+
conda install -c conda-forge wntr
227+
python -c "import wntr; print(wntr.__version__)"
228+
229+
12. **Add an announcement to the homepage**: If this is not a release candidate, update attention.rst with an
230+
announcement for the new release (update version number). This will update https://usepa.github.io/WNTR.
103231

104232
Development team
105233
-------------------
106234
WNTR was developed as part of a collaboration between the United States
107-
Environmental Protection Agency Office of Research and Development,
108-
Sandia National Laboratories, and Purdue University.
109-
See https://github.com/USEPA/WNTR/graphs/contributors for a full list of contributors.
235+
Environmental Protection Agency Office of Research and Development and
236+
Sandia National Laboratories.
237+
See https://github.com/USEPA/WNTR/graphs/contributors for a full list of contributors.

documentation/disaster_models.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ The earthquake properties can be plotted on the network using the following exam
9797

9898
.. _fig-network:
9999
.. figure:: figures/network_pga.png
100-
:width: 640
100+
:width: 535
101101
:alt: Peak ground acceleration
102102

103103
Peak ground acceleration.

documentation/fragility.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ of exceeding the Minor damage state is 0.80.
6363

6464
.. _fig-fragility:
6565
.. figure:: figures/fragility_curve.png
66-
:width: 640
66+
:width: 535
6767
:alt: Fragility curve
6868

6969
Example fragility curve.
@@ -113,7 +113,7 @@ To plot the damage state on the network, the state (i.e., Major) can be converte
113113

114114
.. _fig-damage-state:
115115
.. figure:: figures/damage_state.png
116-
:width: 640
116+
:width: 535
117117
:alt: Damage state
118118

119119
Damage state, selected from the fragility curve.

documentation/framework.rst

+5-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ run simulations are described in more detail below, followed by a list of softwa
2626

2727
.. _table-wntr-subpackage:
2828
.. table:: WNTR Subpackages
29+
:widths: 20 80
2930

3031
================================================= =============================================================================================================================================================================================================================================================================
3132
Subpackage Description
@@ -51,7 +52,8 @@ Additionally, EPANET INP files can be generated from water network models.
5152

5253
.. _table-network-subpackage:
5354
.. table:: Network Classes
54-
55+
:widths: 20 80
56+
5557
================================================== =============================================================================================================================================================================================================================================================================
5658
Class Description
5759
================================================== =============================================================================================================================================================================================================================================================================
@@ -79,7 +81,8 @@ These classes are listed in :numref:`table-sim-subpackage`.
7981

8082
.. _table-sim-subpackage:
8183
.. table:: Simulator Classes
82-
84+
:widths: 20 80
85+
8386
================================================= =============================================================================================================================================================================================================================================================================
8487
Class Description
8588
================================================= =============================================================================================================================================================================================================================================================================

documentation/gis.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ the hydrants snapped to the junctions in Net1.
441441

442442
.. _fig-snap-points:
443443
.. figure:: figures/snap_points.png
444-
:width: 640
444+
:width: 535
445445
:alt: Hydrants snapped to junctions in EPANET example Net1 using the snapped points to points function
446446

447447
Net1 with example hydrants snapped to junctions, in which the larger blue circles are the hydrant locations and the smaller red circles are the associated junctions.
@@ -526,7 +526,7 @@ illustrates the valve layer created by snapping points to lines in Net1.
526526

527527
.. _fig-snap-lines:
528528
.. figure:: figures/snap_lines.png
529-
:width: 640
529+
:width: 535
530530
:alt: Isolation valves snapped to pipes in EPANET example Net1 using the snapped points to lines function
531531

532532
Net1 with example valve layer created by snapping points to lines, in which the blue circles are the isolation valve locations
@@ -631,7 +631,7 @@ The pipes are colored based upon their maximum earthquake probability.
631631

632632
.. _fig-intersect-earthquake:
633633
.. figure:: figures/intersect_earthquake.png
634-
:width: 640
634+
:width: 535
635635
:alt: Intersection of pipes with earthquake fault lines in EPANET example Net1
636636

637637
Net1 with example earthquake fault lines intersected with pipes, which are colored based upon their maximum earthquake probability.
@@ -716,7 +716,7 @@ The pipes are colored based upon their weighted mean landslide probability.
716716

717717
.. _fig-intersect-landslide:
718718
.. figure:: figures/intersect_landslide.png
719-
:width: 640
719+
:width: 535
720720
:alt: Intersection of junctions with landslide zones in EPANET example Net1
721721

722722
Net1 with example landslide zones intersected with pipes, which are colored based upon their weighted mean landslide probability.
@@ -825,7 +825,7 @@ the census tracts (polygons) is different than the junction and pipe attributes.
825825

826826
.. _fig-intersect-demographics:
827827
.. figure:: figures/intersect_demographics.png
828-
:width: 640
828+
:width: 535
829829
:alt: Intersection of junctions and pipes with mean income demographic data in EPANET example Net1
830830

831831
Net1 with mean income demographic data intersected with junctions and pipes.
@@ -923,7 +923,7 @@ sampled from the raster file.
923923

924924
.. _fig-sample-elevations:
925925
.. figure:: figures/sample_elevations.png
926-
:width: 640
926+
:width: 535
927927
:alt: Net1 with elevations sampled from raster.
928928

929929
Net1 with elevations sampled from raster.

documentation/graphics.rst

+9-9
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ which can be further customized by the user.
6767

6868
.. _fig-network-2:
6969
.. figure:: figures/plot_basic_network.png
70-
:width: 640
70+
:width: 535
7171
:alt: Network
7272

7373
Basic network graphic.
@@ -151,7 +151,7 @@ The following example plots the network along with node population (:numref:`fig
151151

152152
.. _fig-plotly:
153153
.. figure:: figures/plot_plotly_network.png
154-
:width: 640
154+
:width: 535
155155
:alt: Network
156156

157157
Interactive network graphic with the legend showing the node population.
@@ -181,7 +181,7 @@ with pipe length over the city of Albuquerque (for demonstration purposes only)
181181

182182
.. _fig-leaflet:
183183
.. figure:: figures/interactive_network.png
184-
:width: 640
184+
:width: 535
185185
:alt: Network
186186

187187
Interactive Leaflet network graphic.
@@ -236,7 +236,7 @@ The following example plots simulation results from above, showing pressure at a
236236

237237
.. _fig-timeseries:
238238
.. figure:: figures/plot_timeseries.png
239-
:width: 640
239+
:width: 535
240240
:alt: Network
241241

242242
Time series graphic.
@@ -273,7 +273,7 @@ The following example uses simulation results from above, and converts the graph
273273

274274
.. _fig-interactive-timeseries:
275275
.. figure:: figures/interactive_timeseries.png
276-
:width: 640
276+
:width: 535
277277
:alt: Network
278278

279279
Interactive time series graphic with the tank heights for Tank 1 (blue), Tank 2 (orange), and Tank 3 (green).
@@ -305,7 +305,7 @@ The following example plots a fragility curve with two states (:numref:`fig-frag
305305

306306
.. _fig-fragility2:
307307
.. figure:: figures/fragility_curve.png
308-
:width: 640
308+
:width: 535
309309
:alt: Fragility curve
310310

311311
Fragility curve graphic.
@@ -338,7 +338,7 @@ The following example plots a pump curve (:numref:`fig-pump`).
338338

339339
.. _fig-pump:
340340
.. figure:: figures/plot_pump_curve.png
341-
:width: 640
341+
:width: 535
342342
:alt: Pump curve
343343

344344
Pump curve graphic.
@@ -429,7 +429,7 @@ The valves and valve segments are plotted on the network (:numref:`fig-valve_seg
429429

430430
.. _fig-valve_segment:
431431
.. figure:: figures/plot_valve_segment.png
432-
:width: 640
432+
:width: 535
433433
:alt: Valve segment attributes
434434

435435
Valves layer and segments.
@@ -457,7 +457,7 @@ valves surrounding each valve is plotted on the network
457457

458458
.. _fig-valve_segment_attributes:
459459
.. figure:: figures/plot_valve_segment_attributes.png
460-
:width: 640
460+
:width: 535
461461
:alt: Valve segment attributes
462462

463463
Valve segment attribute showing the number of valves surrounding each valve.

0 commit comments

Comments
 (0)