From 7f95835bf95ba9d25d41d940ecde1aede2f294cc Mon Sep 17 00:00:00 2001 From: nolash Date: Tue, 30 Nov 2021 08:14:57 +0100 Subject: [PATCH] Add sphinx doc setup --- cic/ext/eth/__init__.py | 2 +- doc/sphinx/Makefile | 20 ++++++ doc/sphinx/components.dot | 10 +++ doc/sphinx/components.svg | 126 ++++++++++++++++++++++++++++++++++++++ doc/sphinx/conf.py | 53 ++++++++++++++++ doc/sphinx/includes.rst | 1 + doc/sphinx/index.rst | 21 +++++++ doc/sphinx/make.bat | 35 +++++++++++ doc/sphinx/readme.rst | 46 ++++++++++++++ setup.cfg | 2 +- 10 files changed, 314 insertions(+), 2 deletions(-) create mode 100644 doc/sphinx/Makefile create mode 100644 doc/sphinx/components.dot create mode 100644 doc/sphinx/components.svg create mode 100644 doc/sphinx/conf.py create mode 100644 doc/sphinx/includes.rst create mode 100644 doc/sphinx/index.rst create mode 100644 doc/sphinx/make.bat create mode 100644 doc/sphinx/readme.rst diff --git a/cic/ext/eth/__init__.py b/cic/ext/eth/__init__.py index 77dda52..a8ec650 100644 --- a/cic/ext/eth/__init__.py +++ b/cic/ext/eth/__init__.py @@ -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) diff --git a/doc/sphinx/Makefile b/doc/sphinx/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/doc/sphinx/Makefile @@ -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) diff --git a/doc/sphinx/components.dot b/doc/sphinx/components.dot new file mode 100644 index 0000000..089afb1 --- /dev/null +++ b/doc/sphinx/components.dot @@ -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 +} diff --git a/doc/sphinx/components.svg b/doc/sphinx/components.svg new file mode 100644 index 0000000..a70d01e --- /dev/null +++ b/doc/sphinx/components.svg @@ -0,0 +1,126 @@ + + + + + + + + + +immutable_data + +Immutable metadata + + + +mutable_data + +Mutable metadata + + + +token_smart_contract + +Token code + + + +network + +network + + + +extension + +extension + + + +network->extension + + + + + +token + +token + + + +extension->token + + + + + +proof + +proof + + + +extension->proof + + + + + +meta + +meta + + + +extension->meta + + + + + +token->token_smart_contract + + + + + +processor + +processor + + + +processor->extension + + + + + +proof->immutable_data + + + + + +meta->mutable_data + + + + + +attachment + +attachment + + + +attachment->proof + + + + + diff --git a/doc/sphinx/conf.py b/doc/sphinx/conf.py new file mode 100644 index 0000000..0f1a509 --- /dev/null +++ b/doc/sphinx/conf.py @@ -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'] diff --git a/doc/sphinx/includes.rst b/doc/sphinx/includes.rst new file mode 100644 index 0000000..660fc0c --- /dev/null +++ b/doc/sphinx/includes.rst @@ -0,0 +1 @@ +.. include:: ../../cic/index.rst diff --git a/doc/sphinx/index.rst b/doc/sphinx/index.rst new file mode 100644 index 0000000..275cab2 --- /dev/null +++ b/doc/sphinx/index.rst @@ -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` diff --git a/doc/sphinx/make.bat b/doc/sphinx/make.bat new file mode 100644 index 0000000..2119f51 --- /dev/null +++ b/doc/sphinx/make.bat @@ -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 diff --git a/doc/sphinx/readme.rst b/doc/sphinx/readme.rst new file mode 100644 index 0000000..fa90fc7 --- /dev/null +++ b/doc/sphinx/readme.rst @@ -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 with the current version: |VERSION|): + +.. code-block:: shell + + python setup.py sdist + pip install --extra-index-url https://pip.grassrootseconomics.net:8433 dist/cic-.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 --symbol --precision + + +To automatically fill in settings detected in the network for the EVM: + +.. code-block:: shell + + cic ext --registry -d -i -p eth + + +.. |VERSION| replace:: 0.0.1 diff --git a/setup.cfg b/setup.cfg index 0d09d2c..b9aba76 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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