Skip to content

Commit

Permalink
Improve documentation and build files
Browse files Browse the repository at this point in the history
  • Loading branch information
joowani committed Jun 12, 2020
1 parent 76f6a12 commit 22fc4b7
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 76 deletions.
20 changes: 7 additions & 13 deletions .travis.yml
@@ -1,19 +1,13 @@
sudo: false
language: python
matrix:
include:
- python: 2.7
- python: 3.5
- python: 3.6
- python: 3.7
dist: xenial
sudo: true
python:
- "2.7"
- "3.5"
- "3.6"
- "3.7"
- "3.8"
install:
- pip install flake8
- pip install mock
- pip install pytest==3.5.1
- pip install pytest-cov==2.5.1
- pip install python-coveralls==2.9.1
- pip install flake8 mock pytest pytest-cov coveralls
- pip install sphinx sphinx_rtd_theme
- pip install .
script:
Expand Down
7 changes: 0 additions & 7 deletions README.rst
Expand Up @@ -40,13 +40,6 @@ visualize, inspect and manipulate binary trees. It allows you to skip the
tedious work of setting up test data, and dive straight into practising your
algorithms. Heaps and BSTs (binary search trees) are also supported.

Announcements
=============

* Please see the releases_ page for details on the latest updates.

.. _releases: https://github.com/joowani/binarytree/releases

Requirements
============

Expand Down
73 changes: 20 additions & 53 deletions docs/contributing.rst
@@ -1,45 +1,27 @@
Contributing
------------

Instructions
Requirements
============

Before submitting a pull request on GitHub_, please make sure you meet the
following **requirements**:

* The pull request points to the dev_ (development) branch.
* All changes are squashed into a single commit (I like to use ``git rebase -i``
to do this).
* The commit message is in present tense (good: "Add feature", bad:
"Added feature").
* Correct and consistent style: Sphinx_-compatible docstrings, correct snake
and camel casing, and PEP8_ compliance (see below).
* No classes/methods/functions with missing docstrings or commented-out lines.
You can take a look at the source code on GitHub_ for examples.
* The test coverage_ remains at %100. You may find yourself having to write
superfluous unit tests to keep this number up. If a piece of code is trivial
and has no need for tests, use this_ to exclude it from coverage.
* No build failures on TravisCI_. The builds automatically trigger on PR
submissions.
* Does not break backward-compatibility (unless there is a really good reason).
* Compatibility with all supported Python versions: 2.7, 3.4, 3.5 and 3.6.

.. warning::
The dev branch is occasionally rebased_, and its commit history may be
overwritten in the process. Before you begin feature work, git fetch or
pull to ensure that your local branch has not diverged. If you see git
conflicts and just want to start from scratch, run these commands:

.. code-block:: bash
~$ git checkout dev
~$ git fetch origin
~$ git reset --hard origin/dev # THIS WILL WIPE ALL LOCAL CHANGES
When submitting a pull request, please ensure your changes meet the following
requirements:

* Pull request points to dev_ (development) branch.
* Changes are squashed into a single commit.
* Commit message is in present tense (e.g. "Add foo" over "Added foo").
* Sphinx_-compatible docstrings.
* PEP8_ compliance.
* Test coverage_ remains at %100.
* No build failures on TravisCI_.
* Up-to-date documentation (see below).
* Maintains backward-compatibility.
* Maintains compatibility with Python 2.7+ and 3.4+.

Style
=====

To ensure PEP8_ compliance, run flake8_:
Run flake8_ to check style:

.. code-block:: bash
Expand All @@ -48,17 +30,11 @@ To ensure PEP8_ compliance, run flake8_:
~$ cd binarytree
~$ flake8
You must resolve all issues reported. If there is a good reason to ignore
errors coming from a specific piece of code, visit here_ to see how to exclude
the lines.
Testing
=======

To test your changes, run the unit tests that come with **binarytree** on your
local machine. The tests use pytest_.

To run the unit tests:
Run unit tests:

.. code-block:: bash
Expand All @@ -67,44 +43,35 @@ To run the unit tests:
~$ cd binarytree
~$ py.test --verbose
To run the unit tests with coverage report:
Run unit tests with coverage:

.. code-block:: bash
~$ pip install coverage pytest pytest-cov
~$ git clone https://github.com/joowani/binarytree.git
~$ cd binarytree
~$ py.test --verbose --cov=binarytree --cov-report=html
~$ py.test --cov=binarytree --cov-report=html
# Open the generated file htmlcov/index.html in a browser
Documentation
=============

The documentation (including the README) is written in reStructuredText_ and
uses Sphinx_. To build an HTML version of the documentation on your local
machine:
Documentation uses reStructuredText_ and Sphinx_. To build locally:

.. code-block:: bash
~$ pip install sphinx sphinx_rtd_theme
~$ git clone https://github.com/joowani/binarytree.git
~$ cd binarytree/docs
~$ sphinx-build . build
# Open build/index.html in a browser
# Open the generated file build/index.html in a browser
As always, thank you for your contribution!
.. _rebased: https://git-scm.com/book/en/v2/Git-Branching-Rebasing
.. _dev: https://github.com/joowani/binarytree/tree/dev
.. _GitHub: https://github.com/joowani/binarytree
.. _PEP8: https://www.python.org/dev/peps/pep-0008/
.. _coverage: https://coveralls.io/github/joowani/binarytree
.. _this: http://coverage.readthedocs.io/en/latest/excluding.html
.. _TravisCI: https://travis-ci.org/joowani/binarytree
.. _Sphinx: https://github.com/sphinx-doc/sphinx
.. _flake8: http://flake8.pycqa.org
.. _here: http://flake8.pycqa.org/en/latest/user/violations.html#in-line-ignoring-errors
.. _pytest: https://github.com/pytest-dev/pytest
.. _reStructuredText: https://en.wikipedia.org/wiki/ReStructuredText
2 changes: 1 addition & 1 deletion docs/exceptions.rst
@@ -1,7 +1,7 @@
Exceptions
----------

The page lists the exceptions raised by **binarytree**:
This page contains exceptions raised by **binarytree**:

.. automodule:: binarytree.exceptions
:members:
4 changes: 2 additions & 2 deletions pytest.ini
@@ -1,4 +1,4 @@
[pytest]
python_files = tests.py test_*.py *_tests.py
addopts = -vv -p no:warnings --cov=binarytree
norecursedirs = venv htmlcov build dist .idea .git
addopts = -s -vv -p no:warnings --cov=binarytree
norecursedirs = .cache .git .idea .pytest_cache build dist docs htmlcov venv
3 changes: 3 additions & 0 deletions setup.cfg
@@ -1,2 +1,5 @@
[bdist_wheel]
universal = 1

[flake8]
exclude = .cache,.git,.idea,.pytest_cache,__pycache__,docs/conf.py,dist,venv

0 comments on commit 22fc4b7

Please sign in to comment.