[PATCH 1 of 5 logilab-common V2] [doc] migrate documentation to sphinx using sphinx-apidoc and including README

Laurent Peuch cortex at worlddomination.be
Wed Jun 19 20:09:55 CEST 2019


# HG changeset patch
# User Laurent Peuch <cortex at worlddomination.be>
# Date 1558614739 -7200
#      Thu May 23 14:32:19 2019 +0200
# Node ID a2ca76c8f9f85d168f038fa92be51895878dd1e1
# Parent  565bb2743d188176e1743f767b9dc799ab093178
[doc] migrate documentation to sphinx using sphinx-apidoc and including README

The rationnal to do this migration are:

* be able to host the documentation on readthedocs.org, right now, according to
  the README, the user needs to built it locally to be able to read it
* epydoc is not maintained anymore
* sphinx generally offer a better user experience and allow to write real
  documentation instead of just generating an API
* it was quick to do with sphinx-apidoc and seems worth it to be able to put it
  online

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -9,3 +9,4 @@
 \,cover$
 ^\.coverage$
 ^.tox$
+doc/_build/
diff --git a/doc/Makefile b/doc/Makefile
new file mode 100644
--- /dev/null
+++ b/doc/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/doc/conf.py b/doc/conf.py
new file mode 100644
--- /dev/null
+++ b/doc/conf.py
@@ -0,0 +1,185 @@
+# -*- coding: utf-8 -*-
+#
+# Configuration file for the Sphinx documentation builder.
+#
+# This file does only contain 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 sys
+sys.path.insert(0, os.path.abspath('..'))
+
+
+# -- Project information -----------------------------------------------------
+
+project = u'logilab common'
+copyright = u'2019, Logilab'
+author = u'Logilab'
+
+# The short X.Y version
+version = u''
+# The full version, including alpha/beta/rc tags
+release = u''
+
+
+# -- General configuration ---------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#
+# needs_sphinx = '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',
+    'sphinx.ext.intersphinx',
+    'sphinx.ext.coverage',
+    'sphinx.ext.viewcode',
+]
+
+# Add any paths that contain templates here, relative to this directory.
+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'
+
+# The master toctree document.
+master_doc = 'index'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#
+# This is also used if you do content translation via gettext catalogs.
+# Usually you set "language" from the command line for these cases.
+language = None
+
+# 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 = [u'_build', 'Thumbs.db', '.DS_Store']
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = None
+
+
+# -- 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 = 'alabaster'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#
+# html_theme_options = {}
+
+# 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']
+
+# Custom sidebar templates, must be a dictionary that maps document names
+# to template names.
+#
+# The default sidebars (for documents that don't match any pattern) are
+# defined by theme itself.  Builtin themes are using these templates by
+# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
+# 'searchbox.html']``.
+#
+# html_sidebars = {}
+
+
+# -- Options for HTMLHelp output ---------------------------------------------
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'logilabcommondoc'
+
+
+# -- Options for LaTeX output ------------------------------------------------
+
+latex_elements = {
+    # The paper size ('letterpaper' or 'a4paper').
+    #
+    # 'papersize': 'letterpaper',
+
+    # The font size ('10pt', '11pt' or '12pt').
+    #
+    # 'pointsize': '10pt',
+
+    # Additional stuff for the LaTeX preamble.
+    #
+    # 'preamble': '',
+
+    # Latex figure (float) alignment
+    #
+    # 'figure_align': 'htbp',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+#  author, documentclass [howto, manual, or own class]).
+latex_documents = [
+    (master_doc, 'logilabcommon.tex', u'logilab common Documentation',
+     u'Logilab', 'manual'),
+]
+
+
+# -- Options for manual page output ------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    (master_doc, 'logilabcommon', u'logilab common Documentation',
+     [author], 1)
+]
+
+
+# -- Options for Texinfo output ----------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+#  dir menu entry, description, category)
+texinfo_documents = [
+    (master_doc, 'logilabcommon', u'logilab common Documentation',
+     author, 'logilabcommon', 'One line description of project.',
+     'Miscellaneous'),
+]
+
+
+# -- Options for Epub output -------------------------------------------------
+
+# Bibliographic Dublin Core info.
+epub_title = project
+
+# The unique identifier of the text. This can be a ISBN number
+# or the project homepage.
+#
+# epub_identifier = ''
+
+# A unique identification for the text.
+#
+# epub_uid = ''
+
+# A list of files that should not be packed into the epub file.
+epub_exclude_files = ['search.html']
+
+
+# -- Extension configuration -------------------------------------------------
+
+# -- Options for intersphinx extension ---------------------------------------
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {'https://docs.python.org/': None}
diff --git a/doc/index.rst b/doc/index.rst
new file mode 100644
--- /dev/null
+++ b/doc/index.rst
@@ -0,0 +1,169 @@
+.. logilab common documentation master file, created by
+   sphinx-quickstart on Thu May 23 03:36:04 2019.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Welcome to logilab common's documentation!
+==========================================
+
+Logilab common's is a bunch of modules providing low level functionnalities
+shared among some python projects devel by Logilab.
+
+What's this ?
+-------------
+
+This package contains some modules used by different Logilab projects.
+
+It is released under the GNU Lesser General Public License.
+
+There is no documentation available yet but the source code should be clean and
+well documented.
+
+Designed to ease:
+
+* handling command line options and configuration files
+* writing interactive command line tools
+* manipulation of files and character strings
+* manipulation of common structures such as graph, tree, and pattern such as visitor
+* generating text and HTML reports
+* more...
+
+
+Installation
+------------
+
+Extract the tarball, jump into the created directory and run ::
+
+    python setup.py install
+
+For installation options, see ::
+
+    python setup.py install --help
+
+
+Provided modules
+----------------
+
+Here is a brief description of the available modules.
+
+Modules providing high-level features
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* :ref:`cache <cache>`, a cache implementation with a least recently used algorithm.
+
+* :ref:`changelog <changelog>`, a tiny library to manipulate our simplified ChangeLog file format.
+
+* :ref:`clcommands <clcommands>`, high-level classes to define command line programs handling
+  different subcommands. It is based on `configuration` to get easy command line
+  / configuration file handling.
+
+* :ref:`configuration <configuration>`, some classes to handle unified configuration from both
+  command line (using optparse) and configuration file (using ConfigParser).
+
+* :ref:`proc <proc>`, interface to Linux /proc.
+
+* :ref:`umessage <umessage>`, unicode email support.
+
+* :ref:`ureports <ureports>`, micro-reports, a way to create simple reports using python objects
+  without care of the final formatting. ReST and html formatters are provided.
+
+
+Modules providing low-level functions and structures
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* :ref:`compat <compat>`, provides a transparent compatibility layer between different python
+  versions.
+
+* :ref:`date <date>`, a set of date manipulation functions.
+
+* :ref:`daemon <daemon>`, a daemon function and mix-in class to properly start an Unix daemon
+  process.
+
+* :ref:`decorators <decorators>`, function decorators such as cached, timed...
+
+* :ref:`deprecation <deprecation>`, decorator, metaclass & all to mark functions / classes as
+  deprecated or moved
+
+* :ref:`fileutils <fileutils>`, some file / file path manipulation utilities.
+
+* :ref:`graph <graph>`, graph manipulations functions such as cycle detection, bases for dot
+  file generation.
+
+* :ref:`modutils <modutils>`, python module manipulation functions.
+
+* :ref:`shellutils <shellutils>`, some powerful shell like functions to replace shell scripts with
+  python scripts.
+
+* :ref:`tasksqueue <tasksqueue>`, a prioritized tasks queue implementation.
+
+* :ref:`textutils <textutils>`, some text manipulation functions (ansi colorization, line wrapping,
+  rest support...).
+
+* :ref:`tree <tree>`, base class to represent tree structure, and some others to make it
+  works with the visitor implementation (see below).
+
+* :ref:`visitor <visitor>`, a generic visitor pattern implementation.
+
+
+Modules extending some standard modules
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* :ref:`debugger <debugger>`,  `pdb` customization.
+
+* :ref:`logging_ext <logging_ext>`, extensions to `logging` module such as a colorized formatter
+  and an easier initialization function.
+
+* :ref:`optik_ext <optik_ext>`, defines some new option types (regexp, csv, color, date, etc.)
+  for `optik` / `optparse`
+
+
+Modules extending some external modules
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* :ref:`sphinx_ext <sphinx_ext>`, Sphinx_ plugin defining a `autodocstring` directive.
+
+* :ref:`vcgutils <vcgutils>` , utilities functions to generate file readable with Georg Sander's
+  vcg tool (Visualization of Compiler Graphs).
+
+
+To be deprecated modules
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Those `logilab.common` modules will much probably be deprecated in future
+versions:
+
+* `testlib`: use `unittest2`_ instead
+* `interface`: use `zope.interface`_ if you really want this
+* `table`, `xmlutils`: is that used?
+* `sphinxutils`: we won't go that way imo (i == syt)
+
+
+Comments, support, bug reports
+------------------------------
+
+Project page https://www.logilab.org/project/logilab-common
+
+Use the python-projects at lists.logilab.org mailing list.
+
+You can subscribe to this mailing list at
+https://lists.logilab.org/mailman/listinfo/python-projects
+
+Archives are available at
+https://lists.logilab.org/pipermail/python-projects/
+
+
+.. _Sphinx: http://sphinx.pocoo.org/
+.. _`unittest2`: http://pypi.python.org/pypi/unittest2
+.. _`discover`: http://pypi.python.org/pypi/discover
+.. _`zope.interface`: http://pypi.python.org/pypi/zope.interface
+
+.. toctree::
+   :maxdepth: 2
+   :caption: Contents:
+
+Indices and tables
+==================
+
+* `genindex`
+* `modindex`
+* `search`
diff --git a/doc/logilab.common.rst b/doc/logilab.common.rst
new file mode 100644
--- /dev/null
+++ b/doc/logilab.common.rst
@@ -0,0 +1,320 @@
+logilab.common package
+======================
+
+Subpackages
+-----------
+
+.. toctree::
+
+    logilab.common.ureports
+
+Submodules
+----------
+
+.. _cache:
+
+logilab.common.cache module
+---------------------------
+
+.. automodule:: logilab.common.cache
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _changelog:
+
+logilab.common.changelog module
+-------------------------------
+
+.. automodule:: logilab.common.changelog
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _clcommands:
+logilab.common.clcommands module
+--------------------------------
+
+.. automodule:: logilab.common.clcommands
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _compat:
+logilab.common.compat module
+----------------------------
+
+.. automodule:: logilab.common.compat
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _configuration:
+logilab.common.configuration module
+-----------------------------------
+
+.. automodule:: logilab.common.configuration
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _daemon:
+logilab.common.daemon module
+----------------------------
+
+.. automodule:: logilab.common.daemon
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _date:
+logilab.common.date module
+--------------------------
+
+.. automodule:: logilab.common.date
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _debugger:
+logilab.common.debugger module
+------------------------------
+
+.. automodule:: logilab.common.debugger
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _decorators:
+logilab.common.decorators module
+--------------------------------
+
+.. automodule:: logilab.common.decorators
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _deprecation:
+logilab.common.deprecation module
+---------------------------------
+
+.. automodule:: logilab.common.deprecation
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _fileutils:
+logilab.common.fileutils module
+-------------------------------
+
+.. automodule:: logilab.common.fileutils
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _graph:
+logilab.common.graph module
+---------------------------
+
+.. automodule:: logilab.common.graph
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _interface:
+logilab.common.interface module
+-------------------------------
+
+.. automodule:: logilab.common.interface
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _logging_ext:
+logilab.common.logging\_ext module
+----------------------------------
+
+.. automodule:: logilab.common.logging_ext
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _modutils:
+logilab.common.modutils module
+------------------------------
+
+.. automodule:: logilab.common.modutils
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _optik_ext:
+logilab.common.optik\_ext module
+--------------------------------
+
+.. automodule:: logilab.common.optik_ext
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _optparser:
+logilab.common.optparser module
+-------------------------------
+
+.. automodule:: logilab.common.optparser
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _proc:
+logilab.common.proc module
+--------------------------
+
+.. automodule:: logilab.common.proc
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _pytest:
+logilab.common.pytest module
+----------------------------
+
+.. automodule:: logilab.common.pytest
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _registry:
+logilab.common.registry module
+------------------------------
+
+.. automodule:: logilab.common.registry
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _shellutils:
+logilab.common.shellutils module
+--------------------------------
+
+.. automodule:: logilab.common.shellutils
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _sphinx_ext:
+logilab.common.sphinx\_ext module
+---------------------------------
+
+.. automodule:: logilab.common.sphinx_ext
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _sphinxutils:
+logilab.common.sphinxutils module
+---------------------------------
+
+.. automodule:: logilab.common.sphinxutils
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _table:
+logilab.common.table module
+---------------------------
+
+.. automodule:: logilab.common.table
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _tasksqueue:
+logilab.common.tasksqueue module
+--------------------------------
+
+.. automodule:: logilab.common.tasksqueue
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _testlib:
+logilab.common.testlib module
+-----------------------------
+
+.. automodule:: logilab.common.testlib
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _textutils:
+logilab.common.textutils module
+-------------------------------
+
+.. automodule:: logilab.common.textutils
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _tree:
+logilab.common.tree module
+--------------------------
+
+.. automodule:: logilab.common.tree
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _umessage:
+logilab.common.umessage module
+------------------------------
+
+.. automodule:: logilab.common.umessage
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _urllib2ext:
+logilab.common.urllib2ext module
+--------------------------------
+
+.. automodule:: logilab.common.urllib2ext
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _vcgutils:
+logilab.common.vcgutils module
+------------------------------
+
+.. automodule:: logilab.common.vcgutils
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _visitor:
+logilab.common.visitor module
+-----------------------------
+
+.. automodule:: logilab.common.visitor
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+.. _xmlutils:
+logilab.common.xmlutils module
+------------------------------
+
+.. automodule:: logilab.common.xmlutils
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+
+Module contents
+---------------
+
+.. automodule:: logilab.common
+    :members:
+    :undoc-members:
+    :show-inheritance:
diff --git a/doc/logilab.common.ureports.rst b/doc/logilab.common.ureports.rst
new file mode 100644
--- /dev/null
+++ b/doc/logilab.common.ureports.rst
@@ -0,0 +1,48 @@
+.. _ureports:
+
+logilab.common.ureports package
+===============================
+
+Submodules
+----------
+
+logilab.common.ureports.docbook\_writer module
+----------------------------------------------
+
+.. automodule:: logilab.common.ureports.docbook_writer
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+logilab.common.ureports.html\_writer module
+-------------------------------------------
+
+.. automodule:: logilab.common.ureports.html_writer
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+logilab.common.ureports.nodes module
+------------------------------------
+
+.. automodule:: logilab.common.ureports.nodes
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+logilab.common.ureports.text\_writer module
+-------------------------------------------
+
+.. automodule:: logilab.common.ureports.text_writer
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+
+Module contents
+---------------
+
+.. automodule:: logilab.common.ureports
+    :members:
+    :undoc-members:
+    :show-inheritance:
diff --git a/doc/logilab.rst b/doc/logilab.rst
new file mode 100644
--- /dev/null
+++ b/doc/logilab.rst
@@ -0,0 +1,17 @@
+logilab package
+===============
+
+Subpackages
+-----------
+
+.. toctree::
+
+    logilab.common
+
+Module contents
+---------------
+
+.. automodule:: logilab
+    :members:
+    :undoc-members:
+    :show-inheritance:
diff --git a/doc/make.bat b/doc/make.bat
new file mode 100644
--- /dev/null
+++ b/doc/make.bat
@@ -0,0 +1,35 @@
+ at ECHO OFF
+
+pushd %~dp0
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+	set SPHINXBUILD=sphinx-build
+)
+set SOURCEDIR=.
+set BUILDDIR=_build
+
+if "%1" == "" goto help
+
+%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.http://sphinx-doc.org/
+	exit /b 1
+)
+
+%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
+goto end
+
+:help
+%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
+
+:end
+popd
diff --git a/doc/makefile b/doc/makefile
deleted file mode 100644
--- a/doc/makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-all: epydoc
-
-epydoc:
-	mkdir -p apidoc
-	-epydoc --parse-only -o apidoc --html -v --no-private --exclude='test' --exclude="__pkginfo__" --exclude="setup" -n "Logilab's common library" $(shell dirname $(CURDIR))/build/lib/logilab/common >/dev/null
-
-clean:
-	rm -rf apidoc
diff --git a/doc/modules.rst b/doc/modules.rst
new file mode 100644
--- /dev/null
+++ b/doc/modules.rst
@@ -0,0 +1,7 @@
+logilab
+=======
+
+.. toctree::
+   :maxdepth: 4
+
+   logilab
diff --git a/doc/requirements-doc.txt b/doc/requirements-doc.txt
new file mode 100644
--- /dev/null
+++ b/doc/requirements-doc.txt
@@ -0,0 +1,2 @@
+sphinx
+kerberos



More information about the cubicweb-devel mailing list