Skip to content

Commit 47518ad

Browse files
author
James K. Glasbrenner
committed
Documentation refactoring to use RTD theme
* Adopt RTD theme for docs HTML rendering. * Refactored the settings related to generating the table of contents as this is rendered somewhat differently in the RTD theme. * Update RTD configuration settings, just install requirements in setup.py file instead of using environment.yaml. * Generate individual rst files for all individual functions. * Add CSS file to fix wrapping issues as discussed here, readthedocs/sphinx_rtd_theme#432 (comment). * Revise content on index.rst file.
1 parent bc512ad commit 47518ad

File tree

36 files changed

+336
-140
lines changed

36 files changed

+336
-140
lines changed

.readthedocs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ build:
44

55
python:
66
version: 3.6
7-
8-
conda:
9-
file: environment.yaml
7+
setup_py_install: true
8+
extra_requirements:
9+
- docs
1010

1111
formats: []
1212
...

docs/_static/theme_overrides.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* override table width restrictions */
2+
@media screen and (min-width: 767px) {
3+
.wy-table-responsive table td {
4+
/* !important prevents the common CSS stylesheets from overriding
5+
this as on RTD they are loaded after this stylesheet */
6+
white-space: normal !important;
7+
}
8+
.wy-table-responsive {
9+
overflow: visible !important;
10+
}
11+
}

docs/conf.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@
2727
# The full version, including alpha/beta/rc tags
2828
release = '0.0.1'
2929

30-
# -- Autodoc configuration ---------------------------------------------------
31-
32-
autodoc_member_order = "bysource"
33-
autosummary_generate = True
34-
3530
# -- General configuration ---------------------------------------------------
3631

3732
# If your documentation needs a minimal Sphinx version, state it here.
@@ -67,34 +62,50 @@
6762
#
6863
# This is also used if you do content translation via gettext catalogs.
6964
# Usually you set "language" from the command line for these cases.
70-
language = None
65+
language = "en"
7166

7267
# List of patterns, relative to source directory, that match files and
7368
# directories to ignore when looking for source files.
7469
# This pattern also affects html_static_path and html_extra_path .
7570
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
7671

7772
# The name of the Pygments (syntax highlighting) style to use.
78-
pygments_style = 'sphinx'
73+
# pygments_style = 'sphinx'
74+
75+
# If true, the current module name will be prepended to all description
76+
# unit titles (such as .. function::).
77+
add_module_names = False
7978

8079
# -- Options for HTML output -------------------------------------------------
8180

8281
# The theme to use for HTML and HTML Help pages. See the documentation for
8382
# a list of builtin themes.
8483
#
85-
html_theme = 'nature'
84+
on_rtd = os.environ.get('READTHEDOCS') == 'True'
85+
if on_rtd:
86+
html_theme = 'default'
87+
else:
88+
html_theme = 'sphinx_rtd_theme'
8689

8790
# Theme options are theme-specific and customize the look and feel of a theme
8891
# further. For a list of options available for each theme, see the
8992
# documentation.
9093
#
9194
# html_theme_options = {}
9295

96+
html_use_index = False
97+
9398
# Add any paths that contain custom static files (such as style sheets) here,
9499
# relative to this directory. They are copied after the builtin static files,
95100
# so a file named "default.css" will overwrite the builtin "default.css".
96101
html_static_path = ['_static']
97102

103+
html_context = {
104+
'css_files': [
105+
'_static/theme_overrides.css', # override wide tables in RTD theme
106+
],
107+
}
108+
98109
# Custom sidebar templates, must be a dictionary that maps document names
99110
# to template names.
100111
#
@@ -165,6 +176,11 @@
165176

166177
# -- Extension configuration -------------------------------------------------
167178

179+
# -- Options for autodoc extension -------------------------------------------
180+
181+
autodoc_member_order = "bysource"
182+
autosummary_generate = True
183+
168184
# -- Options for todo extension ----------------------------------------------
169185

170186
# If true, `todo` and `todoList` produce output, else they produce nothing.

docs/index.rst

Lines changed: 1 addition & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -8,103 +8,7 @@ neighbormodels documentation
88
API
99
===
1010

11-
12-
Modules
13-
-------
14-
1511
.. toctree::
12+
:maxdepth: 2
1613

1714
modules
18-
19-
20-
``interactions``
21-
^^^^^^^^^^^^^^^^
22-
23-
.. automodule:: neighbormodels.interactions
24-
25-
.. rubric:: Primary method
26-
27-
.. autosummary::
28-
29-
build_model
30-
31-
.. rubric:: Functions
32-
33-
.. autosummary::
34-
35-
aggregate_interaction_coefficients
36-
build_magnetic_patterns_data_frame
37-
compute_interaction_signs
38-
compute_model_coefficients
39-
group_subspecie_pairs_and_rank_by_distance
40-
label_interaction_parameters
41-
multiply_interaction_signs_and_neighbor_count
42-
spread_parameter_name_column
43-
44-
45-
``neighbors``
46-
^^^^^^^^^^^^^
47-
48-
.. automodule:: neighbormodels.neighbors
49-
50-
.. rubric:: Primary method
51-
52-
.. autosummary::
53-
54-
count_neighbors
55-
56-
.. rubric:: Functions
57-
58-
.. autosummary::
59-
60-
add_subspecie_labels_if_missing
61-
append_site_i_neighbor_distance_data
62-
count_neighbors_within_distance_groups
63-
define_bin_intervals
64-
define_bins_to_group_and_sort_by_distance
65-
extract_neighbor_distance_data
66-
find_unique_distances
67-
get_neighbor_distances_data_frame
68-
group_site_index_pairs_by_distance
69-
70-
.. rubric:: Classes
71-
72-
.. autosummary::
73-
74-
NeighborData
75-
76-
77-
``structure``
78-
^^^^^^^^^^^^^
79-
80-
.. automodule:: neighbormodels.structure
81-
82-
.. rubric:: Primary methods
83-
84-
.. autosummary::
85-
86-
from_file
87-
from_parameters
88-
89-
.. autosummary::
90-
91-
.. rubric:: Functions
92-
93-
.. autosummary::
94-
95-
get_subspecies_labels
96-
label_subspecies
97-
98-
.. rubric:: Classes
99-
100-
.. autosummary::
101-
102-
StructureParameters
103-
104-
105-
Indices and tables
106-
==================
107-
108-
* :ref:`genindex`
109-
* :ref:`modindex`
110-
* :ref:`search`

docs/modules.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
neighbormodels
2-
==============
1+
Modules
2+
=======
33

44
.. toctree::
55
:maxdepth: 4
66

7-
neighbormodels
7+
neighbormodels.interactions
8+
neighbormodels.neighbors
9+
neighbormodels.structure
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.interactions.aggregate\_interaction\_coefficients
2+
================================================================
3+
4+
.. currentmodule:: neighbormodels.interactions
5+
6+
.. autofunction:: aggregate_interaction_coefficients
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.interactions.build\_magnetic\_patterns\_data\_frame
2+
==================================================================
3+
4+
.. currentmodule:: neighbormodels.interactions
5+
6+
.. autofunction:: build_magnetic_patterns_data_frame
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.interactions.build\_model
2+
========================================
3+
4+
.. currentmodule:: neighbormodels.interactions
5+
6+
.. autofunction:: build_model
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.interactions.compute\_interaction\_signs
2+
=======================================================
3+
4+
.. currentmodule:: neighbormodels.interactions
5+
6+
.. autofunction:: compute_interaction_signs
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.interactions.compute\_model\_coefficients
2+
========================================================
3+
4+
.. currentmodule:: neighbormodels.interactions
5+
6+
.. autofunction:: compute_model_coefficients
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.interactions.group\_subspecie\_pairs\_and\_rank\_by\_distance
2+
============================================================================
3+
4+
.. currentmodule:: neighbormodels.interactions
5+
6+
.. autofunction:: group_subspecie_pairs_and_rank_by_distance
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.interactions.label\_interaction\_parameters
2+
==========================================================
3+
4+
.. currentmodule:: neighbormodels.interactions
5+
6+
.. autofunction:: label_interaction_parameters
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.interactions.multiply\_interaction\_signs\_and\_neighbor\_count
2+
==============================================================================
3+
4+
.. currentmodule:: neighbormodels.interactions
5+
6+
.. autofunction:: multiply_interaction_signs_and_neighbor_count
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.interactions.spread\_parameter\_name\_column
2+
===========================================================
3+
4+
.. currentmodule:: neighbormodels.interactions
5+
6+
.. autofunction:: spread_parameter_name_column
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
neighbormodels.neighbors.NeighborData
2+
=====================================
3+
4+
.. currentmodule:: neighbormodels.neighbors
5+
6+
.. autoclass:: NeighborData
7+
8+
9+
.. automethod:: __init__
10+
11+
12+
.. rubric:: Methods
13+
14+
.. autosummary::
15+
16+
~NeighborData.count
17+
~NeighborData.index
18+
19+
20+
21+
22+
23+
.. rubric:: Attributes
24+
25+
.. autosummary::
26+
27+
~NeighborData.bins_data_frame
28+
~NeighborData.data_frame
29+
~NeighborData.structure
30+
31+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.neighbors.add\_subspecie\_labels\_if\_missing
2+
============================================================
3+
4+
.. currentmodule:: neighbormodels.neighbors
5+
6+
.. autofunction:: add_subspecie_labels_if_missing
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.neighbors.append\_site\_i\_neighbor\_distance\_data
2+
==================================================================
3+
4+
.. currentmodule:: neighbormodels.neighbors
5+
6+
.. autofunction:: append_site_i_neighbor_distance_data
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.neighbors.count\_neighbors
2+
=========================================
3+
4+
.. currentmodule:: neighbormodels.neighbors
5+
6+
.. autofunction:: count_neighbors
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.neighbors.count\_neighbors\_within\_distance\_groups
2+
===================================================================
3+
4+
.. currentmodule:: neighbormodels.neighbors
5+
6+
.. autofunction:: count_neighbors_within_distance_groups
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.neighbors.define\_bin\_intervals
2+
===============================================
3+
4+
.. currentmodule:: neighbormodels.neighbors
5+
6+
.. autofunction:: define_bin_intervals
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.neighbors.define\_bins\_to\_group\_and\_sort\_by\_distance
2+
=========================================================================
3+
4+
.. currentmodule:: neighbormodels.neighbors
5+
6+
.. autofunction:: define_bins_to_group_and_sort_by_distance
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.neighbors.extract\_neighbor\_distance\_data
2+
==========================================================
3+
4+
.. currentmodule:: neighbormodels.neighbors
5+
6+
.. autofunction:: extract_neighbor_distance_data
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.neighbors.find\_unique\_distances
2+
================================================
3+
4+
.. currentmodule:: neighbormodels.neighbors
5+
6+
.. autofunction:: find_unique_distances
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
neighbormodels.neighbors.get\_neighbor\_distances\_data\_frame
2+
==============================================================
3+
4+
.. currentmodule:: neighbormodels.neighbors
5+
6+
.. autofunction:: get_neighbor_distances_data_frame

0 commit comments

Comments
 (0)