23 Commits

Author SHA1 Message Date
ff7f671b96 Fix up changelog for new release 2019-11-03 16:30:11 +01:00
9140bbe658 Fix documentation build 2019-11-03 16:28:47 +01:00
16d2ed16d9 Use better docs theme and clarify docs 2019-11-03 16:15:14 +01:00
9397108a64 Fix badge 2019-10-09 00:46:17 +02:00
14cf07deef Merge pull request #1 from datpy/cleanups-gardening
Cleanups on package meta and docs
2019-10-06 15:37:57 +02:00
15347e4fe6 Make those proper links too 2019-10-06 15:37:39 +02:00
501ab942a7 Inline tox defs 2019-10-06 15:30:15 +02:00
dafa908668 Mark >=3.6 less verbosely 2019-10-06 15:30:01 +02:00
dfaae5a55e Make those links 2019-10-06 15:29:55 +02:00
57933a0ef6 Add example 2019-10-06 15:29:34 +02:00
be91ee85fe Simplify release documentation 2019-10-06 15:29:23 +02:00
b03ed5e16c Remove issue markers which don't exist 2019-10-06 15:29:14 +02:00
1538406c60 Mark test envs only by version 2019-10-06 15:29:05 +02:00
398000789c Add note about iterators 2019-08-07 08:07:45 +02:00
021cdffbd1 Add Travis CI 2019-08-04 00:57:53 +02:00
9d240d0c7e Fix mirror links 2019-08-04 00:42:30 +02:00
53cb1e1f97 Add RST headers for the modules API 2019-07-08 12:17:15 +02:00
891bf5c60c Add Github funding file 2019-07-08 12:04:39 +02:00
0722874cbd Use same style version match as other entries 2019-07-02 10:23:37 +02:00
4e7183e209 Add change log entry for another small alpha 2019-07-01 18:34:47 +02:00
0d0aa70ba9 Don't advertise Pythons we don't support 2019-07-01 18:33:37 +02:00
e37c5a3029 Use the matching PyPi metadata name 2019-07-01 18:33:29 +02:00
60dbd4c7c1 Make sure changelog folder is retained by Git 2019-07-01 18:12:50 +02:00
17 changed files with 191 additions and 87 deletions

26
.travis.yml Normal file
View File

@ -0,0 +1,26 @@
language: python
matrix:
include:
- python: 3.6
env: TOXENV=py36
- python: 3.7
env: TOXENV=py37
- python: 3.7
env: TOXENV=lint
- python: 3.7
env: TOXENV=sort
- python: 3.7
env: TOXENV=format
- python: 3.7
env: TOXENV=type
- python: 3.7
env: TOXENV=docs
- python: 3.7
env: TOXENV=metadata-release
install:
- pip install tox==3.13.2
script:
- tox -v

View File

@ -1,7 +1,36 @@
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
---------------------
- Initial development release is made! (#1)
- The first alpha development release is made!

View File

@ -1,67 +1,69 @@
Get started
-----------
Install `Tox`_ with:
Install `Tox`_.
.. _tox: http://tox.readthedocs.io/
.. code-block:: bash
$ pip install --user tox
Run tests
---------
.. code-block:: bash
tox -e test
$ tox -e py37
Lint source
-----------
.. code-block:: bash
tox -e lint
$ tox -e lint
Format source
-------------
.. code-block:: bash
tox -e format
$ tox -e format
Type check source
-----------------
.. code-block:: bash
tox -e type
$ tox -e type
Release Process
---------------
Add a change entry and re-generate the changelog:
Build the documentation
-----------------------
.. code-block:: bash
$ towncrier
$ tox -e docs
$ tox -e docs-livereload
Make a new release tag:
Make a new release
------------------
.. code-block:: bash
$ git tag x.x.x
$ git push --tags
If you have a development install locally, you can verify:
.. code-block:: bash
$ flat_tree --version
Then run the release process:
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

1
FUNDING.yml Normal file
View File

@ -0,0 +1 @@
liberapay: decentral1se

View File

@ -1,17 +1,21 @@
.. _header:
*********
flat_tree
flat-tree
*********
.. image:: https://img.shields.io/badge/license-MIT-brightgreen.svg
:target: LICENSE
:alt: Repository license
.. image:: https://badge.fury.io/py/flat_tree.svg
:target: https://badge.fury.io/py/flat_tree
.. image:: https://badge.fury.io/py/flat-tree.svg
:target: https://badge.fury.io/py/flat-tree
:alt: PyPI Package
.. image:: https://travis-ci.com/datpy/flat-tree.svg?branch=master
:target: https://travis-ci.com/datpy/flat-tree
:alt: Travis CI result
.. image:: https://readthedocs.org/projects/flat-tree/badge/?version=latest
:target: https://flat-tree.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
@ -39,17 +43,15 @@ From `The Dat Protocol`_:
them uniquely efficient and convenient to implement in a wide range of
languages.
Part of the `DatPy`_ project.
.. _DatPy: https://datpy.decentral1.se/
.. _documentation:
Documentation
*************
* https://flat_tree.readthedocs.io
* `flat-tree.readthedocs.io`_
.. _mirroring:
Mirroring
*********
* https://hack.decentral1.se/datpy/flat_tree (primary)
* https://github.com/datpy/flat_tree
.. _flat-tree.readthedocs.io: https://flat-tree.readthedocs.io

View File

1
changelog/1.removal.rst Normal file
View File

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

View File

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

View File

@ -0,0 +1,24 @@
*******
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,12 +1,13 @@
.. include:: ../../README.rst
:end-before: _documentation
Table of Contents
*****************
.. toctree::
:maxdepth: 1
:hidden:
install
upgrade
example
modules-api
other-impls
contribute

View File

@ -4,7 +4,7 @@ Install
.. code-block:: bash
$ pip install flat_tree
$ pip install flat-tree
.. note::

View File

@ -1,3 +1,5 @@
.. _modules_api:
***********
Modules API
***********

View File

@ -3,7 +3,12 @@
Other Implementations
*********************
* https://github.com/mafintosh/flat-tree
* https://github.com/datrs/flat-tree
* https://github.com/bcomnes/flattree
* https://github.com/datcxx/flat-tree
* `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

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

View File

@ -19,6 +19,10 @@ class FlatTreeIterator:
def __attrs_post_init__(self):
self.seek(self.index)
# TODO(decentral1se): Once we get to the point of actually using this
# module in hypercore or wherever it is needed we should consider whether
# or not to make this a real Python iterator using the protocol methods of
# __iter__ and __next__
def next(self) -> int:
"""The next index in the tree."""
self.offset += 1

View File

@ -30,13 +30,12 @@ license = MIT
license_file = LICENSE
classifiers =
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
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.*
python_requires = >=3.6
setup_requires =
setuptools_scm
setuptools_scm_git_archive
@ -59,6 +58,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

72
tox.ini
View File

@ -1,6 +1,6 @@
[tox]
envlist =
{py36,py37}-test
{py36,py37}
lint
sort
format
@ -17,70 +17,70 @@ deps =
pytest
pytest-cov
pytest-mock
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]
description = lint the source
skipdist = True
deps =
flake8
commands =
flake8 {posargs} flat_tree/ test/
deps = flake8
commands = flake8 {posargs} flat_tree/ test/
[testenv:sort]
description = sort the source
skipdist = True
deps =
isort
commands =
isort {posargs:-rc -c} -sp setup.cfg flat_tree/ test/
deps = isort
commands = isort {posargs:-rc -c} -sp setup.cfg flat_tree/ test/
[testenv:format]
description = format the source
skipdist = True
basepython = python3.6
deps =
black
commands =
black {posargs:--check} flat_tree/ test/
deps = black
commands = black {posargs:--check} flat_tree/ test/
[testenv:type]
description = type check the source
basepython = python3.7
skipdist = True
deps =
mypy
commands =
mypy flat_tree/ test/
deps = mypy
commands = mypy flat_tree/ test/
[testenv:docs]
description = build the documentation
deps =
sphinx
sphinx-autodoc-typehints >= 1.6.0, < 2.0
commands =
python -m setup build_sphinx
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 documentation/source documentation/build
deps = sphinx-autobuild>=0.7.1,<1.0
extras = docs
[testenv:changelog]
description = draft the changelog
description = draw up the new changelog
skipdist = True
deps =
towncrier
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 .tox/dist/*
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]
description = make a release
deps =
{[testenv:metadata-release]deps}
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