Skip to content

Instantly share code, notes, and snippets.

@dsdanielpark
Last active January 23, 2024 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsdanielpark/a64faa6357d3c3e2e209faea278f7230 to your computer and use it in GitHub Desktop.
Save dsdanielpark/a64faa6357d3c3e2e209faea278f7230 to your computer and use it in GitHub Desktop.
shpinx auto doc

Shpinx

Installation

pip install Sphinx

Quick start

mkdir docs
cd docs
sphinx-quickstart

seperate ==> N

  1. set conf.py
# 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
# 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.
#sys.path.insert(0, os.path.abspath('.'))

# This will include the necessary source files folders in the PATH to be able to generate the documentation from.
# devdir=r'C:\Users\parkm\Desktop\git\ExceptionNotifier'
# try:
#     if os.environ['DEVDIR']:
#         devdir = os.environ['DEVDIR'] 
# except KeyError:
#     print('Unable to obtain $DEVDIR from the environment.')
#     pass

sys.path.insert(0, os.path.abspath('../..'))
sys.setrecursionlimit(1500)


# Ensure that the __init__ method gets documented.
def skip(app, what, name, obj, skip, options):
    if name == "__init__":
        return False
    return skip



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

project = 'ExceptNotifier'
copyright = '2023, MinWoo Park'
author = 'MinWoo Park'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build', '**tests**', '**spi**']

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


# -- 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.todo'
]

# ,'sphinx.ext.napoleon'

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
todo_include_todos = True
# 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 = 'sphinx_rtd_theme'

# 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 = ['_static']

# sys.path.insert(0, os.path.abspath(r'C:\Users\parkm\Desktop\git\ExceptionNotifier\ExceptNotifier'))
  1. set index.rst
  2. use auto doc
cd ..
sphinx-apidoc -F -o ./docs/source ./ExceptNotifier
cd docs                                           
make html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment