diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index beea6c63af..427d35743c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,3 +12,24 @@ Thank you for your interest in contributing to CUDA Python! Based on the type of - Please refer to each component's guideline: - [`cuda.core`](https://nvidia.github.io/cuda-python/cuda-core/latest/contribute.html) - [`cuda.bindings`](https://nvidia.github.io/cuda-python/cuda-bindings/latest/contribute.html) + +This project uses [pre-commit.ci](https://pre-commit.ci/) with GitHub Actions. All pull requests are automatically checked for pre-commit compliance, and any pre-commit failures will block merging until resolved. + +To set yourself up for running pre-commit checks locally and to catch issues before pushing your changes, follow these steps: + +* Install pre-commit with: `pip install pre-commit` +* You can manually check all files at any time by running: `pre-commit run --all-files` + +This command runs all configured hooks (such as linters and formatters) across your repository, letting you review and address issues before committing. + +**Optional: Enable automatic checks on every commit** +If you want pre-commit hooks to run automatically each time you make a commit, install the git hook with: + +`pre-commit install` + +This sets up a git pre-commit hook so that all configured checks will run before each commit is accepted. If any hook fails, the commit will be blocked until the issues are resolved. + +**Note on workflow flexibility** +Some contributors prefer to commit intermediate or work-in-progress changes that may not pass all pre-commit checks, and only clean up their commits before pushing (for example, by squashing and running `pre-commit run --all-files` manually at the end). If this fits your workflow, you may choose not to run `pre-commit install` and instead rely on manual checks. This approach avoids disruption during iterative development, while still ensuring code quality before code is shared or merged. + +Choose the setup that best fits your workflow and development style. \ No newline at end of file