diff --git a/Pipfile b/Pipfile index dc64316b7bd68db138a84459f1b019e74151ec27..13f0fada642d4fdfcbdcff3111e21898b538cfa1 100644 --- a/Pipfile +++ b/Pipfile @@ -23,6 +23,7 @@ Sphinx = "*" sphinx_rtd_theme = "*" sphinx-autobuild = "*" sphinxcontrib-websupport = "*" +recommonmark = "*" [dev-packages] diff --git a/README.md b/README.md index 2cf4aabe72fe54057c614ffc703d20ca57806b29..fb516253ce59bf3d32db97bca14dda9eb7f55961 100644 --- a/README.md +++ b/README.md @@ -66,8 +66,13 @@ Writing documentation -------------------- * The documentation generator for this project is derived from SKA's [SKA Developer Portal repository](https://github.com/ska-telescope/developer.skatelescope.org) * The documentation can be edited under `./docs/src` + * If you want to include only your README.md file, create a symbolic link inside the `./docs/src` directory if the existing one does not work: + ```bash +$ cd docs/src +$ ln -s ../../README.md README.md +``` * In order to build the documentation for this specific project, execute the following under `./docs`: ```bash -> make html +$ make html ``` * The documentation can then be consulted by opening the file `./docs/build/html/index.html` diff --git a/docs/Makefile b/docs/Makefile index 4164814c011579259a8076044396258e843722ed..d8667e3824a30f725bc0feb49d6d96cbb53013a7 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,3 +1,4 @@ +SHELL := /bin/bash # Minimal makefile for Sphinx documentation # @@ -18,3 +19,4 @@ help: # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + diff --git a/docs/src/README.md b/docs/src/README.md new file mode 120000 index 0000000000000000000000000000000000000000..fe840054137e2ccda075344f21e728249a60a2fc --- /dev/null +++ b/docs/src/README.md @@ -0,0 +1 @@ +../../README.md \ No newline at end of file diff --git a/docs/src/conf.py b/docs/src/conf.py index 3350dca43ef025297ff3107dc0605479a084e05e..8ee1cc513e6a55fa19f443f71a616d088548b9e4 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -17,9 +17,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('../..')) import sphinx_rtd_theme def setup(app): @@ -36,6 +36,7 @@ def setup(app): # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = ['sphinx.ext.autodoc', + 'sphinx.ext.napoleon', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', @@ -43,7 +44,8 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.mathjax', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode', - 'sphinx.ext.githubpages'] + 'sphinx.ext.githubpages', + 'recommonmark'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -51,8 +53,8 @@ templates_path = ['_templates'] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # -# source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ['.rst', '.md'] +# source_suffix = '.rst' # The master toctree document. master_doc = 'index' diff --git a/docs/src/index.rst b/docs/src/index.rst index d10b376096502eca3716f0c81fba8ac1a98f7171..3443f7b2002e69d06128b18a037ffe7ac7730d02 100644 --- a/docs/src/index.rst +++ b/docs/src/index.rst @@ -9,27 +9,36 @@ .. Hidden toctree to manage the sidebar navigation. .. toctree:: - :maxdepth: 1 + :maxdepth: 2 :caption: Home :hidden: +.. README ============================================================= + +.. This project most likely has it's own README. We include it here. + +.. toctree:: + :maxdepth: 2 + :caption: Readme + + README + .. COMMUNITY SECTION ================================================== -.. Hidden toctree to manage the sidebar navigation. +.. .. toctree:: - :maxdepth: 1 + :maxdepth: 2 :caption: Package-name :hidden: package/guide - -Package-name documentation +Project-name documentation ========================== -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +These are all the packages, functions and scripts that form part of the project. - :doc:`package/guide` diff --git a/docs/src/package/guide.rst b/docs/src/package/guide.rst index 17b0e69e92fc3978c125cd2a6167b3faa1ce9d49..9b3c93ede725b65624354dfa6829919d0de18748 100644 --- a/docs/src/package/guide.rst +++ b/docs/src/package/guide.rst @@ -14,3 +14,19 @@ Subtitle ======== Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + +.. Automatic API Documentation section. Generating the API from the docstrings. Modify / change the directory structure as you like + +Public API Documentation +```````````````````````` +Functions +--------- + +.. automodule:: ska_python_skeleton.ska_python_skeleton + :members: + +Classes +------- +.. autoclass:: ska_python_skeleton.ska_python_skeleton.SKA + :noindex: + :members: diff --git a/ska_python_skeleton/ska_python_skeleton.py b/ska_python_skeleton/ska_python_skeleton.py index 6a6f6e5aaa163d8aa44556ec4ccd2b5e451f3487..7dd613e2c0084d4a358082667939c3fb70b994b7 100644 --- a/ska_python_skeleton/ska_python_skeleton.py +++ b/ska_python_skeleton/ska_python_skeleton.py @@ -1,13 +1,22 @@ # -*- coding: utf-8 -*- -"""Define function placeholders and test function examples.""" +#"""Define function placeholders and test function examples.""" # TODO: Replace all the following code with the desired functionality for the package -def example(): - """Example: Define non return function for subsequent test.""" +def function_example(): + """Example: function outside of a class""" -def testing_example(): - """Example: Define function for subsequent test with specific return value.""" - return 2 +# TODO: Replace all the following code with the desired functionality for the package +class SKA: + """Define class, methods etc""" + + something = 0 + + def example(self): + """Example: Define non return function for subsequent test.""" + + def example_2(self): + """Example: Define function for subsequent test with specific return value.""" + return 2 diff --git a/tests/test_ska_skeleton.py b/tests/test_ska_skeleton.py index 4d526b11234f1fb8c68c30bbc0c77e80ddd77ec3..553d1790b64aa674ab19afa33393738b8729d40e 100644 --- a/tests/test_ska_skeleton.py +++ b/tests/test_ska_skeleton.py @@ -34,5 +34,7 @@ def test_ska_python_skeleton(an_object): def test_package(): """Example: Assert the ska_python_skeleton package code.""" - assert ska_python_skeleton.example() is None - assert ska_python_skeleton.testing_example() == 2 + assert ska_python_skeleton.function_example() is None + foo = ska_python_skeleton.SKA() + assert foo.example_2() == 2 + assert foo.example() is None