The previous commit was meant to remove .github/workflows and removed every tracked path instead — 892 files, the whole repo. This puts back the 874 that were never in scope; the eighteen workflow files stay gone, for the reasons that commit gives. Content is byte-identical to 9d2aec9 outside .github/workflows.
6.7 KiB
Contribution Guidelines
{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. 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 for package management. However, the steps are similar for other package managers.
:::{dropdown} Development Environment Setup Instructions :icon: gear
-
Create and activate a new Conda environment:
conda create -n anomalib_dev python=3.10 conda activate anomalib_devInstall the development requirements:
# Option I: Via anomalib install anomalib install --option dev #Option II: Via pip install pip install -e .[dev]Optionally, for a full installation with all dependencies:
# Option I: via anomalib install anomalib install --option full # Option II: via pip install pip install -e .[full] -
Install and configure pre-commit hooks:
pre-commit installPre-commit hooks help ensure code quality and consistency. After each commit,
pre-commitwill automatically run the configured checks for the changed file. If you would like to manually run the checks for all files, use:pre-commit run --all-filesTo bypass pre-commit hooks temporarily (e.g., for a work-in-progress commit), use:
git commit -m 'WIP commit' --no-verifyHowever, make sure to address any pre-commit issues before finalizing your pull request.
:::
{octicon}diff Making Changes
-
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.tomlfile. -
Add Tests: If your code includes new functionality, add corresponding tests using pytest to maintain coverage and reliability.
-
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.
-
Pass Tests and Quality Checks: Ensure the test suite passes and that your code meets quality standards by running:
pre-commit run --all-files pytest tests/ -
Update the Changelog: For significant changes, add a summary to the CHANGELOG.
-
Check Licensing: Ensure you own the code or have rights to use it, adhering to appropriate licensing.
-
Follow Conventional Commits: We use Commitizen to enforce conventional commit messages and branch names. This helps maintain a clean and consistent git history.
:::{dropdown} Commit Message Format :icon: git-commit
Each commit message consists of a header, a body, and a footer:
<type>(<scope>): <description> [optional body] [optional footer]Types:
feat: A new featurefix: A bug fixdocs: Documentation changesstyle: Code style changesrefactor: Code refactoringperf: Performance improvementstest: Adding or modifying testsbuild: Build system changesci: CI configuration changeschore: General maintenance
Scopes:
data: Data loading, processing, or augmentationmodel: Model architecture or implementationmetric: Evaluation metricsutils: Utility functionscli: Command-line interfacedocs: Documentationci: CI/CD configurationengine: Training/inference enginevisualization: Visualization toolsbenchmarking: Benchmarking toolslogger: Logging functionalityopenvino: OpenVINO integrationnotebooks: Jupyter notebooks
Rules:
- The type and scope are case-sensitive
- The type must be lowercase
- The description should be in present tense
- The description should not end with a period
- The description should not be in sentence-case, start-case, pascal-case, or upper-case
Examples:
feat(model): add transformer architecture for anomaly detection - Implement self-attention mechanism - Add positional encoding - Add transformer encoder blocks Closes #123fix(data): handle corrupted image files - Add error handling for corrupted images - Skip corrupted files during training - Log skipped files for debugging:::
:::{dropdown} Branch Naming :icon: git-branch
Branch names must follow the format:
<type>/<scope>/<description>Examples:
feat/model/add-transformerfix/data/load-image-bugdocs/readme/update-installationrefactor/utils/optimize-performance
The type and scope should match the ones used in commit messages. :::
:::{dropdown} Using Commitizen :icon: terminal
- Stage your changes:
git add <files> # or git add . # to add all changes- Create a commit using Commitizen:
# Regular commit cz commit # or cz c # Signed commit (recommended) cz commit -- -s # or cz c -- -sCommitizen will guide you through an interactive process to create a conventional commit message.
To check if your commits follow the conventional format:
cz checkTo bump the version based on commit history:
cz bump:::
{octicon}git-pull-request Submitting Pull Requests
Once you've followed the above steps and are satisfied with your changes:
- Push your changes to your forked repository.
- Go to the original Anomalib repository you forked and click "New pull request".
- Choose your fork and the branch with your changes to open a pull request.
- Fill in the pull request template with the necessary details about your changes.
We look forward to your contributions!