Contributing to TensorNets
Contributions to TensorNets are welcome! This guide provides instructions for setting up your development environment and running tests.
Development Environment Setup
-
Fork and Clone the Repository: Start by forking the TensorNets repository on GitHub and cloning your fork locally.
git clone https://github.com/<your-username>/tensornets.git cd tensornets
-
Create a Virtual Environment: It is highly recommended to work within a virtual environment. You can use
conda
as specified in the.travis.yml
file.# Create a conda environment for Python 3.6 conda create -n tensornets-dev python=3.6 source activate tensornets-dev
-
Install Dependencies: Install the project dependencies. The
.travis.yml
file provides a good reference for the required packages.pip install --only-binary=numpy,scipy numpy scipy cython opencv-python==4.1.0.25 pip install pytest==5.4.3 pytest-pep8 pip install tensorflow==1.14.0 # Or another version you want to test against
-
Install TensorNets in Editable Mode: Install the package in editable mode so that your changes are reflected immediately.
pip install -e .
Running Tests
TensorNets uses pytest
for its test suite. The tests are configured in .travis.yml
and pytest.ini
.
Code Style (PEP8)
To check for PEP8 compliance, run the following command from the root of the repository:
PYTHONPATH=$PWD:$PYTHONPATH pytest --pep8 -m pep8
The pytest.ini
file contains configurations to ignore certain PEP8 rules.
Unit and Integration Tests
To run the main test suite, use the following command:
PYTHONPATH=$PWD:$PYTHONPATH pytest tests/ --verbose --ignore=tests/all*
This command executes the tests in the tests/
directory, excluding the all*
files which are likely for comprehensive, long-running evaluations.
Test Matrix
The project is tested against a matrix of Python and TensorFlow versions, as defined in .travis.yml
. This ensures broad compatibility. When you submit a pull request, these tests will be run automatically by Travis CI.
Supported Python Versions: 2.7, 3.6
Supported TensorFlow Versions: A wide range from 1.4.0 up to 2.2.0.
Submitting a Pull Request
- Create a new branch for your feature or bug fix.
- Make your changes and add tests for them.
- Ensure all tests pass locally.
- Push your branch to your fork and open a pull request against the
master
branch of the main TensorNets repository.