Reduce package boilerplate

This commit is contained in:
Luke Murphy 2020-05-16 18:15:47 +02:00
parent 255dca336c
commit dd9bfa2821
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
26 changed files with 70 additions and 506 deletions

View File

@ -15,14 +15,10 @@ matrix:
TOXENV: format TOXENV: format
- IMAGE: 3.8-buster - IMAGE: 3.8-buster
TOXENV: type TOXENV: type
- IMAGE: 3.8-buster
TOXENV: docs
- IMAGE: 3.8-buster
TOXENV: metadata-release
pipeline: pipeline:
build: build:
image: python:${IMAGE} image: python:${IMAGE}
commands: commands:
- pip install tox==3.14.6 - pip install tox
- tox -e ${TOXENV} - tox -e ${TOXENV}

38
CHANGELOG.md Normal file
View File

@ -0,0 +1,38 @@
# Flat_Tree 0.0.1a6 (UNRELEASED)
## Removals
- Removed RTD documentation
## Trivial/Internal Changes
- Follow the Hypercore protocol renaming situation.
- Migrate to git.autonomic.zone
- Migrate CI to drone.autonomic.zone
- Reduce package boilerplate
# Flat_Tree 0.0.1a5 (2019-11-03)
## Trivial/Internal Changes
- Fixed documentation build errors.
- Fixed changelog entry date and version.
# Flat_Tree 0.0.1a4 (2019-11-03)
## Improved Documentation
- Use the sphinx_rtd_theme.
- Attempt to clarify sections using better navigation.
# Flat_Tree 0.0.1a3 (2019-07-01)
## Removals
- Don't advertise Python 3.5 which is not supported.
# Flat_Tree 0.0.1a2 (2019-07-01)
## Project Announcements
- The first alpha development release is made!

View File

@ -1,51 +0,0 @@
Flat_Tree 0.0.1a6 (UNRELEASED)
==============================
Trivial/Internal Changes
------------------------
- Migrate to git.autonomic.zone
- Migrate CI to drone.autonomic.zone
Improved Documentation
----------------------
- Follow the Hypercore protocol renaming situation.
Flat_Tree 0.0.1a5 (2019-11-03)
==============================
Trivial/Internal Changes
------------------------
- Fixed documentation build errors.
- Fixed changelog entry date and version.
Flat_Tree 0.0.1a4 (2019-11-03)
==============================
Improved Documentation
----------------------
- Use the sphinx_rtd_theme.
- Attempt to clarify sections using better navigation.
Flat_Tree 0.0.1a3 (2019-07-01)
==============================
Removals
--------
- Don't advertise Python 3.5 which is not supported.
Flat_Tree 0.0.1a2 (2019-07-01)
==============================
Project Announcements
---------------------
- The first alpha development release is made!

View File

@ -1,111 +0,0 @@
Introduction
------------
The Hyperpy 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 Hyperpy 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 Hyperpy community, who respects and stands behind the
code of conduct.
The Hyperpy 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 Hyperpy 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 Hyperpy 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 Hyperpy 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 ``hi@decentral1.se``.
Acknowledgements
----------------
This code of conduct is inspired by the `IFF CoC`_.
.. _IFF CoC: https://www.internetfreedomfestival.org/wiki/index.php/Code_of_Conduct

7
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,7 @@
# Contributing
Install [Tox](http://tox.readthedocs.io).
```bash
$ tox
```

View File

@ -1,69 +0,0 @@
Get started
-----------
Install `Tox`_.
.. _tox: http://tox.readthedocs.io/
Run tests
---------
.. code-block:: bash
$ tox -e py37
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
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
$ tox -e release

View File

@ -1 +1 @@
include LICENSE README.rst CHANGELOG.rst include LICENSE README.md CHANGELOG.md

View File

@ -1,48 +1,20 @@
.. _header: # flat-tree
********* [![Build Status](https://drone.autonomic.zone/api/badges/hyperpy/flat-tree/status.svg)](https://drone.autonomic.zone/hyperpy/flat-tree)
flat-tree
*********
.. image:: https://img.shields.io/badge/license-GPL-brightgreen.svg ## Utilities for navigating flat trees
:target: LICENSE
:alt: Repository license
.. image:: https://badge.fury.io/py/flat-tree.svg ```bash
:target: https://badge.fury.io/py/flat-tree $ pip install flat-tree
:alt: PyPI Package ```
.. image:: https://drone.autonomic.zone/api/badges/hyperpy/flat-tree/status.svg Flat Trees are the core data structure that power Hypercore feeds. They
:target: https://drone.autonomic.zone/hyperpy/flat-tree allow us to deterministically represent a tree structure as a vector.
:alt: Drone CI result This is particularly useful because vectors map elegantly to disk and
memory.
.. image:: https://readthedocs.org/projects/flat-tree/badge/?version=latest Because Flat Trees are deterministic and pre-computed, there is no
:target: https://flat-tree.readthedocs.io/en/latest/?badge=latest overhead to using them. In effect this means that Flat Trees are a
:alt: Documentation Status specific way of indexing into a vector more than they are their own data
structure. This makes them uniquely efficient and convenient to
.. image:: http://img.shields.io/liberapay/patrons/decentral1se.svg?logo=liberapay implement in a wide range of languages.
:target: https://liberapay.com/decentral1se
:alt: Support badge
.. _introduction:
Utilities for navigating flat trees
-----------------------------------
Flat Trees are the core data structure that power Hypercore feeds. They allow
us to deterministically represent a tree structure as a vector. This is
particularly useful because vectors map elegantly to disk and memory.
Because Flat Trees are deterministic and pre-computed, there is no overhead to
using them. In effect this means that Flat Trees are a specific way of indexing
into a vector more than they are their own data structure. This makes them
uniquely efficient and convenient to implement in a wide range of languages.
.. _documentation:
Documentation
*************
* `flat-tree.readthedocs.io`_
.. _flat-tree.readthedocs.io: https://flat-tree.readthedocs.io

View File

@ -1 +0,0 @@
Don't advertise Python 3.5 which is not supported.

View File

@ -1,12 +0,0 @@
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

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

View File

@ -1,6 +0,0 @@
.. _code-of-conduct:
Code of Conduct
***************
.. include:: ../../CODE_OF_CONDUCT.rst

View File

@ -1,8 +0,0 @@
author = 'decentral1se'
copyright = '2020, decentral1se'
html_static_path = ['_static']
html_theme = 'sphinx_rtd_theme'
master_doc = 'index'
project = 'flat-tree'
templates_path = ['_templates']
extensions = ['sphinx.ext.autodoc', 'sphinx_autodoc_typehints']

View File

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

View File

@ -1,24 +0,0 @@
*******
Example
*******
You can represent a binary tree in a simple flat list using the following structure.
.. code-block:: python
"""
3
1 5
0 2 4 6 ...
"""
This module exposes a series of functions to help you build and maintain this data structure.
.. code-block:: python
from flat_tree import FlatTreeAccessor
tree_access = FlatTreeAccessor()
tree_access.index(1, 0) # get index @ depth: 1, offset: 0

View File

@ -1,15 +0,0 @@
.. include:: ../../README.rst
:end-before: _documentation
.. toctree::
:maxdepth: 1
:hidden:
install
upgrade
example
modules-api
other-impls
contribute
changelog
code-of-conduct

View File

@ -1,11 +0,0 @@
*******
Install
*******
.. code-block:: bash
$ pip install flat-tree
.. note::
Only Python >= 3.6 is supported.

View File

@ -1,11 +0,0 @@
.. _modules_api:
***********
Modules API
***********
.. automodule:: flat_tree.accessor
:members:
.. automodule:: flat_tree.iterator
:members:

View File

@ -1,14 +0,0 @@
.. _other-implementations:
Other Implementations
*********************
* `mafintosh/flat-tree`_
* `datrs/flat-tree`_
* `bcomnes/flattree`_
* `datcxx/flat-tree`_
.. _mafintosh/flat-tree: https://github.com/mafintosh/flat-tree
.. _datrs/flat-tree: https://github.com/datrs/flat-tree
.. _bcomnes/flattree: https://github.com/bcomnes/flattree
.. _datcxx/flat-tree: https://github.com/datcxx/flat-tree

View File

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

View File

@ -1,6 +1,6 @@
[build-system] [build-system]
requires = [ requires = [
"setuptools>=40.9.0", "setuptools",
"setuptools-scm", "setuptools-scm",
"wheel", "wheel",
] ]
@ -8,46 +8,4 @@ build-backend = "setuptools.build_meta"
[tool.black] [tool.black]
line-length = 80 line-length = 80
target-version = ["py36", "py37", "py38"] target-version = ["py38"]
include = "\.pyi?$"
[tool.towncrier]
directory = "changelog/"
filename = "CHANGELOG.rst"
package = "flat_tree"
package_dir = "flat_tree"
[[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

View File

@ -15,18 +15,15 @@ include_trailing_comma = True
[metadata] [metadata]
name = flat-tree name = flat-tree
author = decentral1se author = decentral1se
author_email = lukewm@riseup.net author_email = hi@decentral1.se
maintainer = decentral1se maintainer = decentral1se
maintainer_email = lukewm@riseup.net maintainer_email = hi@decentral1.se
url = https://hack.decentral1.se/datpy/flat-tree.git url = https://git.autonomic.zone/hyperpy/flat-tree
project_urls = project_urls =
Source Code = https://hack.decentral1.se/datpy/flat-tree.git Source Code = https://git.autonomic.zone/hyperpy/flat-tree
Changelog = https://flat-tree.readthedocs.io/en/latest/changelog.html
Documentation = https://flat-tree.readthedocs.io/
Maintainer Support = https://liberapay.com/decentral1se
description = Utilities for navigating flat trees description = Utilities for navigating flat trees
long_description = file: README.rst long_description = file: README.md
license = MIT license = GPLv3
license_file = LICENSE license_file = LICENSE
classifiers = classifiers =
Programming Language :: Python :: 3 Programming Language :: Python :: 3
@ -49,17 +46,3 @@ install_requires =
[options.packages.find] [options.packages.find]
where = . where = .
[build_sphinx]
all_files = 1
build-dir = docs/build
source-dir = docs/source
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

40
tox.ini
View File

@ -5,14 +5,10 @@ envlist =
sort sort
format format
type type
docs
changelog
metadata-release
skip_missing_interpreters = True skip_missing_interpreters = True
isolated_build = True isolated_build = True
[testenv] [testenv]
description = run the unit tests
deps = deps =
pytest pytest
pytest-cov pytest-cov
@ -20,62 +16,26 @@ deps =
commands = pytest test/ --cov={toxinidir}/flat_tree/ --no-cov-on-fail {posargs} commands = pytest test/ --cov={toxinidir}/flat_tree/ --no-cov-on-fail {posargs}
[testenv:lint] [testenv:lint]
description = lint the source
skipdist = True skipdist = True
deps = flake8 deps = flake8
commands = flake8 {posargs} flat_tree/ test/ commands = flake8 {posargs} flat_tree/ test/
[testenv:sort] [testenv:sort]
description = sort the source
skipdist = True skipdist = True
deps = isort deps = isort
commands = isort {posargs:-rc -c} -sp setup.cfg flat_tree/ test/ commands = isort {posargs:-rc -c} -sp setup.cfg flat_tree/ test/
[testenv:format] [testenv:format]
description = format the source
skipdist = True skipdist = True
basepython = python3.6
deps = black deps = black
commands = black {posargs:--check} flat_tree/ test/ commands = black {posargs:--check} flat_tree/ test/
[testenv:type] [testenv:type]
description = type check the source
basepython = python3.7
skipdist = True skipdist = True
deps = mypy deps = mypy
commands = mypy flat_tree/ test/ commands = mypy flat_tree/ test/
[testenv:docs]
description = build the documentation
extras = docs
commands = python -m setup build_sphinx
[testenv:docs-livereload]
description = invoke sphinx-autobuild to build and reload the documentation
commands = python -m sphinx_autobuild docs/source docs/build
deps = sphinx-autobuild>=0.7.1,<1.0
extras = docs
[testenv:changelog]
description = draw up the new changelog
skipdist = True
passenv = VERSION
deps = towncrier
commands = towncrier --version={env:VERSION} {posargs}
[testenv:metadata-release]
description = validate the package metadata
deps = twine
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] [testenv:release]
description = make a release
deps = {[testenv:metadata-release]deps} deps = {[testenv:metadata-release]deps}
commands = commands =
rm -rf {toxworkdir}/dist rm -rf {toxworkdir}/dist