Skip to content

Commit 652b44e

Browse files
authored
Added documentation generation using Sphinx (#415)
1 parent ce7a749 commit 652b44e

32 files changed

+389
-12
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ python:
66
- "3.8"
77
install:
88
- travis_wait 60 pip install -r requirements.txt
9+
- travis_wait 60 pip install -r docs/requirements.txt
910

1011
script:
1112
- travis_wait 60 python -m pytest --doctest-modules --cov=./ --cov-report=xml -s
1213

1314
after_success:
1415
- codecov
16+
- pip install -e .
17+
- sphinx-build -b html docs/source/ docs/build/html

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ PyDataStructs
66
About
77
-----
88

9-
This project aims to be a Python package for various data structures in computer science. We are also working on the development of various algorithms including parallel algorithms. To the best of our knowledge, a well-designed library/package which has covered most of the data structures and algorithms including their parallel implementation doesn't exist.
9+
This project aims to be a Python package for various data structures in computer science. We are also working on the development of algorithms including their parallel implementations. To the best of our knowledge, a well-designed library/package which has covered most of the data structures and algorithms including their parallel implementation doesn't exist yet.
1010

11-
Once the software design becomes more stable after a few releases of this package in the near future, we also aim to provide APIs for the code in C++ and Java as well.
11+
Once the software design becomes more stable after a few releases of this package in the near future, we also aim to provide APIs for the code in C++ and Java as well.
1212

1313
Installation
1414
------------

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+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.https://www.sphinx-doc.org/
25+
exit /b 1
26+
)
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

docs/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sphinx==4.2.0
2+
sphinx-readable-theme==1.3.0

docs/source/conf.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
# import os
14+
# import sys
15+
# sys.path.insert(0, os.path.abspath('.'))
16+
17+
# -- Imports ----------------
18+
19+
import sphinx_readable_theme
20+
21+
# -- Project information -----------------------------------------------------
22+
23+
project = 'PyDataStructs'
24+
copyright = '2021, PyDataStructs Development Team'
25+
author = 'PyDataStructs Development Team'
26+
27+
# The full version, including alpha/beta/rc tags
28+
release = '0.0.1'
29+
30+
31+
# -- General configuration ---------------------------------------------------
32+
33+
# Add any Sphinx extension module names here, as strings. They can be
34+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
35+
# ones.
36+
extensions = [
37+
'sphinx.ext.autodoc',
38+
'sphinx.ext.napoleon'
39+
]
40+
41+
napoleon_numpy_docstring = True
42+
43+
# Add any paths that contain templates here, relative to this directory.
44+
templates_path = []
45+
46+
# List of patterns, relative to source directory, that match files and
47+
# directories to ignore when looking for source files.
48+
# This pattern also affects html_static_path and html_extra_path.
49+
exclude_patterns = []
50+
51+
52+
# -- Options for HTML output -------------------------------------------------
53+
54+
# The theme to use for HTML and HTML Help pages. See the documentation for
55+
# a list of builtin themes.
56+
#
57+
html_theme = 'readable'
58+
59+
html_theme_path = [sphinx_readable_theme.get_html_theme_path()]
60+
61+
# Add any paths that contain custom static files (such as style sheets) here,
62+
# relative to this directory. They are copied after the builtin static files,
63+
# so a file named "default.css" will overwrite the builtin "default.css".
64+
html_static_path = []
65+
66+
autodoc_default_options = {
67+
'member-order': 'bysource',
68+
'members': True,
69+
'undoc-members': True,
70+
'special-members': True,
71+
'exclude-members': '__new__, methods, __slots__, __dict__, __weakref__'
72+
}

docs/source/index.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.. PyDataStructs documentation master file, created by
2+
sphinx-quickstart on Sun Oct 17 19:57:08 2021.
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 PyDataStructs's documentation!
7+
=========================================
8+
9+
This project aims to be a Python package for various data
10+
structures in computer science. We are also working on the
11+
development of algorithms including their parallel implementations.
12+
To the best of our knowledge, a well-designed library/package which
13+
has covered most of the data structures and algorithms doesn't exist yet.
14+
15+
Once the software design becomes more stable after a few releases of
16+
this package in the near future, we also aim to provide APIs for the
17+
code in C++ and Java as well.
18+
19+
.. note::
20+
21+
This project is under active development and contributions are welcome.
22+
23+
Contents
24+
========
25+
26+
.. toctree::
27+
:maxdepth: 1
28+
29+
pydatastructs/pydatastructs.rst
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Algorithms
2+
==========
3+
4+
.. autofunction:: pydatastructs.breadth_first_search
5+
6+
.. autofunction:: pydatastructs.breadth_first_search_parallel
7+
8+
.. autofunction:: pydatastructs.minimum_spanning_tree
9+
10+
.. autofunction:: pydatastructs.minimum_spanning_tree_parallel
11+
12+
.. autofunction:: pydatastructs.strongly_connected_components
13+
14+
.. autofunction:: pydatastructs.depth_first_search
15+
16+
.. autofunction:: pydatastructs.shortest_paths
17+
18+
.. autofunction:: pydatastructs.all_pair_shortest_paths
19+
20+
.. autofunction:: pydatastructs.topological_sort
21+
22+
.. autofunction:: pydatastructs.topological_sort_parallel
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Graph
2+
=====
3+
4+
.. autoclass:: pydatastructs.Graph
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Graphs
2+
======
3+
4+
.. toctree::
5+
:maxdepth: 1
6+
7+
graph.rst
8+
algorithms.rst

0 commit comments

Comments
 (0)