Browse Source

More doc tweaks.

Stefano Cossu 5 years ago
parent
commit
efc013d99a

+ 1 - 4
docs/Makefile

@@ -3,10 +3,7 @@
 
 # You can set these variables from the command line.
 SPHINXOPTS    =
-# Workaround to prevent lmdb from throwing an exception when loaded from Sphinx
-# Does not work with readthedocs unfortunately.
-#SPHINXBUILD   = python -m sphinx
-SPHINXBUILD   = sphinx-build
+SPHINXBUILD   = python -m sphinx
 SPHINXPROJ    = lakesuperior
 SOURCEDIR     = .
 BUILDDIR      = _build

+ 5 - 7
docs/apidoc/lakesuperior.api.rst

@@ -1,6 +1,11 @@
 lakesuperior.api package
 ========================
 
+.. automodule:: lakesuperior.api
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
 Submodules
 ----------
 
@@ -29,10 +34,3 @@ lakesuperior.api.resource module
     :show-inheritance:
 
 
-Module contents
----------------
-
-.. automodule:: lakesuperior.api
-    :members:
-    :undoc-members:
-    :show-inheritance:

+ 1 - 3
docs/apidoc/lakesuperior.cy_include.rst

@@ -1,10 +1,8 @@
 lakesuperior.cy\_include package
 ================================
 
-Module contents
----------------
-
 .. automodule:: lakesuperior.cy_include
     :members:
     :undoc-members:
     :show-inheritance:
+

+ 5 - 7
docs/apidoc/lakesuperior.dictionaries.rst

@@ -1,6 +1,11 @@
 lakesuperior.dictionaries package
 =================================
 
+.. automodule:: lakesuperior.dictionaries
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
 Submodules
 ----------
 
@@ -21,10 +26,3 @@ lakesuperior.dictionaries.srv\_mgd\_terms module
     :show-inheritance:
 
 
-Module contents
----------------
-
-.. automodule:: lakesuperior.dictionaries
-    :members:
-    :undoc-members:
-    :show-inheritance:

+ 5 - 7
docs/apidoc/lakesuperior.endpoints.rst

@@ -1,6 +1,11 @@
 lakesuperior.endpoints package
 ==============================
 
+.. automodule:: lakesuperior.endpoints
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
 Submodules
 ----------
 
@@ -37,10 +42,3 @@ lakesuperior.endpoints.query module
     :show-inheritance:
 
 
-Module contents
----------------
-
-.. automodule:: lakesuperior.endpoints
-    :members:
-    :undoc-members:
-    :show-inheritance:

+ 5 - 7
docs/apidoc/lakesuperior.messaging.rst

@@ -1,6 +1,11 @@
 lakesuperior.messaging package
 ==============================
 
+.. automodule:: lakesuperior.messaging
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
 Submodules
 ----------
 
@@ -29,10 +34,3 @@ lakesuperior.messaging.messenger module
     :show-inheritance:
 
 
-Module contents
----------------
-
-.. automodule:: lakesuperior.messaging
-    :members:
-    :undoc-members:
-    :show-inheritance:

+ 5 - 7
docs/apidoc/lakesuperior.model.rdf.rst

@@ -1,6 +1,11 @@
 lakesuperior.model.rdf package
 ==============================
 
+.. automodule:: lakesuperior.model.rdf
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
 Submodules
 ----------
 
@@ -29,10 +34,3 @@ lakesuperior.model.rdf.triple module
     :show-inheritance:
 
 
-Module contents
----------------
-
-.. automodule:: lakesuperior.model.rdf
-    :members:
-    :undoc-members:
-    :show-inheritance:

+ 5 - 7
docs/apidoc/lakesuperior.model.rst

@@ -1,6 +1,11 @@
 lakesuperior.model package
 ==========================
 
+.. automodule:: lakesuperior.model
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
 Subpackages
 -----------
 
@@ -29,10 +34,3 @@ lakesuperior.model.callbacks module
     :show-inheritance:
 
 
-Module contents
----------------
-
-.. automodule:: lakesuperior.model
-    :members:
-    :undoc-members:
-    :show-inheritance:

+ 5 - 7
docs/apidoc/lakesuperior.model.structures.rst

@@ -1,6 +1,11 @@
 lakesuperior.model.structures package
 =====================================
 
+.. automodule:: lakesuperior.model.structures
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
 Submodules
 ----------
 
@@ -21,10 +26,3 @@ lakesuperior.model.structures.keyset module
     :show-inheritance:
 
 
-Module contents
----------------
-
-.. automodule:: lakesuperior.model.structures
-    :members:
-    :undoc-members:
-    :show-inheritance:

+ 5 - 7
docs/apidoc/lakesuperior.rst

@@ -1,6 +1,11 @@
 lakesuperior package
 ====================
 
+.. automodule:: lakesuperior
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
 Subpackages
 -----------
 
@@ -92,10 +97,3 @@ lakesuperior.server module
     :show-inheritance:
 
 
-Module contents
----------------
-
-.. automodule:: lakesuperior
-    :members:
-    :undoc-members:
-    :show-inheritance:

+ 5 - 7
docs/apidoc/lakesuperior.store.ldp_nr.rst

@@ -1,6 +1,11 @@
 lakesuperior.store.ldp\_nr package
 ==================================
 
+.. automodule:: lakesuperior.store.ldp_nr
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
 Submodules
 ----------
 
@@ -21,10 +26,3 @@ lakesuperior.store.ldp\_nr.default\_layout module
     :show-inheritance:
 
 
-Module contents
----------------
-
-.. automodule:: lakesuperior.store.ldp_nr
-    :members:
-    :undoc-members:
-    :show-inheritance:

+ 5 - 7
docs/apidoc/lakesuperior.store.ldp_rs.rst

@@ -1,6 +1,11 @@
 lakesuperior.store.ldp\_rs package
 ==================================
 
+.. automodule:: lakesuperior.store.ldp_rs
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
 Submodules
 ----------
 
@@ -29,10 +34,3 @@ lakesuperior.store.ldp\_rs.rsrc\_centric\_layout module
     :show-inheritance:
 
 
-Module contents
----------------
-
-.. automodule:: lakesuperior.store.ldp_rs
-    :members:
-    :undoc-members:
-    :show-inheritance:

+ 5 - 7
docs/apidoc/lakesuperior.store.rst

@@ -1,6 +1,11 @@
 lakesuperior.store package
 ==========================
 
+.. automodule:: lakesuperior.store
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
 Subpackages
 -----------
 
@@ -29,10 +34,3 @@ lakesuperior.store.metadata\_store module
     :show-inheritance:
 
 
-Module contents
----------------
-
-.. automodule:: lakesuperior.store
-    :members:
-    :undoc-members:
-    :show-inheritance:

+ 5 - 7
docs/apidoc/lakesuperior.util.rst

@@ -1,6 +1,11 @@
 lakesuperior.util package
 =========================
 
+.. automodule:: lakesuperior.util
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
 Submodules
 ----------
 
@@ -45,10 +50,3 @@ lakesuperior.util.toolbox module
     :show-inheritance:
 
 
-Module contents
----------------
-
-.. automodule:: lakesuperior.util
-    :members:
-    :undoc-members:
-    :show-inheritance:

+ 1 - 3
docs/apidoc/lakesuperior.wsgi.rst

@@ -1,10 +1,8 @@
 lakesuperior.wsgi package
 =========================
 
-Module contents
----------------
-
 .. automodule:: lakesuperior.wsgi
     :members:
     :undoc-members:
     :show-inheritance:
+

+ 4 - 0
docs/cli.rst

@@ -30,6 +30,10 @@ was installed in (if it was)—i.e.::
 
 must be run before running the server.
 
+Note that if ``app_mode`` is set to ``prod`` in :doc:`application.yml
+<config>`, the server will just print the configuration and immediately go in
+the background without logging anything on screen (daemon mode).
+
 In the case an init script is used, ``coilmq`` (belonging to a 3rd party
 package) needs to be launched as well; unless a message broker is already set
 up, or if messaging is disabled in the configuration.

+ 0 - 11
docs/conf.py

@@ -20,17 +20,6 @@
 import sys
 
 from os import path
-from unittest.mock import MagicMock
-
-class MockModule(MagicMock):
-    @classmethod
-    def __getattr__(cls, name):
-        return MagicMock()
-
-# LMDB raises an issue if imported by Sphinx. This bypasses the issue.
-# https://github.com/dw/py-lmdb/issues/172
-MOCK_MODULES = ['lmdb']
-sys.modules.update((mod_name, MockModule()) for mod_name in MOCK_MODULES)
 
 import lakesuperior
 import lakesuperior.env_setup

+ 1 - 0
docs/index.rst

@@ -49,6 +49,7 @@ Indices and tables
     Content Model <model>
     Storage Implementation <storage>
     Indexing Strategy <indexing_strategy>
+    Scaling Down <rpi>
 
 * :ref:`genindex`
 * :ref:`modindex`

+ 2 - 2
docs/rpi.rst

@@ -4,12 +4,12 @@ Lakesuperior on a Raspberry Pi
 .. figure:: assets/fedora_rpi.jpg
    :alt: Raspberry Pi on pinboard. Fedora inside.
 
-   Look, a Fedora!
+   Look, a Fedora implementation!
 
 **Experiment in Progress**
 
 Lakesuperior has been successfully installed and ran on a Raspberry Pi 3 board.
-The software was compiled on Alpine Linux using `musl <http://musl.libc.org>`__
+The software was compiled on Alpine Linux using `musl <http://musl-libc.org>`__
 C libraries. (it also run fine with musl on more conventional hardware, but
 performance benchmarks vis-a-vis libc have not been performed yet.)
 

+ 2 - 1
lakesuperior/api/resource.py

@@ -31,7 +31,8 @@ Quickstart::
     >>> # Get root resource.
     >>> rsrc = resource.get('/')
     >>> # Dump graph.
-    >>> set(rsrc.imr)
+    >>> with rsrc.imr.store.txn_ctx():
+    >>>     print({*rsrc.imr.as_rdflib()})
     {(rdflib.term.URIRef('info:fcres/'),
       rdflib.term.URIRef('http://purl.org/dc/terms/title'),
       rdflib.term.Literal('Repository Root')),

+ 105 - 60
lakesuperior/etc.defaults/application.yml

@@ -1,18 +1,23 @@
-### Default repository configuration.
+# Default repository configuration.
 #
-#   Copy this file or parts of it in a separate location to override these
-#   settings. Individual items can be selectively overridden as long as the YAML
-#   hierarchical structure is kept.
+# Copy this file or parts of it in a separate location to override these
+# settings. Individual items can be selectively overridden as long as the YAML
+# hierarchical structure is kept.
 
-#   Set app_mode to either 'prod', 'test' or 'dev'.
-#   'prod' is normal running mode. 'test' is used for running test suites.
-#   'dev' is similar to normal mode but with reload and debug enabled.
+###
+#   Application mode.
+#
+#   One of ``prod``, ``test`` or ``dev``.
+#   ``prod`` is normal running mode. 'test' is used for running test suites.
+#   ``dev`` is similar to normal mode but with reload and debug enabled.
 app_mode: 'dev'
 
-### Base data directory.
+###
+#   Base data directory.
+#
 #   This contains both volatile files such as PID files,
 #   and persistent ones, such as resource data. LDP-NRs will be stored under
-#   <basedir>/ldpnr_store and LDP-RSs under <basedir>/ldprs_store.
+#   ``<basedir>/ldpnr_store` and LDP-RSs under ``<basedir>/ldprs_store``.
 #
 #   If different data files need to be running on different storage hardware,
 #   the individual subdirectories can be mounted on different file systems.
@@ -20,60 +25,80 @@ app_mode: 'dev'
 #   If unset, it will default to <lakesuperior package root>/data.
 data_dir:
 
+###
 # Configuration for binary path and fixity check generation. The hash is a
 # checksumn of the contents of the file.
 uuid:
 
-    ### Algorithm used to calculate the hash that generates the content path.
+    ###
+    #   Algorithm used to calculate the hash that generates the content path.
+    #
     #   This can be any one of the Python hashlib functions:
     #   https://docs.python.org/3/library/hashlib.html
     #
-    #   This needs to be ``sha1`` if a compatibility with the Fedora4 file layout
-    #   is needed, however in security-sensitive environments it is strongly
-    #   advised to use a stronger algorithm, since SHA1 is known to be
+    #   This needs to be ``sha1`` if a compatibility with the Fedora4 file
+    #   layout is needed, however in security-sensitive environments it is
+    #   strongly advised to use a stronger algorithm, since SHA1 is known to be
     #   vulnerable to counterfeiting: see https://shattered.io/
     #
-    #   `blake2b` is a strong, fast cryptographic alternative to SHA2/3:
+    #   ``blake2b`` is a strong, fast cryptographic alternative to SHA2/3:
     #   https://blake2.net/
     algo: sha1
 
+###
 # Data store configuration.
 store:
-    #   The semantic store used for persisting LDP-RS (RDF Source) resources.
-    #   MUST support SPARQL 1.1 query and update.
+
+    ###
+    #  The semantic store used for persisting LDP-RS (RDF Source) resources.
+    #
+    #  MUST support SPARQL 1.1 query and update.
     ldp_rs:
 
-        ### Store layout.
-        #   At the moment, only `rsrc_centric_layout`is supported.
+        ###
+        #   Store layout.
+        #
+        #   At the moment, only ``rsrc_centric_layout`` is supported.
         layout: rsrc_centric_layout
 
-        ### whether to check if the object of a client-provided triple is the
-        #   uri of a repository-managed resource and veify if that exists.  if set
-        #   to false, properties are allowed to point to resources in the
-        #   repositoy that do not exist. also, if a resource is deleted, inbound
-        #   relationships may not be cleaned up.  this can be one of `False`
-        #   (boolean), `lenient` or `strict`. `False` does not check for
-        #   referential integrity. `lenient` quietly drops a user-provided triple
-        #   if its object violates referential integrity.  `strict` raises an
-        #   exception.
+        ###
+        #   Enable referential integrity checks.
+        #
+        #   Whether to check if the object of a client-provided triple is the
+        #   uri of a repository-managed resource and veify if that exists.  if
+        #   set to false, properties are allowed to point to resources in the
+        #   repositoy that do not exist. also, if a resource is deleted,
+        #   inbound relationships may not be cleaned up.  this can be one of
+        #   ``False``, ``lenient`` or ``strict``. ``False`` does not check for
+        #   referential integrity. ``lenient`` quietly drops a user-provided
+        #   triple if its object violates referential integrity.  ``strict``
+        #   raises an exception.
         #
         #   Changes to this parameter require a full migration.
         referential_integrity: lenient
 
-        ### this mimics Fedora4 behavior which segments an identifier on POST.
+        ###
+        #   Split newly minted URIs into pairtrees.
+        #
+        #   This mimics Fedora4 behavior which segments an identifier on POST.
         legacy_ptree_split: False
 
-    ### The path used to persist LDP-NR (bitstreams).
+    ###
+    #   The path used to persist LDP-NR (bitstreams).
+    #
     #   This is for now a POSIX filesystem. Other solutions such as HDFS may be
     #   possible in the future.
     ldp_nr:
 
-        # See store.ldp_rs.layout.
+        ###
+        #   See store.ldp_rs.layout.
         layout: default_layout
 
-        ### How to split the balanced pairtree to generate a path.
-        #   The hash string is defined by the uuid.algo parameter value.
-        #   This parameter defines how many characters are in each branch. 2-4 is
+        ###
+        #   How to split the balanced pairtree to generate a path.
+        #
+        #   The hash string is defined by the uuid.algo parameter value.  This
+        #   parameter defines how many characters are in each branch. 2-4 is
         #   the recommended setting. NOTE: a value of 2 will generate up to 256
         #   sub-folders in a folder; 3 will generate max. 4096 and 4 will
         #   generate max. 65536. Check your filesystem capabilities before
@@ -82,59 +107,79 @@ store:
         #   Changes to this parameter require a full migration.
         pairtree_branch_length: 2
 
-        ### Max. number of branches to generate. 0 will split the string until
-        #   it reaches the end.
+        ###
+        #   Max. number of branches to generate.
+        #
+        #   0 will split the string until it reaches the end.
+        #
         #   E.g. if the hash value is 0123456789abcdef01234565789abcdef and the
         #   branch length value is 2, and the branch number is 4, the path will
-        #   be 01/23/45/67/89abcdef01234565789abcdef. For a value of 0 it will be
-        #   01/23/45/67/89/ab/cd/ef/01/23/45/67/89/ab/cd/ef. Be aware that deeply
-        #   nested directory structures may tax some of the operating system's
-        #   services that scan for files, such as `updatedb`. Check your system
-        #   capabilities for maximum nested directories before changing the
-        #   default.
+        #   be 01/23/45/67/89abcdef01234565789abcdef. For a value of 0 it will
+        #   be 01/23/45/67/89/ab/cd/ef/01/23/45/67/89/ab/cd/ef. Be aware that
+        #   deeply nested directory structures may tax some of the operating
+        #   system's services that scan for files, such as `updatedb`. Check
+        #   your system capabilities for maximum nested directories before
+        #   changing the default.
         #
         #   Changes to this parameter require a full migration.
         pairtree_branches: 4
 
-### Configuration for messaging.
+###
+#   Messaging configuration.
 messaging:
 
-    ### List of channels to send messages to.
+    ###
+    #   List of channels to send messages to.
+    #
     #   Each channel must define the `endpoint` and the `level` parameters.
     routes:
 
-        ### Output handler. Currently only `StompHandler` is supported.
+        ###
+        #   Output handler. Currently only ``StompHandler`` is supported.
         - handler: StompHandler
 
-          ### Whether this route is used. It False, no messages will be emitted
-          #   for this route.
+          ###
+          #   Activate this route.
+          #
+          #   If ``False``, no messages will be emitted for this route.
           active: True
 
-          ### Protocol version. One of `10`, `11` or `12`.
+          ###
+          #   Protocol version. One of ``10``, ``11`` or ``12``.
           protocol: '11'
 
-          ### Host IP address.
+          ###
+          #   Host IP address.
           host: 127.0.0.1
 
-          ### Host port.
+          ###
+          #   Host port.
           port: 61613
 
-          ### User name for authentication.
+          ###
+          #   User name for authentication.
+          #
           #   Credentials are optional.
           username:
 
-          ### Password for authentication.
+          ###
+          #   Password for authentication.
           password:
 
-          ### Message topic.
+          ###
+          #   Message topic.
           destination: '/topic/fcrepo'
 
-          ### Message format: at the moment the following are supported:
-          #   - `ASResourceFormatter`: Sends information about a resource being
-          #     created, updated or deleted, by who and when, with no further
-          #     information about what changed.
-          #   - `ASDeltaFormatter`: Sends the same information as
-          #     `ASResourceFormatter` with the addition of the triples that were
-          #     added and the ones that were removed in the request. This may be
-          #     used to send rich provenance data to a preservation system.
+          ###
+          #   Message format: at the moment the following are supported:
+          #
+          #   - ``ASResourceFormatter``: Sends information about a resource
+          #     being created, updated or deleted, by who and when, with no
+          #     further information about what changed.
+          #
+          #   - ``ASDeltaFormatter``:
+          #     Sends the same information as ``ASResourceFormatter`` with the
+          #     addition of the triples that were added and the ones that were
+          #     removed in the request. This may be used to send rich provenance
+          #     data to a preservation system.
           formatter: ASResourceFormatter

+ 2 - 0
lakesuperior/model/rdf/graph.pyx

@@ -525,6 +525,7 @@ cdef class Graph:
 
         :rtype: Graph
         :return: New Graph instance with matching triples.
+
         """
         cdef:
             Graph res_gr = self.empty_copy()
@@ -639,6 +640,7 @@ def from_rdf(store=None, uri=None, *args, **kwargs):
     :param \*\*kwargs: Keyword arguments passed to RDFlib's ``parse``.
 
     :rtype: Graph
+
     """
     gr = rdflib.Graph().parse(*args, **kwargs)