diff --git a/.gitignore b/.gitignore index b00d2a3ec..c65a12729 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ __pycache__ .pytest_cache *.pyc data +docs/_build/ Pipfile.lock projects.cfg venv/ diff --git a/Pipfile b/Pipfile index 52c3c66f0..98e33ed98 100644 --- a/Pipfile +++ b/Pipfile @@ -11,6 +11,9 @@ pytest-flask = "*" "pytest-pep8" = "*" swagger-tester = "*" bumpversion = "*" +sphinx = "*" +sphinx-rtd-theme = "*" +pipenv-to-requirements = "*" [packages] "e1839a8" = {editable = true, path = "."} diff --git a/autopep8.sh b/autopep8.sh index 8b00e1a80..eef99e49b 100755 --- a/autopep8.sh +++ b/autopep8.sh @@ -2,9 +2,9 @@ if [ "$1" = "-i" ]; then echo "Running autopep8 in in-place mode." - exec autopep8 -i -j0 -a -a -r annif tests *.py + exec autopep8 -i -j0 -a -a -r annif tests docs *.py else echo "Running autopep8 in diff mode. Use -i for in-place mode." echo "" - exec autopep8 -d -a -a -r annif tests *.py + exec autopep8 -d -a -a -r annif tests docs *.py fi diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 000000000..298ea9e21 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,19 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +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) \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 000000000..641f62a95 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,65 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# http://www.sphinx-doc.org/en/master/config + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# 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 re +import sys +sys.path.insert(0, os.path.abspath('..')) + + +# -- Project information ----------------------------------------------------- + +project = 'annif' +copyright = '2017, University Of Helsinki (The National Library Of Finland)' +author = 'Osma Suominen' + +# Get version number from GitHub tag +release = re.sub( + '^v', + '', + os.popen('git describe --tags --abbrev=0').read().strip() +) +# The short X.Y version. +version = release + + +# -- General configuration --------------------------------------------------- + +master_doc = 'index' + +# 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' +] + +# 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. +# +html_theme = 'sphinx_rtd_theme' + +# 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'] diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 000000000..1310386df --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,26 @@ +.. annif documentation master file, created by + sphinx-quickstart on Tue May 14 14:24:19 2019. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Annif's API documentation! +===================================== + +See `installation instructions `_ and `Wiki pages `_ in GitHub, and also http://annif.org/. + +You are reading documentation for version |version|. + + +.. toctree:: + :maxdepth: 3 + :caption: Annif API Reference: + + source/annif + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/source/annif.analyzer.rst b/docs/source/annif.analyzer.rst new file mode 100644 index 000000000..990b461b5 --- /dev/null +++ b/docs/source/annif.analyzer.rst @@ -0,0 +1,43 @@ +annif.analyzer package +====================== + +annif.analyzer.analyzer module +------------------------------ + +.. automodule:: annif.analyzer.analyzer + :members: + :undoc-members: + :show-inheritance: + +annif.analyzer.simple module +---------------------------- + +.. automodule:: annif.analyzer.simple + :members: + :undoc-members: + :show-inheritance: + +annif.analyzer.snowball module +------------------------------ + +.. automodule:: annif.analyzer.snowball + :members: + :undoc-members: + :show-inheritance: + +annif.analyzer.voikko module +---------------------------- + +.. automodule:: annif.analyzer.voikko + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: annif.analyzer + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/annif.backend.rst b/docs/source/annif.backend.rst new file mode 100644 index 000000000..2b9cef414 --- /dev/null +++ b/docs/source/annif.backend.rst @@ -0,0 +1,83 @@ +annif.backend package +===================== + +annif.backend.backend module +---------------------------- + +.. automodule:: annif.backend.backend + :members: + :undoc-members: + :show-inheritance: + +annif.backend.dummy module +-------------------------- + +.. automodule:: annif.backend.dummy + :members: + :undoc-members: + :show-inheritance: + +annif.backend.ensemble module +----------------------------- + +.. automodule:: annif.backend.ensemble + :members: + :undoc-members: + :show-inheritance: + +annif.backend.fasttext module +----------------------------- + +.. automodule:: annif.backend.fasttext + :members: + :undoc-members: + :show-inheritance: + +annif.backend.http module +------------------------- + +.. automodule:: annif.backend.http + :members: + :undoc-members: + :show-inheritance: + +annif.backend.mixins module +--------------------------- + +.. automodule:: annif.backend.mixins + :members: + :undoc-members: + :show-inheritance: + +annif.backend.pav module +------------------------ + +.. automodule:: annif.backend.pav + :members: + :undoc-members: + :show-inheritance: + +annif.backend.tfidf module +-------------------------- + +.. automodule:: annif.backend.tfidf + :members: + :undoc-members: + :show-inheritance: + +annif.backend.vw\_multi module +------------------------------ + +.. automodule:: annif.backend.vw_multi + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: annif.backend + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/annif.corpus.rst b/docs/source/annif.corpus.rst new file mode 100644 index 000000000..95596d11a --- /dev/null +++ b/docs/source/annif.corpus.rst @@ -0,0 +1,60 @@ +annif.corpus package +==================== + + +annif.corpus.combine module +--------------------------- + +.. automodule:: annif.corpus.combine + :members: + :undoc-members: + :show-inheritance: + +annif.corpus.convert module +--------------------------- + +.. automodule:: annif.corpus.convert + :members: + :undoc-members: + :show-inheritance: + +annif.corpus.document module +---------------------------- + +.. automodule:: annif.corpus.document + :members: + :undoc-members: + :show-inheritance: + +annif.corpus.skos module +------------------------ + +.. automodule:: annif.corpus.skos + :members: + :undoc-members: + :show-inheritance: + +annif.corpus.subject module +--------------------------- + +.. automodule:: annif.corpus.subject + :members: + :undoc-members: + :show-inheritance: + +annif.corpus.types module +------------------------- + +.. automodule:: annif.corpus.types + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: annif.corpus + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/annif.rst b/docs/source/annif.rst new file mode 100644 index 000000000..a616b47d6 --- /dev/null +++ b/docs/source/annif.rst @@ -0,0 +1,105 @@ +annif package +============= + +.. toctree:: + + annif.analyzer + annif.backend + annif.corpus + +annif.cli module +---------------- + +.. automodule:: annif.cli + :members: + :undoc-members: + :show-inheritance: + +annif.datadir module +-------------------- + +.. automodule:: annif.datadir + :members: + :undoc-members: + :show-inheritance: + +annif.default\_config module +---------------------------- + +.. automodule:: annif.default_config + :members: + :undoc-members: + :show-inheritance: + +annif.eval module +----------------- + +.. automodule:: annif.eval + :members: + :undoc-members: + :show-inheritance: + +annif.exception module +---------------------- + +.. automodule:: annif.exception + :members: + :undoc-members: + :show-inheritance: + +annif.project module +-------------------- + +.. automodule:: annif.project + :members: + :undoc-members: + :show-inheritance: + +annif.rest module +----------------- + +.. automodule:: annif.rest + :members: + :undoc-members: + :show-inheritance: + +annif.suggestion module +----------------------- + +.. automodule:: annif.suggestion + :members: + :undoc-members: + :show-inheritance: + +annif.util module +----------------- + +.. automodule:: annif.util + :members: + :undoc-members: + :show-inheritance: + +annif.views module +------------------ + +.. automodule:: annif.views + :members: + :undoc-members: + :show-inheritance: + +annif.vocab module +------------------ + +.. automodule:: annif.vocab + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: annif + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/modules.rst b/docs/source/modules.rst new file mode 100644 index 000000000..d33c6f1cc --- /dev/null +++ b/docs/source/modules.rst @@ -0,0 +1,7 @@ +annif +===== + +.. toctree:: + :maxdepth: 4 + + annif diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 000000000..626bad7d2 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,21 @@ +################################################################################ +# This requirements file has been automatically generated from `Pipfile` with +# `pipenv-to-requirements` +# +# +# This has been done to maintain backward compatibility with tools and services +# that do not support `Pipfile` yet. +# +# Do NOT edit it directly, use `pipenv install [-d]` to modify `Pipfile` and +# `Pipfile.lock` and then regenerate `requirements*.txt`. +################################################################################ + +bumpversion +codecov +pytest-cov +pytest-flask +pytest-pep8 +pytest-watch +sphinx +sphinx-rtd-theme +swagger-tester diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..beec080a5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,22 @@ +################################################################################ +# This requirements file has been automatically generated from `Pipfile` with +# `pipenv-to-requirements` +# +# +# This has been done to maintain backward compatibility with tools and services +# that do not support `Pipfile` yet. +# +# Do NOT edit it directly, use `pipenv install [-d]` to modify `Pipfile` and +# `Pipfile.lock` and then regenerate `requirements*.txt`. +################################################################################ + +-e . +click-log +connexion[swagger-ui] +flask-cors +gensim +joblib +nltk +rdflib +sklearn +swagger-ui-bundle