Skip to content

Commit e505acd

Browse files
authored
contributing notes for the doc (#2055)
1 parent f2ead37 commit e505acd

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

contributing.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ Open an issue! Go to https://github.com/plotly/plotly.py/issues. It's possible t
1414

1515
Check out our Support App: https://support.plot.ly/libraries/python or Community Forum: https://community.plot.ly/.
1616

17+
## Want to improve the plotly documentation?
18+
19+
Thank you! Instructions on how to contribute to the documentation are given [here](doc/contributing.md). Please also read the next section if you need to setup a development environment.
20+
1721
## Setup a Development Environment
1822

1923
### Fork, Clone, Setup Your Version of the Plotly Python API

doc/contributing.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
2+
## Introduction: structure and required packages
3+
4+
The `doc` directory contains the source files of the documentation of plotly.py.
5+
It is composed of two parts:
6+
7+
- inside the [`python/` directory](python), tutorials corresponding to https://plot.ly/python/
8+
- inside the [`apidoc/` directory](apidoc), configuration files for generating
9+
the API reference documentation (hosted on https://plot.ly/python-api-reference/)
10+
11+
Python packages required to build the doc are listed in
12+
[`requirements.txt`](requirements.txt) in the `doc` directory.
13+
14+
## Tutorials (`python` directory)
15+
16+
Each tutorial is a markdown (`.md`) file, which can be opened in the Jupyter
17+
notebook or in Jupyterlab by installing [jupytext](https://jupytext.readthedocs.io/en/latest/install.html).
18+
19+
For small edits (e.g., correcting typos) to an existing tutorial, you can simply click on the "edit this
20+
page on Github" link at the top right of the page (e.g. clicking on this link
21+
on https://plot.ly/python/bar-charts/ will take you to
22+
https://github.com/plotly/plotly.py/edit/doc-prod/doc/python/bar-charts.md,
23+
where you can edit the page on Github).
24+
25+
For more important edits where you need to run the notebook to check the output,
26+
clone the repository and setup an environment as described in the [main
27+
contributing notes](../contributing.md). If you're writing documentation at the
28+
same time as you are developing a feature, make sure to install with editable
29+
install (`pip install -e`, as described in [main
30+
contributing notes](../contributing.md)), so that you only need to restart
31+
the Jupyter kernel when you have changed the source code of the feature.
32+
33+
### Branches
34+
35+
Two different cases exist, whether you are documenting a feature already
36+
released, or which has just been included but not yet released.
37+
38+
- Case of an already released feature: your changes can be deployed to the
39+
documentation website as soon as they have been merged, and you should start
40+
your branch off the `doc-prod` branch and open your pull request against this
41+
`doc-prod` branch.
42+
- Case of a new (not released yet) feature: start your branch / pull request
43+
against the `master` branch. `master` and `doc-prod` will be synchronized at
44+
release time, so that the documentation of the feature is only deployed when
45+
it is available in a released version of `plotly.py`.
46+
47+
### Guidelines
48+
49+
We try to write short, standalone and (almost) self-explaining examples. Most
50+
examples should focus on a single feature.
51+
52+
Checklist
53+
54+
- Each example should have a clear title (titles are used for the navigation
55+
bar and indexed by search engines)
56+
- Package imports should be called in the same cell as the example, so that it
57+
is possible to copy-paste a single cell to reproduce the example.
58+
- Variable names should be consistent with other examples, for example use
59+
`fig` for a `Figure` object, `df` for a pandas dataframe, etc.
60+
- Examples should not be too long to execute (typically < 10s), since the doc is
61+
built as part of the continuous integration (CI) process. Examples taking
62+
longer to execute should be discussed in a new issue to decide whether they
63+
can be accepted.
64+
65+
## API reference documentation (`apidoc` directory)
66+
67+
We use [sphinx](http://www.sphinx-doc.org/en/master/) and its [`autodoc`
68+
extension](http://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html)
69+
in order to generate the documentation of the API. Sphinx uses the [reST markup
70+
language](https://www.sphinx-doc.org/en/2.0/usage/restructuredtext/basics.html).
71+
72+
Run `make html` inside `apidoc` to build the API doc in the `_build/html`
73+
directory.
74+
75+
Lists of objects to be documented are found in files corresponding to
76+
submodules, such as [`plotly.express.rst`](plotly.express.rst). When a new
77+
object is added to the exposed API, it needs to be added to the corresponding
78+
file to appear in the API doc.
79+
80+
Other files
81+
82+
- `css` files are found in `_static`
83+
- Template files are found in `_templates`. `.rst` templates describe how the
84+
autodoc of the different objects should look like.
85+
86+

0 commit comments

Comments
 (0)