Initialise the new module boilerplate

This commit is contained in:
Luke Murphy 2019-07-08 11:40:40 +02:00
commit 1af9c06d5a
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
26 changed files with 546 additions and 0 deletions

12
.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
*.egg-info/
*.pyc
.coverage
.eggs/
.mypy_cache/
.tox/
.venv/
__pycache__
build/
dist/
pip-wheel-metadata/
documentation/build/

16
.readthedocs.yml Normal file
View File

@ -0,0 +1,16 @@
version: 2
build:
image: latest
sphinx:
configuration: documentation/source/conf.py
fail_on_warning: true
python:
version: 3.7
install:
- method: pip
path: .
extra_requirements:
- docs

0
CHANGELOG.rst Normal file
View File

111
CODE_OF_CONDUCT.rst Normal file
View File

@ -0,0 +1,111 @@
Introduction
------------
The DatPy community is committed to providing an inclusive,
safe, and collaborative environment for all participants, regardless of their
gender, gender expression, race, ethnicity, religion, sexual orientation,
sexual characteristics, physical appearance, disability, or age. We encourage
every participant to be themselves, and must respect the rights of others. The
code of conduct is a set of guidelines that establishes shared values and
ensures that behaviors that may harm participants are avoided.
The values of the DatPy community are focused on developing
both our individual and collective potential, supporting and empowering the
most marginalized, mutual respect, and an anti-violence approach that favors
support and collaboration among participants and the resolution of conflicts. A
code of conduct helps us co-exist in a more positive way and provides
individuals who are victims of negative behaviors with confidence that they
will be supported by the organization and the DatPy
community, who respects and stands behind the code of conduct.
The DatPy community works towards providing a welcoming
environment where participants are treated with dignity and respect and are
free to be themselves. We encourage all participants to approach the
Librehosters network with an open and positive attitude, engaging
constructively with others at all times.
Respect for Diversity & Inclusion
---------------------------------
We avoid comments, actions or propaganda that encourage discrimination related
to gender, gender expression, race, ethnicity, religion, sexual orientation,
sexual characteristics, physical appearance, disability, or age.
Respect Freedom of Expression
-----------------------------
We support an individual's freedom of expression, and will not make fun of
accents or make unsolicited grammatical corrections. We will strive to better
understand each other by not assuming experiences or beliefs, clarifying
meanings, and making an effort to speak clearly, avoiding jargon and acronyms.
Commitment to Non-Violence
--------------------------
We will not engage in any type of violence or aggression, including verbal
threats or complaints, intimidation, stalking or harassment, whether physically
or psychologically.
Rejection of Sexual Harassment
------------------------------
We understand sexual harassment as unwanted physical contact or insinuation of
a sexual nature, as well as displaying images, drawings or visual
representations of any kind that objectify members of any gender or reinforce
oppression. The only exception is if this is part of a session, workshop and/or
educational experience where showing these images is educational in nature.
Respect for Privacy
-------------------
We safeguard the privacy of the participants. This includes refraining from
posting or publishing information about attendees (including names and
affiliation) unless given clear permission, and avoid any type of unauthorized
video, audio recording, or photography.
Facilitate Participation & Collaboration
----------------------------------------
We work to create an environment that facilitates participation for all
participants. We will not engage in sustained disruption of discussions or
events, interrupt conversations in a way that negatively impacts collaboration,
or engage in toxic behaviours to attract negative attention to a participant.
We Care about the Integrity and Health of the Community
-------------------------------------------------------
We value the health of the community and will not engage in behaviour that can
negatively impact it. This includes contaminating food or drink with drugs, or
inciting or insisting on the consumption of alcohol, psychoactive substances,
etc.
Support Positive Interactions Among Participants
------------------------------------------------
We are committed to engaging constructively with others at all times. We will
not tolerate bullying, including requesting or mobilizing others, either in
person or online, to bully others.
Enforcement
-----------
Overseeing the code of conduct
==============================
The DatPy community, composed of volunteers, oversees the
code of conduct, including addressing all incident reports. Breaking the code
of conduct may result in immediate expulsion from the Librehosters network.
How to Report an Incident
=========================
If you witness an incident or are the victim of one:
1. You can reach out directly via email at lukewm@riseup.net.
Acknowledgements
----------------
This code of conduct is inspired by the [IFF CoC].
[IFF CoC]: https://www.internetfreedomfestival.org/wiki/index.php/Code_of_Conduct

67
CONTRIBUTING.rst Normal file
View File

@ -0,0 +1,67 @@
Get started
-----------
Install `Tox`_ with:
.. _tox: http://tox.readthedocs.io/
.. code-block:: bash
$ pip install --user tox
Run tests
---------
.. code-block:: bash
tox -e test
Lint source
-----------
.. code-block:: bash
tox -e lint
Format source
-------------
.. code-block:: bash
tox -e format
Type check source
-----------------
.. code-block:: bash
tox -e type
Release Process
---------------
Add a change entry and re-generate the changelog:
.. code-block:: bash
$ towncrier
Make a new release tag:
.. code-block:: bash
$ git tag x.x.x
$ git push --tags
If you have a development install locally, you can verify:
.. code-block:: bash
$ merkle-tree-stream --version
Then run the release process:
.. code-block:: bash
$ tox -e metadata-release
$ tox -e release

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2019 Luke Murphy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

1
MANIFEST.in Normal file
View File

@ -0,0 +1 @@
include LICENSE README.rst CHANGELOG.rst

41
README.rst Normal file
View File

@ -0,0 +1,41 @@
.. _header:
************************
merkle-tree-stream
************************
.. image:: https://img.shields.io/badge/license-GPL-brightgreen.svg
:target: LICENSE
:alt: Repository license
.. image:: https://badge.fury.io/py/merkle-tree-stream.svg
:target: https://badge.fury.io/py/merkle-tree-stream
:alt: PyPI package
.. image:: https://readthedocs.org/projects/merkle-tree-stream/badge/?version=latest
:target: https://merkle-tree-stream.readthedocs.io/en/latest/
:alt: Documentation status
.. image:: https://img.shields.io/badge/support-maintainers-brightgreen.svg
:target: https://decentral1.se
:alt: Support badge
.. _introduction:
A stream that generates a merkle tree based on the incoming data
----------------------------------------------------------------
.. _documentation:
Documentation
*************
* https://merkle-tree-stream.readthedocs.io/
Code of Conduct
***************
By participating in the merkle-tree-stream community, you agree on the
following code of conduct. Please see `CODE_OF_CONDUCT`_ for the full text.
.. _CODE_OF_CONDUCT: ./CODE_OF_CONDUCT

View File

12
documentation/Makefile Normal file
View File

@ -0,0 +1,12 @@
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = source
BUILDDIR = build
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

View File

@ -0,0 +1,5 @@
*********
Changelog
*********
.. include:: ../../CHANGELOG.rst

View File

@ -0,0 +1 @@
.. include:: ../../CODE_OF_CONDUCT.rst

View File

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

View File

@ -0,0 +1 @@
.. include:: ../../CONTRIBUTING.rst

View File

@ -0,0 +1,12 @@
.. include:: ../../README.rst
:end-before: _documentation
Contents:
=========
.. toctree::
install
contribute
changelog
code-of-conduct

View File

@ -0,0 +1,11 @@
************
Installation
************
.. code-block:: bash
$ pip install merkle-tree-stream
.. note::
This tool only supports Python >= 3.6.

View File

@ -0,0 +1,12 @@
"""merkle-tree-stream module."""
try:
import pkg_resources
except ImportError:
pass
try:
__version__ = pkg_resources.get_distribution('merkle-tree-stream').version
except Exception:
__version__ = 'unknown'

4
mypy.ini Normal file
View File

@ -0,0 +1,4 @@
[mypy]
python_version = 3.7
platform = linux
ignore_missing_imports = True

54
pyproject.toml Normal file
View File

@ -0,0 +1,54 @@
[build-system]
requires = [
"setuptools>=40.9.0",
"setuptools-scm",
"wheel",
]
build-backend = "setuptools.build_meta"
[tool.black]
line-length = 80
target-version = ['py36', 'py37']
skip-string-normalization = true
include = '\.pyi?$'
[tool.towncrier]
directory = "changelog/"
filename = "CHANGELOG.rst"
package = "merkle-tree-stream"
package_dir = "merkle-tree-stream"
[[tool.towncrier.type]]
directory = "removal"
name = "Removals"
showcontent = true
[[tool.towncrier.type]]
directory = "deprecation"
name = "Deprecations"
showcontent = true
[[tool.towncrier.type]]
directory = "feature"
name = "Features"
showcontent = true
[[tool.towncrier.type]]
directory = "bugfix"
name = "Bug Fixes"
showcontent = true
[[tool.towncrier.type]]
directory = "doc"
name = "Improved Documentation"
showcontent = true
[[tool.towncrier.type]]
directory = "trivial"
name = "Trivial/Internal Changes"
showcontent = true
[[tool.towncrier.type]]
directory = "announce"
name = "Project announcements"
showcontent = true

60
setup.cfg Normal file
View File

@ -0,0 +1,60 @@
[tool:pytest]
testpaths = test
[flake8]
max-line-length = 80
[isort]
known_first_party = merkle-tree-stream
known_third_party = pytest
line_length = 80
multi_line_output = 3
skip = .venv, .tox
include_trailing_comma = True
[metadata]
name = merkle-tree-stream
author = decentral1se
author_email = lukewm@riseup.net
maintainer = decentral1se
maintainer_email = lukewm@riseup.net
url = https://hack.decentral1.se/datpy/merkle-tree-stream
project_urls =
Source Code = https://hack.decentral1.se/datpy/merkle-tree-stream
Documentation = https://merkle-tree-stream.readthedocs.io/
Maintainer Support = https://decentral1.se
description = A stream that generates a merkle tree based on the incoming data.
long_description = file: README.rst
license = GPLv3
license_file = LICENSE
classifiers =
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
[options]
use_scm_version = True
python_requires = !=2.7.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*
setup_requires =
setuptools_scm
setuptools_scm_git_archive
package_dir =
= .
packages = find:
zip_safe = False
[options.packages.find]
where = .
[build_sphinx]
all_files = 1
build-dir = documentation/build
source-dir = documentation/source
warning-is-error = True
[options.extras_require]
docs =
sphinx
sphinx-autodoc-typehints >= 1.6.0, < 2.0
changelog =
towncrier <= 19.2.0, < 20.0

3
setup.py Normal file
View File

@ -0,0 +1,3 @@
from setuptools import setup
setup(use_scm_version=True)

0
test/__init__.py Normal file
View File

9
test/test_version.py Normal file
View File

@ -0,0 +1,9 @@
"""Version test module."""
def test_version_fails_gracefully(mocker):
target = 'pkg_resources.get_distribution'
with mocker.patch(target, side_effect=Exception()):
from merkle-tree-stream.__init__ import __version__
assert __version__ == 'unknown'

86
tox.ini Normal file
View File

@ -0,0 +1,86 @@
[tox]
envlist =
{py36,py37}-test
lint
sort
format
type
docs
changelog
metadata-release
skip_missing_interpreters = True
isolated_build = True
[testenv]
description = run the unit tests
deps =
pytest
pytest-cov
pytest-mock
commands =
pytest test/ --cov={toxinidir}/merkle-tree-stream/ --no-cov-on-fail {posargs}
[testenv:lint]
description = lint the source
skipdist = True
deps =
flake8
commands =
flake8 {posargs} merkle-tree-stream/ test/
[testenv:sort]
description = sort the source
skipdist = True
deps =
isort
commands =
isort {posargs:-rc -c} -sp setup.cfg merkle-tree-stream/ test/
[testenv:format]
description = format the source
skipdist = True
basepython = python3.6
deps =
black
commands =
black {posargs:--check} merkle-tree-stream/ test/
[testenv:type]
description = type check the source
basepython = python3.7
skipdist = True
deps =
mypy
commands =
mypy merkle-tree-stream/ test/
[testenv:docs]
description = build the documentation
skipdist = True
deps =
sphinx
commands =
python -m setup build_sphinx
[testenv:changelog]
description = draft the changelog
skipdist = True
deps =
towncrier
commands =
towncrier --draft
[testenv:metadata-release]
description = validate the package metadata
deps =
twine
commands =
twine check .tox/dist/*
[testenv:release]
description = make a release
deps =
{[testenv:metadata-release]deps}
commands =
python -m setup sdist bdist_wheel
twine upload {toxworkdir}/dist/*