<commit_before>=====================
Contributing to piper
=====================

Development environment
-----------------------

`piper` uses a straight-forward Python setup. pyenv_ and virtualenv_ are
recommended.

Once in a virtualenv, the tests can be run by `python setup.py test`, which
will download all dependencies.

Code and code guidelines
------------------------

`piper` tests itself, of course! If `piper` can build itself with `piper exec`,
your code is welcome in a Pull Request!

Things to generally think about:

* Code is always welcome, and discussing in an issue before implementing is
  encouraged.
* Commit messages should follow the convention_.
* Unit tests are required, integration tests are encouraged.
* If unsure, strive to emulate the look and feel of the rest of the code.
  Consitency is king!

Test naming
^^^^^^^^^^^

All functions have a corresponding test class in the corresponding test file:

.. code-block:: python

   # in piper/lazer.py
   class Lazergun():
       def pewpew(self):
           # <code>

maps to

.. code-block:: python

   # in test/test_lazer.py<commit_msg>CONTRIBUTING: Add installation instructions<commit_after>=====================
Contributing to piper
=====================

Development environment
-----------------------

`piper` uses a straight-forward Python setup. pyenv_ and virtualenv_ are
recommended.

Once you have pyenv_ installed and loaded:

.. code-block:: shell

   $ pyenv install 3.4.3
   $ PYENV_VERSION=3.4.3 pip install virtualenv

Working on the code
-------------------

Once you've grabbed a copy of the source code:

.. code-block:: shell

    $ cd source_code_checkout
    $ pyenv local 3.4.3
    $ virtualenv piper
    $ source bin/activate
    $ pip install -e .

Unfortunately `pip` can't be told to install the `tests_require` dependencies
so we have to install those manually:

.. code-block:: shell

    $ pip install pytest-cov mock tox

In order to generate the documentation:

.. code-block:: shell

    $ pip install sphinx sphinx_rtd_theme


Code and code guidelines
------------------------

`piper` tests itself, of course! If `piper` can build itself with `piper exec`,
your code is welcome in a Pull Request!

Things to generally think about:

* Code is always welcome, and discussing in an issue before implementing is
  encouraged.
* Commit messages should follow the convention_.
* Unit tests are required, integration tests are encouraged.
* If unsure, strive to emulate the look and feel of the rest of the code.
  Consitency is king!

This code is checked with `flake8` for style, no exceptions. Keep in mind that
making code PEP8 compliant doesn't necessarily make it Pythonic.

Test naming
^^^^^^^^^^^

All functions have a corresponding test class in the corresponding test file:

.. code-block:: python

   # in piper/lazer.py
   class Lazergun():
       def pewpew(self):
           # <code>

maps to

.. code-block:: python

   # in test/test_lazer.py
{'fraction_non_alphanumeric': 0.13328845506563447, 'fraction_numerical': 0.003702457085156513, 'mean_word_length': 3.1508379888268156, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3692096', 'n_tokens_mistral': 845, 'n_tokens_neox': 792, 'n_words': 364}