From 4d5ccd5367772316e20eb5157439017df0e8ad1d Mon Sep 17 00:00:00 2001 From: Jeff MacKinnon Date: Wed, 1 Jan 2025 14:11:06 -0400 Subject: [PATCH] Started the doumentation source --- .gitignore | 1 + docs/Makefile | 20 +++++++++++++++++++ docs/make.bat | 35 ++++++++++++++++++++++++++++++++ docs/source/conf.py | 27 +++++++++++++++++++++++++ docs/source/index.rst | 17 ++++++++++++++++ example_notebook.ipynb | 45 +++++++++++------------------------------- 6 files changed, 111 insertions(+), 34 deletions(-) create mode 100644 docs/Makefile create mode 100644 docs/make.bat create mode 100644 docs/source/conf.py create mode 100644 docs/source/index.rst diff --git a/.gitignore b/.gitignore index b8a936a..d791662 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ test* __pycache__ *.db +/docs/build/ \ No newline at end of file diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d0c3cbf --- /dev/null +++ b/docs/Makefile @@ -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) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..dc1312a --- /dev/null +++ b/docs/make.bat @@ -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 + +%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 diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..872241a --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,27 @@ +# 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 + +project = 'JMK Engineering Python Library' +copyright = '2025, Jeff MacKinnon' +author = 'Jeff MacKinnon' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [] + +templates_path = ['_templates'] +exclude_patterns = [] + + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'alabaster' +html_static_path = ['_static'] diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..fc877a5 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,17 @@ +.. JMK Engineering Python Library documentation master file, created by + sphinx-quickstart on Wed Jan 1 14:10:19 2025. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +JMK Engineering Python Library documentation +============================================ + +Add your content using ``reStructuredText`` syntax. See the +`reStructuredText `_ +documentation for details. + + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + diff --git a/example_notebook.ipynb b/example_notebook.ipynb index fa079c4..673500d 100644 --- a/example_notebook.ipynb +++ b/example_notebook.ipynb @@ -2,12 +2,12 @@ "cells": [ { "cell_type": "code", - "execution_count": 4, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import jepl.jepl as jmk # import the module. If this file is located further up the file tree it may look like \"resources.JEPL.jepl.jepl\"\n", - "%run jepl/jeplinit.py jepl/ # This is needed to initilize the databases. Again if you are running this from a different location the run command will look like %run jeplinit.py resources/JEPL/jepl/ " + "%run jepl/jeplinit.py jepl/ # This is needed to initialize the databases. Again if you are running this from a different location the run command will look like %run jeplinit.py resources/JEPL/jepl/ " ] }, { @@ -731,7 +731,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -740,7 +740,7 @@ "'3'" ] }, - "execution_count": 11, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -753,7 +753,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -762,7 +762,7 @@ "'0.3'" ] }, - "execution_count": 12, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -775,7 +775,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -784,7 +784,7 @@ "'0'" ] }, - "execution_count": 5, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -797,7 +797,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -806,7 +806,7 @@ "'00'" ] }, - "execution_count": 4, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -826,7 +826,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": {}, "outputs": [], "source": [ @@ -835,29 +835,6 @@ "af_label(\"equipnum\",\"3 ft\",3,\"36 in\",\"B\",480,author=\"Jeff MacKinnon\",warning=\"warning\",project=\"Arc Flash Warning Label\",test=True)\n", "\n" ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [], - "source": [ - "\n", - "from jinja2 import Environment, FileSystemLoader\n", - "\n", - "\n", - "environment = Environment( block_start_string = '\\BLOCK{',\n", - " block_end_string = '}',\n", - " variable_start_string = '\\VAR((',\n", - " variable_end_string = '))',\n", - " comment_start_string = '\\#{',\n", - " comment_end_string = '}',\n", - " line_comment_prefix = '%#',\n", - " loader=FileSystemLoader(\"jepl/templates/\")\n", - " )\n", - "template = environment.get_template(\"template-label-ArcFlash.tex\")\n", - "#print(environment.loader)" - ] } ], "metadata": {