Contributing to Infuse

Thank you for considering to contribute to Infuse.

Setup for development

  • Fork Infuse to your GitHub account.

  • Clone the Infuse repository locally.

    $ git clone https://github.com/crazytruth/infuse
    $ cd infuse
    
  • Add your fork as a remote to push your work to. Replace {username} with your username. This names the remote “fork”, the default crazytruth remote is “origin”.

    git remote add fork https://github.com/{username}/infuse
    
  • Create a virtualenv with pyenv and pyenv-virtualenv.

    • Prerequisites for creating a virtualenv

      Please install pyenv and pyenv-virtualenv if you dont have them installed.

      You must also install the Python versions with pyenv.

      # to view available python versions
      $ pyenv install --list
      
      # to install python 3.6.12
      $ pyenv install 3.6.12
      

    Now to settings the virtual environment.

    Replace {pythonversion} with the python version to create the virtual environment in.

    $ pyenv virtualenv {pythonversion} infuse
    $ pyenv local infuse
    
  • Install Infuse in editable mode with development dependencies.

    $ pip install -e . -r requirements/dev.txt
    
  • Install the pre-commit hooks.

    $ pre-commit install
    

Start coding

  • Create a branch to identify the issue you would like to work on. If you’re submitting a bug or documentation fix, branch off of the latest “.x” branch.

    $ git fetch origin
    $ git checkout -b your-branch-name origin/1.1.x
    

    If you’re submitting a feature addition or change, branch off of the “master” branch.

    $ git fetch origin
    $ git checkout -b your-branch-name origin/master
    
  • Using your favorite editor, make your changes, committing as you go.

  • Include tests that cover any code changes you make. Make sure the test fails without your patch. Run the tests as described below.

  • Push your commits to your fork on GitHub and create a pull request. Link to the issue being addressed with fixes #123 in the pull request.

    $ git push --set-upstream fork your-branch-name
    

Running the tests

Run the basic test suite with pytest.

$ pytest

This runs the tests for the current environment, which is usually sufficient. CI will run the full suite when you submit your pull request. You can run the full test suite with tox if you don’t want to wait.

$ tox

Running test coverage

Generating a report of lines that do not have test coverage can indicate where to start contributing. Run pytest using coverage and generate a report.

$ pip install coverage
$ coverage run -m pytest
$ coverage html

Open htmlcov/index.html in your browser to explore the report.

Read more about coverage.

Building the docs

Build the docs in the docs directory using Sphinx.

$ cd docs
$ make html

Open build/html/index.html in your browser to view the docs.

Read more about Sphinx.

To recompile requirements

All requirements for development, tests, and documentation are in requirements directory.

To recompile requirements. Add the requirements to *.in

$ cd requirements
$ pip-compile dev.in