Skip to content

Commit b9d4fbf

Browse files
committed
Overhaul for 4.0
1 parent 8119d0d commit b9d4fbf

File tree

16 files changed

+706
-584
lines changed

16 files changed

+706
-584
lines changed

.travis.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@ python:
66
- 3.5
77
- 3.6
88
install:
9-
- pip install coverage
10-
- pip install pytest
11-
- pip install pytest-cov
12-
- pip install python-coveralls
13-
- pip install flake8
14-
- python setup.py install
9+
- pip install flake8 mock pytest pytest-cov python-coveralls sphinx sphinx_rtd_theme
10+
- pip install .
1511
script:
16-
- python -m flake8 binarytree/__init__.py
17-
- python -m doctest binarytree/__init__.py
18-
- py.test tests.py --cov=binarytree
12+
- python -m flake8
13+
- python -m sphinx -b doctest docs docs/_build
14+
- python -m sphinx -b html -W docs docs/_build
15+
- py.test -s -v --cov=binarytree
1916
after_success:
2017
- coveralls

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
include README.rst LICENSE
2+
prune tests

README.rst

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,22 @@ Are you studying binary trees for your next exam, assignment or technical interv
3737

3838
**Binarytree** is a Python library which provides a simple API to generate,
3939
visualize, inspect and manipulate binary trees. It allows you to skip the
40-
tedious work of setting up test data, and dive straight into practising
41-
your algorithms! Heaps and BSTs (binary search trees) are also supported.
40+
tedious work of setting up test data, and dive straight into practising your
41+
algorithms. Heaps and BSTs (binary search trees) are also supported.
4242

4343
Announcements
4444
=============
4545

46-
* **Binarytree** has been completely overhauled in version `3.0`_!
46+
* **Binarytree** version `4.0`_ is now out!
4747
* Please see the releases_ page for details on the latest updates.
4848

49-
.. _3.0: https://github.com/joowani/binarytree/releases/tag/3.0.0
49+
.. _4.0: https://github.com/joowani/binarytree/releases/tag/4.0.0
5050
.. _releases: https://github.com/joowani/binarytree/releases
5151

5252
Requirements
5353
============
5454

5555
- Python 2.7, 3.4, 3.5 or 3.6
56-
- Pip_ installer
57-
58-
.. _Pip: https://pip.pypa.io
5956

6057
Installation
6158
============
@@ -66,19 +63,17 @@ To install a stable version from PyPi_:
6663
6764
~$ pip install binarytree
6865
69-
7066
To install the latest version directly from GitHub_:
7167

7268
.. code-block:: bash
7369
7470
~$ pip install -e [email protected]:joowani/binarytree.git@master#egg=binarytree
7571
76-
You may need to use ``sudo`` depending on your environment setup.
72+
You may need to use ``sudo`` depending on your environment.
7773

7874
.. _PyPi: https://pypi.python.org/pypi/binarytree
7975
.. _GitHub: https://github.com/joowani/binarytree
8076

81-
8277
Getting Started
8378
===============
8479

@@ -93,7 +88,6 @@ By default, **binarytree** uses the following class to represent a node:
9388
self.left = left # Left child
9489
self.right = right # Right child
9590
96-
9791
Generate and pretty-print various types of binary trees:
9892

9993
.. code-block:: python
@@ -164,7 +158,6 @@ Use the `binarytree.Node`_ class to build your own trees:
164158
# 4
165159
#
166160
167-
168161
Inspect tree properties:
169162

170163
.. code-block:: python
@@ -296,7 +289,6 @@ Use `level-order (breadth-first)`_ indexes to manipulate nodes:
296289
# \
297290
# 2-3
298291
299-
300292
Traverse the trees using different algorithms:
301293

302294
.. code-block:: python
@@ -329,19 +321,20 @@ Traverse the trees using different algorithms:
329321
>>> root.levelorder
330322
[Node(1), Node(2), Node(3), Node(4), Node(5)]
331323
324+
>>> list(root) # Equivalent to root.levelorder
325+
[Node(1), Node(2), Node(3), Node(4), Node(5)]
332326
333327
`List representations`_ are also supported:
334328

335-
.. _List representations:
336-
https://en.wikipedia.org/wiki/Binary_tree#Arrays
337-
329+
.. _List representations: https://en.wikipedia.org/wiki/Binary_tree#Arrays
338330

339331
.. code-block:: python
340332
341333
>>> from binarytree import build
342334
>>>
343335
>>> # Build a tree from list representation
344-
>>> root = build([7, 3, 2, 6, 9, None, 1, 5, 8])
336+
>>> values = [7, 3, 2, 6, 9, None, 1, 5, 8]
337+
>>> root = build(values)
345338
>>> print(root)
346339
#
347340
# __7
@@ -353,19 +346,16 @@ Traverse the trees using different algorithms:
353346
# 5 8
354347
#
355348
>>> # Convert the tree back to list representation
356-
>>> list(root)
349+
>>> root.values
357350
[7, 3, 2, 6, 9, None, 1, 5, 8]
358351
359-
360-
361352
Check out the documentation_ for more details!
362353

363354
.. _documentation: http://binarytree.readthedocs.io/en/latest/index.html
364355

365-
366356
Contributing
367357
============
368358

369359
Please have a look at this page_ before submitting a pull request. Thanks!
370360

371-
.. _page: http://binarytree.readthedocs.io/en/latest/contributing.html
361+
.. _page: http://binarytree.readthedocs.io/en/latest/contributing.html

0 commit comments

Comments
 (0)