Contributing to Larq

👍 🎉 First off, thanks for taking the time to contribute! 👍 🎉

Working on your first Pull Request? You can learn how from this free series How to Contribute to an Open Source Project on GitHub.

Project setup

To send a Pull Request it is required to fork Larq on GitHub. After that clone it to a desired directory:

git clone https://github.com/my-username/larq.git

Install all required dependencies for local development by running:

cd larq # go into the directory you just cloned
pip install -e .[tensorflow] # Installs Tensorflow for CPU
# pip install -e .[tensorflow_gpu] # Installs Tensorflow for GPU
pip install -e .[test] # Installs all development dependencies

Run Unit tests

Inside the project directory run:

pytest .

Build documentation

Installs dependencies for building the docs:

pip install nbconvert git+https://github.com/lgeiger/pydoc-markdown.git
pip install -e .[docs]

Inside the project directory run:

python generate_api_docs.py
mkdocs serve

A new version of the documentation will be automatically published once merged into the master branch.

Code style

We use black to format all of our code. We recommend installing it as a plugin for your favorite code editor.

Publish release

  1. Install dependencies.
python -m pip install --upgrade setuptools wheel twine
  1. Increment the version number in setup.py, and commit the change.

  2. Tag the commit, and push the changes with the new tag.

git tag <version number>
git push && git push --tags
  1. Go to the GitHub releases and create a new release based on the tag you've just pushed, adding some release notes.

  2. Build wheels.

rm -r build/* dist/*
python setup.py sdist bdist_wheel
  1. Upload the release to PyPI.
python -m twine upload dist/*