Skip to content

Commit

Permalink
setup sphinx doc and codecov yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
harisankar95 committed Nov 22, 2023
1 parent 3becf98 commit 4e2f8c4
Show file tree
Hide file tree
Showing 13 changed files with 473 additions and 205 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/test-and-publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ jobs:
file: ./coverage.xml
flags: unittests

- name: Build docs
run: |
pip install sphinx sphinx_rtd_theme sphinx-autodoc-typehints sphinx-copybutton sphinx-prompt sphinx-notfound-page sphinx-version-warning
sphinx-build -b html docs/ ./public
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public

- name: Publish 📦 to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/test-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
name: Test
Expand Down Expand Up @@ -42,3 +46,14 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests

- name: Build docs
run: |
pip install sphinx sphinx_rtd_theme sphinx-autodoc-typehints sphinx-copybutton sphinx-prompt sphinx-notfound-page sphinx-version-warning
sphinx-build -b html docs/ ./public
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
4 changes: 4 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage:
round: down
range: "60...80"
precision: 2
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 = .
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)
191 changes: 191 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

import os
import sys

sys.path.insert(0, os.path.abspath(".."))

# read the version from version.txt
with open(os.path.join("../pathfinding3d", "version.txt"), encoding="utf-8") as file_handler:
__version__ = file_handler.read().strip()


project = "pathfinding3d"
copyright = "2023, Harisankar Babu"
author = "Harisankar Babu"
release = __version__
version = __version__


# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"sphinx.ext.autodoc",
"sphinx_autodoc_typehints",
"sphinx.ext.ifconfig",
"sphinx.ext.autosummary",
"sphinx.ext.doctest",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
"sphinx.ext.githubpages",
"sphinx.ext.inheritance_diagram",
"sphinx.ext.graphviz",
"sphinx_copybutton",
"sphinx-prompt",
"notfound.extension",
"versionwarning.extension",
]

templates_path = ["_templates"]
source_suffix = ".rst"

# The master toctree document.
master_doc = "index"
language = "en"

exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]

# generate autosummary even if no references
autosummary_generate = True
autosummary_imported_members = True

# autodoc
autodoc_mock_imports = []
autodoc_typehints = "description"
autodoc_inherit_docstrings = True
autodoc_preserve_defaults = True
autodoc_default_options = {
"members": True,
"member-order": "bysource",
"special-members": "__init__",
"undoc-members": True,
"private-members": True,
"exclude-members": "__weakref__",
"show-inheritance": True,
"inherited-members": False,
}

# coverage
coverage_show_missing_items = True
coverage_skip_undoc_in_source = True

# syntax highlighting
pygments_style = "sphinx"
highlight_language = "python3"

# html
html_theme_options = {
"navigation_depth": 4,
"collapse_navigation": False,
"sticky_navigation": True,
"includehidden": True,
"titles_only": False,
"display_version": True,
}


# napoleon
napoleon_numpy_docstring = True

# todo-section
todo_include_todos = False

# inheritance diagrams
# smaller diagrams with rectangular nodes
inheritance_graph_attrs = {
"rankdir": "TB",
"size": '"6.0, 8.0"',
"fontsize": 12,
"ratio": "compress",
"bgcolor": "transparent",
}

inheritance_node_attrs = {
"shape": "rect",
"fontsize": 12,
"color": "orange",
"style": "filled",
"fillcolor": "white",
}

inheritance_edge_attrs = {
"arrowsize": 0.5,
"penwidth": 1.0,
"color": "orange",
}

# graphviz
graphviz_output_format = "svg"
graphviz_dot_args = [
"-Gbgcolor=transparent",
"-Nfontname=Helvetica",
"-Efontname=Helvetica",
"-Gfontname=Helvetica",
"-Gfontsize=12",
"-Nfontsize=12",
"-Efontsize=12",
]

# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = "pathfinding3d-doc"


# -- Options for LaTeX output ------------------------------------------------

latex_elements: dict = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files.
latex_documents = [
(master_doc, "pathfinding3d.tex", "pathfinding3d Documentation", "pathfinding3d Contributors", "manual"),
]

# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "pathfinding3d", "pathfinding3d Documentation", [author], 1)]

# -- Options for Texinfo output ----------------------------------------------

# Grouping the document tree into Texinfo files.
texinfo_documents = [
(
master_doc,
"pathfinding3d",
"pathfinding3d Documentation",
author,
"pathfinding3d",
"One line description of project.",
"Miscellaneous",
),
]
21 changes: 21 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.. pathfinding3d documentation master file, created by
sphinx-quickstart on Wed Nov 22 02:19:54 2023.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to pathfinding3d's documentation!
=========================================

.. toctree::
:maxdepth: 2
:caption: Contents:

modules


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
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=.
set BUILDDIR=_build

%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
)

if "%1" == "" goto help

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

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

:end
popd
7 changes: 7 additions & 0 deletions docs/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pathfinding3d
=============

.. toctree::
:maxdepth: 4

pathfinding3d
61 changes: 61 additions & 0 deletions docs/pathfinding3d.core.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
pathfinding3d.core package
==========================

Submodules
----------

pathfinding3d.core.diagonal\_movement module
--------------------------------------------

.. automodule:: pathfinding3d.core.diagonal_movement
:members:
:undoc-members:
:show-inheritance:

pathfinding3d.core.grid module
------------------------------

.. automodule:: pathfinding3d.core.grid
:members:
:undoc-members:
:show-inheritance:

pathfinding3d.core.heuristic module
-----------------------------------

.. automodule:: pathfinding3d.core.heuristic
:members:
:undoc-members:
:show-inheritance:

pathfinding3d.core.node module
------------------------------

.. automodule:: pathfinding3d.core.node
:members:
:undoc-members:
:show-inheritance:

pathfinding3d.core.util module
------------------------------

.. automodule:: pathfinding3d.core.util
:members:
:undoc-members:
:show-inheritance:

pathfinding3d.core.world module
-------------------------------

.. automodule:: pathfinding3d.core.world
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: pathfinding3d.core
:members:
:undoc-members:
:show-inheritance:
Loading

0 comments on commit 4e2f8c4

Please sign in to comment.