Skip to content

Commit f8b05fe

Browse files
committed
rebase
1 parent 2d6e186 commit f8b05fe

File tree

3 files changed

+54
-4
lines changed

3 files changed

+54
-4
lines changed

documentation/package-documentation-sphinx.md renamed to documentation/python-package-documentation.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Python Package Documentation
22

3+
In addition to a well designed [README.md file](readme-file-best-practices), and a
4+
[CONTRIBUTING.md file](contributing-file),
5+
there are several core components of Python package documentation,
6+
including:
7+
8+
* **User-facing documentation website:** This refers to easy-to-read documentation that helps a user work with your package. This documentation should help users both install and use the functionality of your package.
9+
* **API documentation:** API documentation is generated from [docstrings](https://pandas.pydata.org/docs/development/contributing_docstring.html) found in your code. Ideally you have docstrings for all user-facing functions, methods and classes in your Python package.
10+
11+
312

413
```{note}
514
Examples of documentation that we love:
@@ -27,9 +36,44 @@ using language that is less technical.
2736
A few tips to make sure your documentation is accessible include:
2837

2938
* Whenever possible, define technical terms and jargon.
30-
* Consider writing writing instructions for a 12th grade level reader.
39+
* Consider writing instructions for a high-school level reader.
3140
* Include step by step code examples, tutorials or vignettes that support getting started using your package.
3241

42+
43+
44+
## API's and Docstrings
45+
46+
### What is an API?
47+
48+
API standards for **A**pplied **P**rogramming **I**nterface. When
49+
discussed in the context of a (Python) package, the API refers to
50+
the interface and tools that you, as a package user, use in a package.
51+
52+
A simple example of a package API element:
53+
For instance, a package might have a function called `add_numbers()`
54+
that adds up a bunch of numbers. To add up numbers, you as the user
55+
simply call `add_numbers(1,2,3)` and the package function calculates the value and returns `6`. In using the `add_numbers` function, a user is
56+
using the package's API.
57+
58+
Package API's can consist of functions and/or classes (or object) that provide an easier-to-user interface (the API) for a user.
59+
60+
### What is a docstring and how does it relate to documentation?
61+
In Python a docstring refers to text in a function, method or class
62+
that describes what the function does and its inputs, outputs and what it
63+
returns.
64+
65+
The docstring is thus important for:
66+
67+
* When you, as a user, call `help()` e.g. `help(add_numbers)` in Python, it returns the elements in your docstring to help guide a user towards using the function more effectively.
68+
* When you build your package's documentation, the docstrings can be also used to automagically create full API documentation that provides a clean view of all functions methods and classes in a package.
69+
70+
```{tip}
71+
Example API Documentation (Documentation for all functions and classes in a package)
72+
* [View example high level API documentation for the Verde package. This page lists every function and class in the package along with a brief explanation of what it does](https://www.fatiando.org/verde/latest/api/index.html)
73+
* [You can further dig down to see what a specific function does within the package by clicking on an API element](https://www.fatiando.org/verde/latest/api/generated/verde.grid_coordinates.html#verde.grid_coordinates)
74+
```
75+
76+
3377
### What tools to use to build your documentation: sphinx
3478

3579
Most python packages use [sphinx](https://www.sphinx-doc.org/) to build their documentation.

documentation/readme-file-best-practices.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,12 @@ the broader scientific Python package ecosystem. If there are other similar pack
104104
or complementary package mentions them here in 1-2 sentences.
105105

106106
```{tip}
107-
Consider writing for a 12th grade reading level which is an ideal level for more scientific content that serves a broad user base. The goal of this description to maximize accessibility of your **README** file.
107+
Consider writing for a high school level (or equivalent) level. This
108+
level of writing is often consider level for scientific content that
109+
serves a variety of users with varying backgrounds.
110+
111+
The goal of this description to maximize
112+
accessibility of your **README** file.
108113
```
109114

110115
### ✔️ Installation instructions
@@ -121,7 +126,8 @@ your README file.
121126

122127
### ✔️ Brief demonstration of how to use the package
123128

124-
This description ideally includes a quick start vignette that provides a code sample demonstrating use of your package.
129+
This description ideally includes a quick start tutorial guide that
130+
provides a code sample demonstrating use of your package.
125131

126132
### ✔️ Descriptive links to package documentation, short tutorials
127133

index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ to see here, [we invite you to open an issue on GitHub that details any changes
113113
114114
Documentation Overview <documentation/index>
115115
The README File <documentation/readme-file-best-practices.md>
116-
Package Documentation <documentation/package-documentation-sphinx>
116+
Package Documentation <documentation/python-package-documentation>
117117
Contributing & License files <documentation/contributing-file>
118118
```
119119

0 commit comments

Comments
 (0)