Skip to content

Commit

Permalink
Added documentation generation using Sphinx (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
czgdp1807 authored Oct 18, 2021
1 parent ce7a749 commit 652b44e
Show file tree
Hide file tree
Showing 32 changed files with 389 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ python:
- "3.8"
install:
- travis_wait 60 pip install -r requirements.txt
- travis_wait 60 pip install -r docs/requirements.txt

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

after_success:
- codecov
- pip install -e .
- sphinx-build -b html docs/source/ docs/build/html
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ PyDataStructs
About
-----

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.
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.

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.
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.

Installation
------------
Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sphinx==4.2.0
sphinx-readable-theme==1.3.0
72 changes: 72 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))

# -- Imports ----------------

import sphinx_readable_theme

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

project = 'PyDataStructs'
copyright = '2021, PyDataStructs Development Team'
author = 'PyDataStructs Development Team'

# The full version, including alpha/beta/rc tags
release = '0.0.1'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon'
]

napoleon_numpy_docstring = True

# Add any paths that contain templates here, relative to this directory.
templates_path = []

# 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.
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'readable'

html_theme_path = [sphinx_readable_theme.get_html_theme_path()]

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = []

autodoc_default_options = {
'member-order': 'bysource',
'members': True,
'undoc-members': True,
'special-members': True,
'exclude-members': '__new__, methods, __slots__, __dict__, __weakref__'
}
29 changes: 29 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.. PyDataStructs documentation master file, created by
sphinx-quickstart on Sun Oct 17 19:57:08 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to PyDataStructs's documentation!
=========================================

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 doesn't exist yet.

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.

.. note::

This project is under active development and contributions are welcome.

Contents
========

.. toctree::
:maxdepth: 1

pydatastructs/pydatastructs.rst
22 changes: 22 additions & 0 deletions docs/source/pydatastructs/graphs/algorithms.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Algorithms
==========

.. autofunction:: pydatastructs.breadth_first_search

.. autofunction:: pydatastructs.breadth_first_search_parallel

.. autofunction:: pydatastructs.minimum_spanning_tree

.. autofunction:: pydatastructs.minimum_spanning_tree_parallel

.. autofunction:: pydatastructs.strongly_connected_components

.. autofunction:: pydatastructs.depth_first_search

.. autofunction:: pydatastructs.shortest_paths

.. autofunction:: pydatastructs.all_pair_shortest_paths

.. autofunction:: pydatastructs.topological_sort

.. autofunction:: pydatastructs.topological_sort_parallel
4 changes: 4 additions & 0 deletions docs/source/pydatastructs/graphs/graph.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Graph
=====

.. autoclass:: pydatastructs.Graph
8 changes: 8 additions & 0 deletions docs/source/pydatastructs/graphs/graphs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Graphs
======

.. toctree::
:maxdepth: 1

graph.rst
algorithms.rst
34 changes: 34 additions & 0 deletions docs/source/pydatastructs/linear_data_structures/algorithms.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Algorithms
==========

.. autofunction:: pydatastructs.merge_sort_parallel

.. autofunction:: pydatastructs.brick_sort

.. autofunction:: pydatastructs.brick_sort_parallel

.. autofunction:: pydatastructs.heapsort

.. autofunction:: pydatastructs.matrix_multiply_parallel

.. autofunction:: pydatastructs.counting_sort

.. autofunction:: pydatastructs.bucket_sort

.. autofunction:: pydatastructs.cocktail_shaker_sort

.. autofunction:: pydatastructs.quick_sort

.. autofunction:: pydatastructs.longest_common_subsequence

.. autofunction:: pydatastructs.is_ordered

.. autofunction:: pydatastructs.upper_bound

.. autofunction:: pydatastructs.lower_bound

.. autofunction:: pydatastructs.longest_increasing_subsequence

.. autofunction:: pydatastructs.next_permutation

.. autofunction:: pydatastructs.prev_permutation
8 changes: 8 additions & 0 deletions docs/source/pydatastructs/linear_data_structures/arrays.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Arrays
======

.. autoclass:: pydatastructs.OneDimensionalArray

.. autoclass:: pydatastructs.MultiDimensionalArray

.. autoclass:: pydatastructs.DynamicOneDimensionalArray
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Linear Data Structures
======================

.. toctree::
:maxdepth: 1

arrays.rst
linked_lists.rst
algorithms.rst
12 changes: 12 additions & 0 deletions docs/source/pydatastructs/linear_data_structures/linked_lists.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Linked Lists
============

.. autoclass:: pydatastructs.SinglyLinkedList

.. autoclass:: pydatastructs.DoublyLinkedList

.. autoclass:: pydatastructs.SinglyCircularLinkedList

.. autoclass:: pydatastructs.DoublyCircularLinkedList

.. autoclass:: pydatastructs.SkipList
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Binomial Tree
=============

.. autoclass:: pydatastructs.BinomialTree
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Disjoint Set
============

.. autoclass:: pydatastructs.DisjointSetForest
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Miscellaneous Data Structures
=============================

.. toctree::
:maxdepth: 1

stack.rst
queue.rst
binomial_trees.rst
disjoint_set.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Queues
======

.. autoclass:: pydatastructs.Queue

.. autoclass:: pydatastructs.PriorityQueue
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Stack
=====

.. autoclass:: pydatastructs.Stack
13 changes: 13 additions & 0 deletions docs/source/pydatastructs/pydatastructs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Modules
=======

.. automodule:: pydatastructs

.. toctree::
:maxdepth: 1

linear_data_structures/linear_data_structures.rst
graphs/graphs.rst
strings/strings.rst
trees/trees.rst
miscellaneous_data_structures/miscellaneous_data_structures.rst
4 changes: 4 additions & 0 deletions docs/source/pydatastructs/strings/algorithms.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Algorithms
==========

.. autofunction:: pydatastructs.find
8 changes: 8 additions & 0 deletions docs/source/pydatastructs/strings/strings.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Strings
=======

.. toctree::
:maxdepth: 1

trie.rst
algorithms.rst
4 changes: 4 additions & 0 deletions docs/source/pydatastructs/strings/trie.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Trie
====

.. autoclass:: pydatastructs.Trie
20 changes: 20 additions & 0 deletions docs/source/pydatastructs/trees/binary_trees.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Binary Trees
============

.. autoclass:: pydatastructs.BinaryTree

.. autoclass:: pydatastructs.BinarySearchTree

.. autoclass:: pydatastructs.AVLTree

.. autoclass:: pydatastructs.BinaryIndexedTree

.. autoclass:: pydatastructs.CartesianTree

.. autoclass:: pydatastructs.Treap

.. autoclass:: pydatastructs.SplayTree

.. autoclass:: pydatastructs.RedBlackTree

.. autoclass:: pydatastructs.BinaryTreeTraversal
Loading

0 comments on commit 652b44e

Please sign in to comment.