Skip to content

Update apidoc for Sphinx 7. Relates to #4085 #4617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/apidoc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ help:
# docstrings. The first path is the one to process, the following ones
# are excluded from the search.
rm -rf _build generated
sphinx-apidoc -M -o generated ../../packages/python/plotly/plotly ../../packages/python/plotly/plotly/validators ../../packages/python/plotly/plotly/tests ../../packages/python/plotly/plotly/matplotlylib/ ../../packages/python/plotly/plotly/offline ../../packages/python/plotly/plotly/api
sphinx-apidoc -M -o generated ../../packages/python/plotly/plotly ../../packages/python/plotly/plotly/validators ../../packages/python/plotly/plotly/tests ../../packages/python/plotly/plotly/matplotlylib/ ../../packages/python/plotly/plotly/offline ../../packages/python/plotly/plotly/api ../../packages/python/plotly/plotly/plotly
# Run sphinx-build to build html pages from the rst pages
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
git checkout -- ../../packages/python/plotly/plotly/graph_objs
Expand All @@ -42,4 +42,4 @@ help:
sed -i 's/graph_objs/graph_objects/g' _build/html/*.inv
sed -i 's/graph_objs/graph_objects/g' _build/html/*.js
sed -i 's/graph_objs/graph_objects/g' _build/html/generated/*.html
sed -i 's/graph_objs/graph_objects/g' _build/html/generated/generated/*.html
# sed -i 's/graph_objs/graph_objects/g' _build/html/generated/generated/*.html
1 change: 1 addition & 0 deletions doc/apidoc/_static/graphing_library.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 32 additions & 1 deletion doc/apidoc/_static/plotly-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
padding-top: 8px;
}

code {
.rst-content code.literal {
color: #2c3e50 !important;
}

Expand Down Expand Up @@ -97,10 +97,41 @@ h6 {
font-weight: 500;
}

.wy-nav-side {
background-color: #0e1012;
}

.wy-side-nav-search {
background-color: #0e1012 !important;
}

/*

a {
color: #506784 !important;
}

a:hover {
color: #0d67bf !important;
}

*/

a.icon img.logo {
margin-top: 0 !important ;
}

.wy-side-nav-search .wy-dropdown > a img.logo, .wy-side-nav-search > a img.logo {
width: 275px;
}

.wy-table-responsive table td {
white-space: normal;
}

/* https://github.com/readthedocs/sphinx_rtd_theme/issues/468 */
/* adds scrollbar to sidenav */
.wy-side-scroll {
width: auto;
overflow-y: auto;
}
4 changes: 1 addition & 3 deletions doc/apidoc/_templates/class_figure.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
:mod:`{{module}}`.{{objname}}
{{ underline }}==============
{{ underline }}=========================================================


.. currentmodule:: {{ module }}

.. autosummary::
:toctree: generated/

Figure

Figure.show
Expand Down
44 changes: 21 additions & 23 deletions doc/apidoc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@
#
import os
import sys
import sphinx_bootstrap_theme

# sys.path.insert(0, os.path.abspath("../packages/python/plotly"))


# -- Project information -----------------------------------------------------

project = ""
copyright = "2022, Plotly"
copyright = "2024, Plotly"
author = "Plotly"

# The short X.Y version
Expand Down Expand Up @@ -63,13 +59,6 @@
# The master toctree document.
master_doc = "index"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
Expand All @@ -85,18 +74,21 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "bootstrap"
html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()

html_logo = "_static/logo.png"
html_theme = "sphinx_rtd_theme"
html_logo = "_static/graphing_library.svg"
html_show_sourcelink = False

# -- If dark mode option wanted. Needs pip install sphinx-rtd-dark-mode
# extensions.append("sphinx_rtd_dark_mode")
# default_dark_mode = False

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
"analytics_id": "UA-39373211-1", # not supported by this theme
"bootswatch_theme": "flatly",
"source_link_position": "no",
"analytics_id": "UA-39373211-1", # supported by rtd theme. Not by bootstrap?
}

# Add any paths that contain custom static files (such as style sheets) here,
Expand All @@ -111,9 +103,14 @@
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}

# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_sidebars
# This doesn't seem to get us anywhere
# html_sidebars = {
# '**': ['globaltoc.html', 'sourcelink.html', 'searchbox.html'],
# }

html_favicon = "_static/favicon.ico"

# -- Options for HTMLHelp output ---------------------------------------------
Expand Down Expand Up @@ -171,7 +168,6 @@
)
]


# -- Options for Epub output -------------------------------------------------

# Bibliographic Dublin Core info.
Expand Down Expand Up @@ -202,6 +198,8 @@
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True


def setup(app):
app.add_stylesheet("plotly-style.css") # also can be a full URL
# Adding the bootstrap theme makes little difference - rules in the RTD theme are usually more specific
html_css_files = [
# "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css",
"plotly-style.css"
]
7 changes: 7 additions & 0 deletions doc/apidoc/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Any version of pandas, it just allows plotly express to be imported
pandas
black
sphinx==7.3.7
sphinx-rtd-theme==2.0.0
tenacity
# Do not include plotly here, get it from code