Skip to content
Andrea Tagliasacchi edited this page May 26, 2020 · 13 revisions

How to contribute to tensorflow_graphics


WARNING: work in progress – tracked by #302.


If you have used GitHub to contribute to open source projects before, and you are familiar with TravisCI and/or GitHub Actions, you might understand everything by looking at our continuous integration configs //.github/workflows/build.yml.

Copyright attribution

Whenever you contribute to TensorFlow Graphics, make sure you use this default copyright attribution (first line of each source file, before the start of the license statement). We will add you to the list of official contributors once your pull request is accepted.

# Copyright 2020 The TensorFlow Authors

Create a pull request

Quickly read the how to create a pull request step-by-step guide. In what follows, we will assume you will have gone through these steps.

Running from source

To avoid polluting your global environment, we recommend you to use virtual environments with python3 (You can add the option --system-site-packages to virtualenv if you want to reuse pre-installed packages).

~/: sudo pip3 install -U virtualenv
~/: virtualenv -p python3 ~/Envs/tfg
~/: source ~/Envs/tfg/bin/activate
(tfg) ~:

Let's clone the fork you have setup, install python and system requirements, and then modify the python path to let python find the tensorflow_graphics module without need for installation:

(tfg) ~/: git clone https://github.com/ataiya/graphics.git ~/tfg
(tfg) ~/: sudo xargs apt-get -y install < ~/tfg/requirements.unix
(tfg) ~/: pip install -r ~/tfg/requirements.txt
(tfg) ~/: export PYTHONPATH="$HOME/tfg:$PYTHONPATH"
(tfg) ~/: python -c "import tensorflow_graphics as tfg; print(tfg.__version__)"
HEAD

Note that we only set a version when the package is published to PyPi, therefore tensorflow_graphics's version is HEAD when used from source.

Lint standards

Your pull request will fail if your contributions do not follow our coding standards. You can verify this is the case by executing flake8 with the provided configuration file as follows, and ensure no errors/warning are produced:

(tfg) ~/: python -m pip install --upgrade pip
(tfg) ~/: pip install flake8
(tfg) ~/: flake8 --config=~/tfg/.flake8 ~/tfg/tensorflow_graphics/

Testing your changes

Your pull request will fail if your contributions break existing tests. We employ python unittest with this configuration file and collect tests within files with a *_test.py suffix (notice the ini file is auto-discovered by pytest, but we mention it explicitly here for clarity):

(tfg) ~/: python -m pip install --upgrade pip
(tfg) ~/: pip install pytest
(tfg) ~/: pytest -c ~/tfg/pytest.ini ~/tfg/tensorflow_graphics/