Skip to content

Commit

Permalink
Add sphinx docs and update .pre-commit-config.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
dormant-user committed Aug 13, 2024
1 parent 594b200 commit 4266107
Show file tree
Hide file tree
Showing 35 changed files with 17,056 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@ repos:
hooks:
- id: isort
args: [ --profile, black ]

- repo: local
hooks:
- id: docs
name: runbook
entry: /bin/bash pre_commit.sh
language: system
pass_filenames: false
always_run: true
20 changes: 20 additions & 0 deletions doc_gen/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)
84 changes: 84 additions & 0 deletions doc_gen/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# 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

import os
import pathlib
import sys

# Since pytest and docs run parallely, change the current dir and insert it to sys.path at index 0
os.chdir(pathlib.Path(__file__).parent.parent)
sys.path.insert(0, str(pathlib.Path(__file__).parent.parent))

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

project = "NCTL"
copyright = "2024, Vignesh Rao"
author = "Vignesh Rao"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#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.napoleon", # certain styles of doc strings
"sphinx.ext.autodoc", # generates from doc strings
"recommonmark", # supports markdown integration
]

# https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html#configuration
napoleon_google_docstring = True
napoleon_use_param = False

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

# 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 = ["_build", "Thumbs.db", ".DS_Store"]

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

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
# https://www.sphinx-doc.org/en/master/usage/theming.html#builtin-themes
html_theme = "classic"
html_theme_options = {"body_max_width": "80%"}

# 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"]

# Add docstrings from __init__ method
# This will also include __init__ docs from 'pydantic.BaseModel' and 'pydantic.BaseSettings'
# Reference: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autoclass_content
# autoclass_content = "both"

# Include private methods/functions
# Reference: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autodoc_default_options
autodoc_default_options = {
"members": True,
"undoc-members": True,
"private-members": True,
}

# Add support to mark down files in sphinx documentation
# Reference: https://www.sphinx-doc.org/en/1.5.3/markdown.html
source_suffix = {
".rst": "restructuredtext",
".txt": "markdown",
".md": "markdown",
}

# Retain the function/member order
# Reference: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autodoc_member_order
autodoc_member_order = "bysource"

# Make left pane scroll
html_css_files = ["static.css"]
55 changes: 55 additions & 0 deletions doc_gen/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.. NCTL documentation master file, created by
sphinx-quickstart on Tue Aug 13 09:58:45 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to NCTL's documentation!
================================

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

README

NCTL - Main
===========

.. automodule:: nctl.main

CloudFront
==========
.. automodule:: nctl.cloudfront

Logger
======

.. automodule:: nctl.logger

Models
======

.. autoclass:: nctl.models.Concurrency(BaseModel)
:exclude-members: _abc_impl, model_config, model_fields, model_computed_fields

====

.. autoclass:: pyninja.models.EnvConfig(BaseModel)
:exclude-members: _abc_impl, model_config, model_fields, model_computed_fields

====

.. automodule:: pyninja.models
:exclude-members: Concurrency, EnvConfig, concurrency, env

Squire
======

.. automodule:: nctl.squire

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

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
35 changes: 35 additions & 0 deletions doc_gen/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
Empty file added docs/.nojekyll
Empty file.
Loading

0 comments on commit 4266107

Please sign in to comment.