diff --git a/.gitignore b/.gitignore index 341bfea4f1381b6eb59e548f395859bad35520d7..beb02de67c1142a17584c9dacbc92286e9b8f12b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,6 @@ __pycache__/ dist/ build/ src/caosdb/version.py + +# documentation +_apidoc \ No newline at end of file diff --git a/Makefile b/Makefile index 393a3330c611a23ab7b9ecde023a12bb97fa1c90..4bc3459d209936c17a445c64e77180d9559e4653 100644 --- a/Makefile +++ b/Makefile @@ -20,23 +20,14 @@ # ** end header # This Makefile is a wrapper for several other scripts. -# -# It is based upon the autocreated 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 = src -BUILDDIR = build +.PHONY: help -.PHONY: doc-help Makefile +help: + @echo 'Type `make doc` for documentation, or `make install` for (local) installation.' -# Put it first so that "make" without argument is like "make help". -doc-help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) +doc: + $(MAKE) -C src/doc html -# 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) +install: + @echo "Not implemented yet, use pip for installation." diff --git a/src/caosdb/__init__.py b/src/caosdb/__init__.py index 75847bb15b8a64345119e0f0aefc00bd9f116081..1989080f4bcf6eb043a8ec8424418eb4c20d652d 100644 --- a/src/caosdb/__init__.py +++ b/src/caosdb/__init__.py @@ -22,6 +22,9 @@ # ** end header # +"""CaosDB Python bindings +""" + from os import environ, getcwd # Import of the connection function (which is used to connect to the DB): from os.path import expanduser, join diff --git a/src/caosdb/common/__init__.py b/src/caosdb/common/__init__.py index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..436281df8077b2cbf357537d36b21567b86ea5a2 100644 --- a/src/caosdb/common/__init__.py +++ b/src/caosdb/common/__init__.py @@ -0,0 +1 @@ +"""Commonly used classes for CaosDB.""" diff --git a/src/doc/Makefile b/src/doc/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..b7a593260447d3a62fcd6a6090e76e7781720335 --- /dev/null +++ b/src/doc/Makefile @@ -0,0 +1,46 @@ +# ** header v3.0 +# This file is a part of the CaosDB Project. +# +# Copyright (C) 2020 IndiScale GmbH <info@indiscale.com> +# Copyright (C) 2020 Daniel Hornung <d.hornung@indiscale.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# +# ** end header + +# This Makefile is a wrapper for sphinx scripts. +# +# It is based upon the autocreated 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 +SPHINXAPIDOC ?= sphinx-apidoc +SOURCEDIR = . +BUILDDIR = ../../build/doc + +.PHONY: doc-help Makefile + +# Put it first so that "make" without argument is like "make help". +doc-help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile apidoc + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +apidoc: + @$(SPHINXAPIDOC) -o _apidoc ../caosdb diff --git a/src/conf.py b/src/doc/conf.py similarity index 96% rename from src/conf.py rename to src/doc/conf.py index c2682b368bddf4d50a278af90fc9bf518a62e47c..9e89cf68cf31c4b75d4b8c8342e1ce723b5b8e13 100644 --- a/src/conf.py +++ b/src/doc/conf.py @@ -41,6 +41,7 @@ release = '0.x.y-beta-rc2' extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.intersphinx', + 'sphinx.ext.napoleon', # For Google style docstrings ] # Add any paths that contain templates here, relative to this directory. @@ -181,3 +182,9 @@ epub_exclude_files = ['search.html'] # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {'https://docs.python.org/': None} + +# TODO Which options do we want? +autodoc_default_options = { + 'members': None, + 'undoc-members': None, +} diff --git a/src/doc/index.rst b/src/doc/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..07b49267571f3f8dcf2ff259c3b6184f9279f6ce --- /dev/null +++ b/src/doc/index.rst @@ -0,0 +1,15 @@ + +Welcome to caosdb-pylib's documentation! +======================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/src/index.rst b/src/index.rst deleted file mode 100644 index e7dbee6391297aa2cfe02d87a3815c6d84c20e26..0000000000000000000000000000000000000000 --- a/src/index.rst +++ /dev/null @@ -1,22 +0,0 @@ -.. caosdb-pylib documentation master file, created by - sphinx-quickstart on Wed Nov 18 17:40:20 2020. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to caosdb-pylib's documentation! -======================================== - -.. toctree:: - :maxdepth: 2 - :caption: Contents: - -.. automodule:: caosdb - :members: - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search`