New sphinx theme, better navigation and release docs

This commit is contained in:
Luke Murphy 2019-11-03 16:38:39 +01:00
parent 4b47706883
commit 352a7d3697
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
10 changed files with 104 additions and 48 deletions

View File

@ -1,3 +1,12 @@
Merkle_Tree_Stream 0.0.1a4 (2019-11-03)
=======================================
Improved Documentation
----------------------
- New Sphinx theme. Improved clarity with documentation.
Merkle_Tree_Stream 0.0.1a3 (2019-10-08)
=======================================

View File

@ -33,8 +33,36 @@ Type check source
tox -e type
Release Process
---------------
Build the documentation
-----------------------
.. code-block:: bash
$ tox -e docs
$ tox -e docs-livereload
Make a new release
------------------
Ensure metadata for packaging is correct.
.. code-block:: bash
$ tox -e metadata-release
Generate the changelog with the next target version.
.. code-block:: bash
$ export VERSION=1.0.1 tox -e changelog
Make a new Git tag.
.. code-block:: bash
$ git tag -a 1.0.1
And finally, make a new release.
.. code-block:: bash

View File

@ -48,6 +48,10 @@ See the following for more:
.. _Merkle Tree: https://datprotocol.github.io/book/ch01-02-merkle-tree.html
.. _Merkle Tree Stream: https://datprotocol.github.io/book/ch02-02-merkle-tree-stream.html
Part of the `Datpy`_ project.
.. _Datpy: https://datpy.decentral1.se/
A note on naming
================
@ -60,30 +64,6 @@ generator only. A `stream`_ implementation may follow.
.. _merkle-tree-stream: https://github.com/mafintosh/merkle-tree-stream
.. _stream: https://docs.python.org/3/library/asyncio-stream.html
.. _example:
Example
*******
.. code-block:: python
from hashlib import sha256
from merkle_tree_stream import MerkleTreeGenerator
def leaf(node, roots=None):
return sha256(node.data).digest()
def parent(first, second):
sha256 = hashlib.sha256()
sha256.update(first.data)
sha256.update(second.data)
return sha256.digest()
merkle = MerkleTreeGenerator(leaf=leaf, parent=parent)
merkle.write('hello')
merkle.write('hashed')
merkle.write('world')
.. _documentation:
Documentation
@ -92,12 +72,3 @@ Documentation
* `merkle-tree-stream.readthedocs.io`_
.. _merkle-tree-stream.readthedocs.io: https://merkle-tree-stream.readthedocs.io/
Mirroring
*********
* `hack.decentral1.se/datpy/merkle-tree-stream`_
* `github.com/datpy/merkle-tree-stream`_
.. _hack.decentral1.se/datpy/merkle-tree-stream: https://hack.decentral1.se/datpy/merkle-tree-stream
.. _github.com/datpy/merkle-tree-stream: https://github.com/datpy/merkle-tree-stream

View File

@ -1,7 +1,7 @@
author = 'decentral1se'
copyright = '2019, decentral1se'
html_static_path = ['_static']
html_theme = 'alabaster'
html_theme = 'sphinx_rtd_theme'
master_doc = 'index'
project = 'merkle-tree-stream'
templates_path = ['_templates']

View File

@ -0,0 +1,24 @@
.. _example:
*******
Example
*******
.. code-block:: python
from hashlib import sha256
from merkle_tree_stream import MerkleTreeGenerator
def leaf(node, roots=None):
return sha256(node.data).digest()
def parent(first, second):
sha256 = hashlib.sha256()
sha256.update(first.data)
sha256.update(second.data)
return sha256.digest()
merkle = MerkleTreeGenerator(leaf=leaf, parent=parent)
merkle.write('hello')
merkle.write('hashed')
merkle.write('world')

View File

@ -1,12 +1,13 @@
.. include:: ../../README.rst
:end-before: _documentation
Table of Contents
*****************
:end-before: _documentation
.. toctree::
:maxdepth: 1
:hidden:
install
upgrade
example
modules-api
other-impls
contribute

View File

@ -3,6 +3,10 @@
Other Implementations
*********************
* https://github.com/mafintosh/merkle-tree-stream
* https://github.com/datrs/merkle-tree-stream
* https://github.com/datcxx/merkle-tree-stream
* `mafintosh/merkle-tree-stream`_
* `datrs/merkle-tree-stream`_
* `datcxx/merkle-tree-stream`_
.. _mafintosh/merkle-tree-stream: https://github.com/mafintosh/merkle-tree-stream
.. _datrs/merkle-tree-stream: https://github.com/datrs/merkle-tree-stream
.. _datcxx/merkle-tree-stream: https://github.com/datcxx/merkle-tree-stream

View File

@ -0,0 +1,7 @@
*******
Upgrade
*******
.. code-block:: bash
$ pip install --upgrade merkle-tree-stream

View File

@ -61,6 +61,7 @@ warning-is-error = True
[options.extras_require]
docs =
sphinx
sphinx_rtd_theme
sphinx-autodoc-typehints >= 1.6.0, < 2.0
changelog =
towncrier <= 19.2.0, < 20.0

21
tox.ini
View File

@ -50,19 +50,30 @@ extras = docs
commands = python -m setup build_sphinx
[testenv:changelog]
description = draft the changelog
description = draw up the new changelog
skipdist = True
extras = changelog
commands = towncrier --draft
passenv = VERSION
deps = towncrier
commands = towncrier --version={env:VERSION} {posargs}
[testenv:metadata-release]
description = validate the package metadata
deps = twine
commands = twine check {toxworkdir}/dist/*
commands =
rm -rf {toxworkdir}/dist
python -m setup sdist --dist-dir {toxworkdir}/dist bdist_wheel
python -m setup sdist --dist-dir {toxworkdir}/dist bdist_egg
twine check {toxworkdir}/dist/*
whitelist_externals =
rm
[testenv:release]
description = make a release
deps = {[testenv:metadata-release]deps}
commands =
python -m setup sdist bdist_wheel
rm -rf {toxworkdir}/dist
python -m setup sdist --dist-dir {toxworkdir}/dist bdist_wheel
python -m setup sdist --dist-dir {toxworkdir}/dist bdist_egg
twine upload {toxworkdir}/dist/*
whitelist_externals =
rm