Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Updates CONTRIBUTING & README #220

Merged
merged 3 commits into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 8 additions & 31 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,45 +83,22 @@ make test

#### Code quality

To run all quality checks together
The CI will also run some sanity checks (header format, dependency consistency, etc.), which you can run as follows:

```shell
make quality
```

##### Lint verification
This will read `pyproject.toml` and run:
- lint checking ([ruff](https://docs.astral.sh/ruff/))
- type annotation checking ([mypy](https://github.com/python/mypy))
- code formatting ([black](https://github.com/psf/black))
- security checking ([bandit](https://github.com/PyCQA/bandit))

To ensure that your incoming PR complies with the lint settings, you need to install [flake8](https://flake8.pycqa.org/en/latest/) and run the following command from the repository's root folder:
You can apply automatic fix to most of those by running:

```shell
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](https://github.com/PyCQA/isort) as follows:

```shell
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](https://github.com/python/mypy), you can run the verifications as follows:

```shell
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](https://github.com/psf/black), you can run the verifications as follows:

```shell
black .
make style
```

### Submit your modifications
Expand Down
36 changes: 23 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@

# TorchCAM: class activation explorer
<h1 align="center">
TorchCAM: class activation explorer
</h1>

<p align="center">
<a href="https://github.com/frgfm/torch-cam/actions/workflows/builds.yml">
<img alt="CI Status" src="https://img.shields.io/github/actions/workflow/status/frgfm/torch-cam/builds.yml?branch=main&label=CI&logo=github&style=flat-square">
</a>
<a href="https://frgfm.github.io/torch-cam">
<img src="https://img.shields.io/github/actions/workflow/status/frgfm/torch-cam/docs.yaml?branch=main&label=docs&logo=read-the-docs&style=flat-square" alt="Documentation Status">
</a>
<a href="https://codecov.io/gh/frgfm/torch-cam">
<img src="https://img.shields.io/codecov/c/github/frgfm/torch-cam.svg?logo=codecov&style=flat-square" alt="Test coverage percentage">
<a href="https://github.com/astral-sh/ruff">
<img src="https://img.shields.io/badge/Linter-Ruff-FCC21B?style=flat-square&logo=ruff&logoColor=white" alt="ruff">
</a>
<a href="https://github.com/ambv/black">
<img src="https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square" alt="black">
<a href="https://github.com/psf/black">
<img src="https://img.shields.io/badge/Formatter-Black-000000?style=flat-square&logo=Python&logoColor=white" alt="black">
</a>
<a href="https://www.codacy.com/gh/frgfm/torch-cam/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=frgfm/torch-cam&amp;utm_campaign=Badge_Grade"><img src="https://app.codacy.com/project/badge/Grade/87eaeec3e15442188f96c36bace5faf4"/></a>
<a href="https://codecov.io/gh/frgfm/torch-cam">
<img src="https://img.shields.io/codecov/c/github/frgfm/torch-cam.svg?logo=codecov&style=flat-square&label=Coverage" alt="Test coverage percentage">
</a>
</p>
<p align="center">
<a href="https://pypi.org/project/torchcam/">
<img src="https://img.shields.io/pypi/v/torchcam.svg?logo=python&logoColor=fff&style=flat-square" alt="PyPi Status">
<img src="https://img.shields.io/pypi/v/torchcam.svg?logo=PyPI&logoColor=fff&style=flat-square&label=PyPI" alt="PyPi Version">
</a>
<a href="https://anaconda.org/frgfm/torchcam">
<img src="https://img.shields.io/conda/v/frgfm/torchcam.svg?logo=anaconda&label=Conda&logoColor=fff&style=flat-square" alt="Conda Version">
</a>
<img src="https://img.shields.io/pypi/pyversions/torchcam.svg?logo=Python&label=Python&logoColor=fff&style=flat-square" alt="pyversions">
<a href="https://github.com/frgfm/torch-cam/blob/main/LICENSE">
<img src="https://img.shields.io/github/license/frgfm/torch-cam.svg?label=License&logoColor=fff&style=flat-square" alt="License">
</a>
<a href="https://anaconda.org/frgfm/torchcam"> <img src="https://anaconda.org/frgfm/torchcam/badges/version.svg" /> </a>
<img src="https://img.shields.io/pypi/pyversions/torchcam.svg?style=flat-square" alt="pyversions">
<img src="https://img.shields.io/pypi/l/torchcam.svg?style=flat-square" alt="license">
</p>
<p align="center">
<a href="https://huggingface.co/spaces/frgfm/torch-cam">
Expand All @@ -32,6 +37,11 @@
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab">
</a>
</p>
<p align="center">
<a href="https://frgfm.github.io/torch-cam">
<img src="https://img.shields.io/github/actions/workflow/status/frgfm/torch-cam/docs.yaml?branch=main&label=Documentation&logo=read-the-docs&logoColor=white&style=flat-square" alt="Documentation Status">
</a>
</p>

Simple way to leverage the class-specific activation of convolutional layers in PyTorch.

Expand Down
Loading