Skip to content

Commit e090698

Browse files
author
Caitlin Lewis
committed
beginning docs
1 parent cd50a1b commit e090698

7 files changed

Lines changed: 189 additions & 0 deletions

File tree

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd
12 KB
Binary file not shown.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{% set class_toc = get_class_toc() %}
2+
3+
<nav id="bd-toc-nav", style="padding-top: 1rem;">
4+
<ul class="visible nav section-nav flex-column">
5+
{% for item in class_toc %}
6+
<li class="toc-h1 nav-item toc-entry">
7+
<a class="reference internal nav-link" href="{{ item.link }}">{{ item.title }}</a>
8+
</li>
9+
<ul class="visible nav section-nav flex-column">
10+
{% for attr in item.attributes_and_methods %}
11+
<li class="toc-h2 nav-item toc-entry">
12+
<a class="reference internal nav-link" href="{{ attr.link }}">{{ attr.title }}</a>
13+
</li>
14+
{% endfor %}
15+
</ul>
16+
{% endfor %}
17+
</ul>
18+
</nav>

docs/source/api/layouts.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.. _api_layouts:
2+
3+
Layouts
4+
*******
5+
6+
.. autoclass:: fastplotlib.Plot
7+
:members:
8+
9+
.. autoclass:: fastplotlib.GridPlot
10+
:members:
11+
12+
.. autoclass:: fastplotlib.layouts._subplot.Subplot
13+
:members:
14+

docs/source/conf.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
from bs4 import BeautifulSoup
6+
from typing import *
7+
8+
# -- Project information -----------------------------------------------------
9+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
10+
11+
project = 'fastplotlib'
12+
copyright = '2022, Kushal Kolar, Caitlin Lewis'
13+
author = 'Kushal Kolar, Caitlin Lewis'
14+
release = 'v0.1.0.a6'
15+
16+
# -- General configuration ---------------------------------------------------
17+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
18+
19+
extensions = ["sphinx.ext.napoleon"]
20+
21+
templates_path = ['_templates']
22+
exclude_patterns = []
23+
24+
25+
26+
# -- Options for HTML output -------------------------------------------------
27+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
28+
29+
html_theme = 'pydata_sphinx_theme'
30+
html_theme_options = {"page_sidebar_items": ["class_page_toc"]}
31+
32+
html_static_path = ['_static']
33+
34+
autodoc_member_order = 'bysource'
35+
autoclass_content = "both"
36+
37+
def _setup_navbar_side_toctree(app: Any):
38+
39+
def add_class_toctree_function(app: Any, pagename: Any, templatename: Any, context: Any, doctree: Any):
40+
def get_class_toc() -> Any:
41+
soup = BeautifulSoup(context["body"], "html.parser")
42+
43+
matches = soup.find_all('dl')
44+
if matches is None or len(matches) == 0:
45+
return ""
46+
items = []
47+
deeper_depth = matches[0].find('dt').get('id').count(".")
48+
for match in matches:
49+
match_dt = match.find('dt')
50+
if match_dt is not None and match_dt.get('id') is not None:
51+
current_title = match_dt.get('id')
52+
current_depth = match_dt.get('id').count(".")
53+
current_link = match.find(class_="headerlink")
54+
if current_link is not None:
55+
if deeper_depth > current_depth:
56+
deeper_depth = current_depth
57+
if deeper_depth == current_depth:
58+
items.append({
59+
"title": current_title.split('.')[-1],
60+
"link": current_link["href"],
61+
"attributes_and_methods": []
62+
})
63+
if deeper_depth < current_depth:
64+
items[-1]["attributes_and_methods"].append(
65+
{
66+
"title": current_title.split('.')[-1],
67+
"link": current_link["href"],
68+
}
69+
)
70+
return items
71+
context["get_class_toc"] = get_class_toc
72+
73+
app.connect("html-page-context", add_class_toctree_function)
74+
75+
76+
def setup(app: Any):
77+
for setup_function in [
78+
_setup_navbar_side_toctree,
79+
]:
80+
setup_function(app)

docs/source/index.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.. fastplotlib documentation master file, created by
2+
sphinx-quickstart on Wed Dec 28 12:46:56 2022.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to fastplotlib's documentation!
7+
=======================================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Contents:
12+
13+
Layouts <api/layouts>
14+
15+
16+
17+
Indices and tables
18+
==================
19+
20+
* :ref:`genindex`
21+
* :ref:`modindex`
22+
* :ref:`search`

0 commit comments

Comments
 (0)