Skip to content

Latest commit

 

History

History
134 lines (82 loc) · 5.03 KB

CONTRIBUTING.md

File metadata and controls

134 lines (82 loc) · 5.03 KB

Contributing to torchcam

Everything you need to know to contribute efficiently to the project!

Whatever the way you wish to contribute to the project, please respect the code of conduct.

Codebase structure

  • torchcam - The actual torchcam library
  • tests - Python unit tests
  • docs - Sphinx documentation building
  • scripts - Example and utilities scripts
  • demo - Small demo app to showcase TorchCAM capabilities

Continuous Integration

This project uses the following integrations to ensure proper codebase maintenance:

  • Github Worklow - run jobs for package build and coverage
  • Codacy - analyzes commits for code quality
  • Codecov - reports back coverage results

As a contributor, you will only have to ensure coverage of your code by adding appropriate unit testing of your code.

Feedback

Feature requests & bug report

Whether you encountered a problem, or you have a feature suggestion, your input has value and can be used by contributors to reference it in their developments. For this purpose, we advise you to use Github issues.

First, check whether the topic wasn't already covered in an open / closed issue. If not, feel free to open a new one! When doing so, use issue templates whenever possible and provide enough information for other contributors to jump in.

Questions

If you are wondering how to do something with TorchCAM, or a more general question, you should consider checking out Github discussions. See it as a Q&A forum, or the TorchCAM-specific StackOverflow!

Submitting a Pull Request

Preparing your local branch

1 - Fork this repository by clicking on the "Fork" button at the top right of the page. This will create a copy of the project under your GitHub account (cf. Fork a repo).

2 - Clone your fork to your local disk and set the upstream to this repo

git clone git@github.com:<YOUR_GITHUB_ACCOUNT>/torch-cam.git
cd torch-cam
git remote add upstream https://github.com/frgfm/torch-cam.git

3 - You should not work on the main branch, so let's create a new one

git checkout -b a-short-description

4 - You only have to set your development environment now. First uninstall any existing installation of the library with pip uninstall torchcam, then:

pip install -e ".[dev]"
pre-commit install

Developing your feature

Commits

  • Code: ensure to provide docstrings to your Python code. In doing so, please follow Google-style so it can ease the process of documentation later.
  • Commit message: please follow Udacity guide

Unit tests

In order to run the same unit tests as the CI workflows, you can run unittests locally:

make test

Code quality

To run all quality checks together

make quality
Lint verification

To ensure that your incoming PR complies with the lint settings, you need to install flake8 and run the following command from the repository's root folder:

flake8 ./

This will read the .flake8 setting file and let you know whether your commits need some adjustments.

Import order

In order to ensure there is a common import order convention, run isort as follows:

isort **/*.py

This will reorder the imports of your local files.

Annotation typing

Additionally, to catch type-related issues and have a cleaner codebase, annotation typing are expected. After installing mypy, you can run the verifications as follows:

mypy

The pyproject.toml file will be read to check your typing.

Code formatting

Finally, code formatting is a good practice for shareable projects. After installing black, you can run the verifications as follows:

black .

Submit your modifications

Push your last modifications to your remote branch

git push -u origin a-short-description

Then open a Pull Request from your fork's branch. Follow the instructions of the Pull Request template and then click on "Create a pull request".