Add sphinx doc setup

This commit is contained in:
nolash 2021-11-30 08:14:57 +01:00
parent 6e5a80ae7c
commit 7f95835bf9
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
10 changed files with 314 additions and 2 deletions

View File

@ -306,6 +306,6 @@ class CICEth(Extension):
def new(chain_spec, resources, proof, signer_hint=None, rpc=None, outputs_writer=None):
"""Convenience function to enable object instantiation through predictable module symbol
See CICEth
See CICEth constructor for details.
"""
return CICEth(chain_spec, resources, proof, signer=signer_hint, rpc=rpc, outputs_writer=outputs_writer)

20
doc/sphinx/Makefile Normal file
View File

@ -0,0 +1,20 @@
# Minimal 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 = .
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)

10
doc/sphinx/components.dot Normal file
View File

@ -0,0 +1,10 @@
digraph {
immutable_data [ label="Immutable metadata", shape="box" ];
mutable_data [ label="Mutable metadata", shape="box" ];
token_smart_contract [label="Token code", shape="box" ];
network -> extension -> token -> token_smart_contract
processor -> extension -> proof
extension -> meta -> mutable_data
attachment -> proof -> immutable_data
}

126
doc/sphinx/components.svg Normal file
View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.49.0 (0)
-->
<!-- Pages: 1 -->
<svg width="456pt" height="260pt"
viewBox="0.00 0.00 455.50 260.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 256)">
<polygon fill="white" stroke="transparent" points="-4,4 -4,-256 451.5,-256 451.5,4 -4,4"/>
<!-- immutable_data -->
<g id="node1" class="node">
<title>immutable_data</title>
<polygon fill="none" stroke="black" points="447.5,-36 281.5,-36 281.5,0 447.5,0 447.5,-36"/>
<text text-anchor="middle" x="364.5" y="-14.3" font-family="Times,serif" font-size="14.00">Immutable metadata</text>
</g>
<!-- mutable_data -->
<g id="node2" class="node">
<title>mutable_data</title>
<polygon fill="none" stroke="black" points="263.5,-36 115.5,-36 115.5,0 263.5,0 263.5,-36"/>
<text text-anchor="middle" x="189.5" y="-14.3" font-family="Times,serif" font-size="14.00">Mutable metadata</text>
</g>
<!-- token_smart_contract -->
<g id="node3" class="node">
<title>token_smart_contract</title>
<polygon fill="none" stroke="black" points="97,-36 0,-36 0,0 97,0 97,-36"/>
<text text-anchor="middle" x="48.5" y="-14.3" font-family="Times,serif" font-size="14.00">Token code</text>
</g>
<!-- network -->
<g id="node4" class="node">
<title>network</title>
<ellipse fill="none" stroke="black" cx="128.5" cy="-234" rx="48.99" ry="18"/>
<text text-anchor="middle" x="128.5" y="-230.3" font-family="Times,serif" font-size="14.00">network</text>
</g>
<!-- extension -->
<g id="node5" class="node">
<title>extension</title>
<ellipse fill="none" stroke="black" cx="189.5" cy="-162" rx="55.79" ry="18"/>
<text text-anchor="middle" x="189.5" y="-158.3" font-family="Times,serif" font-size="14.00">extension</text>
</g>
<!-- network&#45;&gt;extension -->
<g id="edge1" class="edge">
<title>network&#45;&gt;extension</title>
<path fill="none" stroke="black" d="M142.65,-216.76C150.24,-208.06 159.74,-197.15 168.21,-187.43"/>
<polygon fill="black" stroke="black" points="171.07,-189.47 175.01,-179.63 165.8,-184.87 171.07,-189.47"/>
</g>
<!-- token -->
<g id="node6" class="node">
<title>token</title>
<ellipse fill="none" stroke="black" cx="74.5" cy="-90" rx="36.29" ry="18"/>
<text text-anchor="middle" x="74.5" y="-86.3" font-family="Times,serif" font-size="14.00">token</text>
</g>
<!-- extension&#45;&gt;token -->
<g id="edge2" class="edge">
<title>extension&#45;&gt;token</title>
<path fill="none" stroke="black" d="M164.55,-145.81C147.18,-135.24 123.89,-121.07 105.36,-109.78"/>
<polygon fill="black" stroke="black" points="107.05,-106.71 96.68,-104.5 103.41,-112.69 107.05,-106.71"/>
</g>
<!-- proof -->
<g id="node8" class="node">
<title>proof</title>
<ellipse fill="none" stroke="black" cx="345.5" cy="-90" rx="35.19" ry="18"/>
<text text-anchor="middle" x="345.5" y="-86.3" font-family="Times,serif" font-size="14.00">proof</text>
</g>
<!-- extension&#45;&gt;proof -->
<g id="edge5" class="edge">
<title>extension&#45;&gt;proof</title>
<path fill="none" stroke="black" d="M220.69,-147C246.67,-135.35 283.63,-118.76 310.59,-106.67"/>
<polygon fill="black" stroke="black" points="312.34,-109.72 320.03,-102.43 309.47,-103.33 312.34,-109.72"/>
</g>
<!-- meta -->
<g id="node9" class="node">
<title>meta</title>
<ellipse fill="none" stroke="black" cx="189.5" cy="-90" rx="34.39" ry="18"/>
<text text-anchor="middle" x="189.5" y="-86.3" font-family="Times,serif" font-size="14.00">meta</text>
</g>
<!-- extension&#45;&gt;meta -->
<g id="edge6" class="edge">
<title>extension&#45;&gt;meta</title>
<path fill="none" stroke="black" d="M189.5,-143.7C189.5,-135.98 189.5,-126.71 189.5,-118.11"/>
<polygon fill="black" stroke="black" points="193,-118.1 189.5,-108.1 186,-118.1 193,-118.1"/>
</g>
<!-- token&#45;&gt;token_smart_contract -->
<g id="edge3" class="edge">
<title>token&#45;&gt;token_smart_contract</title>
<path fill="none" stroke="black" d="M68.21,-72.05C65.28,-64.18 61.73,-54.62 58.45,-45.79"/>
<polygon fill="black" stroke="black" points="61.68,-44.43 54.92,-36.28 55.12,-46.87 61.68,-44.43"/>
</g>
<!-- processor -->
<g id="node7" class="node">
<title>processor</title>
<ellipse fill="none" stroke="black" cx="251.5" cy="-234" rx="55.79" ry="18"/>
<text text-anchor="middle" x="251.5" y="-230.3" font-family="Times,serif" font-size="14.00">processor</text>
</g>
<!-- processor&#45;&gt;extension -->
<g id="edge4" class="edge">
<title>processor&#45;&gt;extension</title>
<path fill="none" stroke="black" d="M236.81,-216.41C229.09,-207.69 219.48,-196.85 210.94,-187.21"/>
<polygon fill="black" stroke="black" points="213.34,-184.64 204.09,-179.47 208.1,-189.28 213.34,-184.64"/>
</g>
<!-- proof&#45;&gt;immutable_data -->
<g id="edge9" class="edge">
<title>proof&#45;&gt;immutable_data</title>
<path fill="none" stroke="black" d="M350.1,-72.05C352.21,-64.26 354.78,-54.82 357.15,-46.08"/>
<polygon fill="black" stroke="black" points="360.57,-46.84 359.81,-36.28 353.81,-45.01 360.57,-46.84"/>
</g>
<!-- meta&#45;&gt;mutable_data -->
<g id="edge7" class="edge">
<title>meta&#45;&gt;mutable_data</title>
<path fill="none" stroke="black" d="M189.5,-71.7C189.5,-63.98 189.5,-54.71 189.5,-46.11"/>
<polygon fill="black" stroke="black" points="193,-46.1 189.5,-36.1 186,-46.1 193,-46.1"/>
</g>
<!-- attachment -->
<g id="node10" class="node">
<title>attachment</title>
<ellipse fill="none" stroke="black" cx="345.5" cy="-162" rx="63.89" ry="18"/>
<text text-anchor="middle" x="345.5" y="-158.3" font-family="Times,serif" font-size="14.00">attachment</text>
</g>
<!-- attachment&#45;&gt;proof -->
<g id="edge8" class="edge">
<title>attachment&#45;&gt;proof</title>
<path fill="none" stroke="black" d="M345.5,-143.7C345.5,-135.98 345.5,-126.71 345.5,-118.11"/>
<polygon fill="black" stroke="black" points="349,-118.1 345.5,-108.1 342,-118.1 349,-118.1"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.9 KiB

53
doc/sphinx/conf.py Normal file
View File

@ -0,0 +1,53 @@
# 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:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- 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 = 'cic-cli'
copyright = '2021, Louis Holbrook'
author = 'Louis Holbrook'
# -- General configuration ---------------------------------------------------
# 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', '.venv']
# -- 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'
# 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']

1
doc/sphinx/includes.rst Normal file
View File

@ -0,0 +1 @@
.. include:: ../../cic/index.rst

21
doc/sphinx/index.rst Normal file
View File

@ -0,0 +1,21 @@
.. cic-cli documentation master file, created by
sphinx-quickstart on Tue Nov 30 05:33:58 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. include:: readme.rst
.. toctree::
:maxdepth: 2
:includehidden:
:caption: Contents:
includes
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

35
doc/sphinx/make.bat Normal file
View File

@ -0,0 +1,35 @@
@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% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

46
doc/sphinx/readme.rst Normal file
View File

@ -0,0 +1,46 @@
CIC token deployment tool
=========================
CIC-CLI provides tooling to generate and publish metadata in relation to token deployments.
To install the project (replacing <VERSION> with the current version: |VERSION|):
.. code-block:: shell
python setup.py sdist
pip install --extra-index-url https://pip.grassrootseconomics.net:8433 dist/cic-<VERSION>.tar.gz
Structure of the components
---------------------------
.. image:: components.svg
CIC-CLI is designed to interface any network type backend. The current state of the package contains interface to EVM only. Thus, the examples below are limited to the context of the EVM.
Preparing for EVM token deployment
----------------------------------
.. note::
Some of the concepts described below assume familiarity with base concepts of the CIC architecture. Please refer to the appropriate documentation for more information.
To initialize a new token deployment for the EVM:
.. code-block:: shell
cic init --target eth --name <token_name> --symbol <token_symbol> --precision <token_value_precision> <settings_folder>
To automatically fill in settings detected in the network for the EVM:
.. code-block:: shell
cic ext --registry <contract_registry_address> -d <settings_folder> -i <chain_spec> -p <rpc_endpoint> eth
.. |VERSION| replace:: 0.0.1

View File

@ -1,6 +1,6 @@
[metadata]
name = cic
version = 0.0.1a1
version = 0.0.1
description = Generic cli tooling for the CIC token network
author = Louis Holbrook
author_email = dev@holbrook.no