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

πŸ“š Update contribution guidelines #1677

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
501484c
Fix metadata path
samet-akcay Mar 10, 2023
15ad7e9
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Mar 20, 2023
a6bc69f
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Mar 22, 2023
7b53b78
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Mar 24, 2023
af2022f
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Mar 28, 2023
e4aadca
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Mar 31, 2023
c61472e
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Apr 4, 2023
1e708ba
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Apr 14, 2023
8a3cce7
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Apr 17, 2023
dca5744
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay May 5, 2023
68b7401
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay May 9, 2023
046d72d
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay May 12, 2023
3c4def3
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay May 12, 2023
545f08b
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay May 25, 2023
904e5e7
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Jun 2, 2023
8aec0e2
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Jun 4, 2023
c065af2
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Jun 6, 2023
1efc3aa
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Jun 7, 2023
7ea6f15
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Jun 15, 2023
4931934
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Jun 15, 2023
9ff0f73
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Jun 26, 2023
fd5b138
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Jun 30, 2023
5e22f99
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Jul 5, 2023
a555eaf
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Jul 7, 2023
70889d1
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Jul 7, 2023
5ca8f5e
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Jul 21, 2023
ee42158
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Aug 4, 2023
8efd566
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Aug 7, 2023
6d86c68
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Aug 9, 2023
bca0325
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Aug 10, 2023
aba663d
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Aug 14, 2023
0b6a39d
Ignore hidden directories in folder dataset
samet-akcay Aug 14, 2023
0a699a7
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Aug 15, 2023
ecd8a47
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Aug 15, 2023
d9dd0a2
Add check for mask_dir for segmentation tasks in Folder dataset
samet-akcay Aug 15, 2023
6627a21
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Aug 16, 2023
456f90d
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Aug 17, 2023
6f78670
pull main
samet-akcay Aug 22, 2023
a8e7c13
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Aug 22, 2023
2c70119
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Sep 4, 2023
88eca53
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Sep 4, 2023
21f6df6
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Sep 13, 2023
093f8c1
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Sep 18, 2023
cb0e38c
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Sep 20, 2023
48f825e
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Sep 25, 2023
f86f4cc
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Sep 27, 2023
0737296
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Sep 28, 2023
118cb1c
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Oct 4, 2023
e55f41f
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Nov 3, 2023
216aa62
Limit the gradio version to <4
samet-akcay Nov 3, 2023
d86eb07
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Nov 28, 2023
df486a2
Merge branch 'main' of https://github.com/openvinotoolkit/anomalib
samet-akcay Nov 29, 2023
aff23fe
Merge branch 'main' of github.com:samet-akcay/anomalib
samet-akcay Nov 29, 2023
86b5277
Merge branch 'main' of https://github.com/openvinotoolkit/anomalib
samet-akcay Jan 2, 2024
1bfe7d5
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Jan 9, 2024
eb6379b
Merge branch 'main' of github.com:openvinotoolkit/anomalib
samet-akcay Jan 10, 2024
89d16c4
Merge branch 'openvinotoolkit:main' into main
samet-akcay Jan 24, 2024
529fbcb
Merge branch 'main' of github.com:samet-akcay/anomalib
samet-akcay Jan 24, 2024
0f6afe2
create the first version of the developer guide
samet-akcay Jan 25, 2024
cfa1c76
Update contributing.md file
samet-akcay Jan 26, 2024
a5e09e0
Added octicons to developer guide on docs
samet-akcay Jan 26, 2024
2d6d72d
Address PR comments
samet-akcay Jan 26, 2024
9637ca1
Address PR comments
samet-akcay Jan 26, 2024
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
105 changes: 78 additions & 27 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ We want to make it as simple and straightforward as possible to contribute to th

## Bug Report

We use GitHub issues to track the bugs. Report a bug by using our Bug Report Template in [Issues](https://github.com/openvinotoolkit/anomalib/issues/new?assignees=&labels=&template=bug_report.md).
We use GitHub issues to track the bugs. Report a bug by using our Bug Report Template in [Issues](https://github.com/openvinotoolkit/anomalib/issues/new?assignees=&labels=&projects=&template=bug_report.yaml&title=%5BBug%5D%3A+).

## Discussion

Expand All @@ -26,50 +26,101 @@ We utilize GitHub issues to track the feature requests as well. If you are certa

We actively welcome your pull requests:

1. Fork the repo and create your branch from [`main`](https://github.com/openvinotoolkit/anomalib/tree/main).
1. Set up the development environment by following the instructions below.
1. If you've added code that should be tested, add tests.
1. If you've changed APIs, update the documentation.
1. Ensure the test suite passes.
1. Make sure you own the code you're submitting or that you obtain it from a source with an appropriate license.
1. Add a summary of the changes to the [CHANGELOG](https://github.com/openvinotoolkit/anomalib/blob/main/CHANGELOG.md) (not for minor changes, docs and tests).
1. Issue that pull request!
### Β Getting Started

### Setting up the development environment and using pre-commit
#### 1. Fork and Clone the Repository

To setup the development environment, you will need to install development requirements, as well as the base requirements of the library.
First, fork the Anomalib repository by following the GitHub documentation on [forking a repo](https://docs.github.com/en/enterprise-cloud@latest/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo). Then, clone your forked repository to your local machine and create a new branch from `main`.

```bash
conda create -n anomalib_dev python=3.10
conda activate anomalib_dev
pip install -r requirements/base.txt -r requirements/dev.txt
pre-commit install
```
#### 2. Set Up Your Development Environment

Set up your development environment to start contributing. This involves installing the required dependencies and setting up pre-commit hooks for code quality checks. Note that this guide assumes you are using [Conda](https://docs.conda.io/en/latest/) for package management. However, the steps are similar for other package managers.

<details>
<summary>Development Environment Setup Instructions</summary>

1. Create and activate a new Conda environment:

```bash
conda create -n anomalib_dev python=3.10
conda activate anomalib_dev
```

2. Install the base and development requirements:

The commands above will install pre-commit. Pre-commit hooks will run each of the code quality tools listed above each time you commit some changes to a branch. Some tools like black and isort will automatically format your files to enforce consistent formatting within the repo. Other tools will provide a list of errors and warnings which you will be required to address before being able to make the commit.
```bash
pip install -r requirements/base.txt -r requirements/dev.txt
```

The pre-commit checks can also be triggered manually with the following command:
Optionally, for a full installation with all dependencies:

```bash
pip install -e .[all]
```

3. Install and configure pre-commit hooks:

```bash
pre-commit install
```

Pre-commit hooks help ensure code quality and consistency. After each commit,
`pre-commit` will automatically run the configured checks for the changed file.
If you would like to manually run the checks for all files, use:

```bash
pre-commit run --all-files
```

In some cases it might be desired to commit your changes even though some of the checks are failing. For example when you want to address the pre-commit issues at a later time, or when you want to commit a work-in-progress. In these cases, you can skip the pre-commit hooks by adding the `--no-verify` parameter to the commit command.
To bypass pre-commit hooks temporarily (e.g., for a work-in-progress commit),
use:

```bash
git commit -m 'WIP commit' --no-verify
```

When doing so, please make sure to revisit the pre-commit issues before you submit your PR. A good way to confirm if your code passes the checks is by running `pre-commit run --all-files`.
However, make sure to address any pre-commit issues before finalizing your pull request.

More information on pre-commit and how it is used in Anomalib can be found in our documentation:
</details>

- [Pre-commit hooks guide](https://openvinotoolkit.github.io/anomalib/developer_guide/pre_commit_hooks.html)
### Making Changes

## License
1. **Write Code:** Follow the project's coding standards and write your code with clear intent. Ensure your code is well-documented and includes examples where appropriate. For code quality we use ruff, whose configuration is in [`pyproject.toml`](https://github.com/openvinotoolkit/anomalib/blob/main/pyproject.toml) file.

You accept that your contributions will be licensed under the [Apache-2.0 License](https://choosealicense.com/licenses/apache-2.0/) if you contribute to this repository. If this is a concern, please notify the maintainers.
2. **Add Tests:** If your code includes new functionality, add corresponding tests using [pytest](https://docs.pytest.org/en/7.4.x/) to maintain coverage and reliability.

3. **Update Documentation:** If you've changed APIs or added new features, update the documentation accordingly. Ensure your docstrings are clear and follow [Google's docstring guide](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings).

## References
4. **Pass Tests and Quality Checks:** Ensure the test suite passes and that your code meets quality standards by running:

This document was adapted from [here](https://gist.github.com/briandk/3d2e8b3ec8daf5a27a62).
```bash
pre-commit run --all-files
pytest tests/
```

5. **Update the Changelog:** For significant changes, add a summary to the [CHANGELOG](https://github.com/openvinotoolkit/anomalib/blob/main/CHANGELOG.md).

6. **Check Licensing:** Ensure you own the code or have rights to use it, adhering to appropriate licensing.

7. **Sign Your Commits:** Use signed commits to certify that you have the right to submit the code under the project's license:

```bash
git commit -S -m "Your detailed commit message"
```

For more on signing commits, see [GitHub's guide on signing commits](https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification/signing-commits).

### Submitting Pull Requests

Once you've followed the above steps and are satisfied with your changes:

1. Push your changes to your forked repository.
2. Go to the original Anomalib repository you forked and click "New pull request".
3. Choose your fork and the branch with your changes to open a pull request.
4. Fill in the pull request template with the necessary details about your changes.
samet-akcay marked this conversation as resolved.
Show resolved Hide resolved

We look forward to your contributions!

## License

You accept that your contributions will be licensed under the [Apache-2.0 License](https://choosealicense.com/licenses/apache-2.0/) if you contribute to this repository. If this is a concern, please notify the maintainers.
13 changes: 10 additions & 3 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ Get started with anomalib in 15 minutes.
## {octicon}`book` Guides

::::{grid}
:margin: 1 1 0 0
:gutter: 1

:::{grid-item-card} {octicon}`codescan` Reference Guide
Expand All @@ -62,20 +61,27 @@ Get started with anomalib in 15 minutes.
Learn more about anomalib API and CLI.
:::

:::{grid-item-card} {octicon}`question` How-To Guides
:::{grid-item-card} {octicon}`question` How-To Guide
:link: markdown/guides/how_to/index
:link-type: doc

Learn how to use anomalib for your anomaly detection tasks.
:::

:::{grid-item-card} {octicon}`telescope` Topic Guides
:::{grid-item-card} {octicon}`telescope` Topic Guide
:link: markdown/guides/topic/index
:link-type: doc

Learn more about the internals of anomalib.
:::

:::{grid-item-card} {octicon}`code` Developer Guide
:link: markdown/guides/developer/index
:link-type: doc

Learn how to develop and contribute to anomalib.
:::

::::

```{toctree}
Expand All @@ -92,4 +98,5 @@ markdown/get_started/anomalib
markdown/guides/reference/index
markdown/guides/how_to/index
markdown/guides/topic/index
markdown/guides/developer/index
```
99 changes: 99 additions & 0 deletions docs/source/markdown/guides/developer/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Developer Guide

This section contains information for developers who want to contribute to Anomalib.

## Β {octicon}`light-bulb` Getting Started

To get started with Anomalib development, follow these steps:

### {octicon}`repo-forked` Fork and Clone the Repository

First, fork the Anomalib repository by following the GitHub documentation on [forking a repo](https://docs.github.com/en/enterprise-cloud@latest/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo). Then, clone your forked repository to your local machine and create a new branch from `main`.

### {octicon}`gear` Set Up Your Development Environment

Set up your development environment to start contributing. This involves installing the required dependencies and setting up pre-commit hooks for code quality checks. Note that this guide assumes you are using [Conda](https://docs.conda.io/en/latest/) for package management. However, the steps are similar for other package managers.

:::{dropdown} Development Environment Setup Instructions
:icon: gear

1. Create and activate a new Conda environment:

```bash
conda create -n anomalib_dev python=3.10
conda activate anomalib_dev
```

Install the base and development requirements:

```bash
pip install -r requirements/base.txt -r requirements/dev.txt
```

Optionally, for a full installation with all dependencies:

```bash
pip install -e .[all]
```

2. Install and configure pre-commit hooks:

```bash
pre-commit install
```

Pre-commit hooks help ensure code quality and consistency. After each commit,
`pre-commit` will automatically run the configured checks for the changed file.
If you would like to manually run the checks for all files, use:

```bash
pre-commit run --all-files
```

To bypass pre-commit hooks temporarily (e.g., for a work-in-progress commit), use:

```bash
git commit -m 'WIP commit' --no-verify
```

However, make sure to address any pre-commit issues before finalizing your pull request.

:::

## {octicon}`diff` Making Changes

1. **Write Code:** Follow the project's coding standards and write your code with clear intent. Ensure your code is well-documented and includes examples where appropriate. For code quality we use ruff, whose configuration is in [`pyproject.toml`](https://github.com/openvinotoolkit/anomalib/blob/main/pyproject.toml) file.

2. **Add Tests:** If your code includes new functionality, add corresponding tests using [pytest](https://docs.pytest.org/en/7.4.x/) to maintain coverage and reliability.

3. **Update Documentation:** If you've changed APIs or added new features, update the documentation accordingly. Ensure your docstrings are clear and follow [Google's docstring guide](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings).

4. **Pass Tests and Quality Checks:** Ensure the test suite passes and that your code meets quality standards by running:

```bash
pre-commit run --all-files
pytest tests/
```

5. **Update the Changelog:** For significant changes, add a summary to the [CHANGELOG](https://github.com/openvinotoolkit/anomalib/blob/main/CHANGELOG.md).

6. **Check Licensing:** Ensure you own the code or have rights to use it, adhering to appropriate licensing.

7. **Sign Your Commits:** Use signed commits to certify that you have the right to submit the code under the project's license:

```bash
git commit -S -m "Your detailed commit message"
```

For more on signing commits, see [GitHub's guide on signing commits](https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification/signing-commits).

## {octicon}`git-pull-request` Submitting Pull Requests

Once you've followed the above steps and are satisfied with your changes:

1. Push your changes to your forked repository.
2. Go to the original Anomalib repository you forked and click "New pull request".
3. Choose your fork and the branch with your changes to open a pull request.
4. Fill in the pull request template with the necessary details about your changes.

We look forward to your contributions!
Loading