Browse Source

Add automatic api documentation

Stan Janssen 4 years ago
parent
commit
eed093c395
3 changed files with 20 additions and 7 deletions
  1. 1 0
      VERSION
  2. 15 6
      docs/conf.py
  3. 4 1
      setup.py

+ 1 - 0
VERSION

@@ -0,0 +1 @@
+0.3.0

+ 15 - 6
docs/conf.py

@@ -10,9 +10,9 @@
 # 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('.'))
+import os
+import sys
+sys.path.insert(0, os.path.abspath('..'))
 
 
 # -- Project information -----------------------------------------------------
@@ -22,7 +22,9 @@ copyright = '2020, Stan Janssen'
 author = 'Stan Janssen'
 
 # The full version, including alpha/beta/rc tags
-release = '0.1.0'
+with open(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'VERSION')) as file:
+    release = file.read().strip()
+
 
 
 # -- General configuration ---------------------------------------------------
@@ -30,7 +32,11 @@ release = '0.1.0'
 # 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']
+extensions = ['sphinx.ext.autodoc', 'sphinxcontrib.apidoc']
+
+apidoc_module_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'pyopenadr')
+apidoc_excluded_paths = [os.path.join(apidoc_module_dir, 'service'),
+                         os.path.join(apidoc_module_dir, 'config.py')]
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
@@ -51,4 +57,7 @@ html_theme = 'alabaster'
 # 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']
+html_static_path = ['_static']
+
+def setup(app):
+    app.add_stylesheet('css/custom.css')  # may also be an URL

+ 4 - 1
setup.py

@@ -3,8 +3,11 @@ from setuptools import setup
 with open("README.md", "r") as fh:
     long_description = fh.read()
 
+with open(os.path.join(os.path.abspath(__file__), 'VERSION')) as file:
+    VERSION = file.read().strip()
+
 setup(name="pyopenadr",
-      version="0.2.4",
+      version=VERSION,
       description="Python library for dealing with OpenADR",
       long_description=long_description,
       long_description_content_type="text/markdown",