Skip to content

Commit 7fb6163

Browse files
committed
docs: add pre-commit setup instructions
1 parent 973c504 commit 7fb6163

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ repos:
3030
- id: ruff-format
3131
types: [python]
3232
pass_filenames: true
33+
34+
- repo: https://github.com/christophmeissner/pytest-pre-commit
35+
rev: 1.0.0
36+
hooks:
37+
- id: pytest
38+
language: system
39+
types: [python]
40+
pass_filenames: false
41+
always_run: false
3342

3443
- repo: local
3544
hooks:
36-
- id: pytest
37-
name: pytest test
38-
entry: pytest
39-
language: system
40-
types: [python]
41-
pass_filenames: false
42-
always_run: false
43-
args: ["-v", "--strict-markers"]
44-
4545
- id: mypy-check
4646
name: mypy type check
4747
entry: mypy

docs/docs/about/contributing.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@ We use [GitHub Issues](https://github.com/cocoindex-io/cocoindex/issues) to trac
1515

1616
We tag issues with the ["good first issue"](https://github.com/cocoindex-io/cocoindex/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) label for beginner contributors.
1717

18-
## How to Contribute
18+
## How to Contribute
1919
- If you decide to work on an issue, unless the PR can be sent immediately (e.g. just a few lines of code), we recommend you to leave a comment on the issue like **`I'm working on it`** or **`Can I work on this issue?`** to avoid duplicating work.
2020
- For larger features, we recommend you to discuss with us first in our [Discord server](https://discord.com/invite/zpA9S2DR7s) to coordinate the design and work.
2121
- Our [Discord server](https://discord.com/invite/zpA9S2DR7s) are constantly open. If you are unsure about anything, it is a good place to discuss! We'd love to collaborate and will always be friendly.
2222

23-
## Start hacking! Setting Up Development Environment
23+
## Start hacking! Setting Up Development Environment
2424
Following the steps below to get cocoindex build on latest codebase locally - if you are making changes to cocoindex funcionality and want to test it out.
2525

2626
- 🦀 [Install Rust](https://rust-lang.org/tools/install)
27-
27+
2828
If you don't have Rust installed, run
2929
```sh
3030
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
3131
```
32-
Already have Rust? Make sure it's up to date
33-
```sh
32+
Already have Rust? Make sure it's up to date
33+
```sh
3434
rustup update
3535
```
3636
@@ -46,14 +46,19 @@ Following the steps below to get cocoindex build on latest codebase locally - if
4646
4747
- Install required tools:
4848
```sh
49-
pip install maturin mypy ruff
49+
pip install maturin mypy pre-commit
5050
```
5151
5252
- Build the library. Run at the root of cocoindex directory:
5353
```sh
5454
maturin develop
5555
```
5656
57+
- Install and enable pre-commit hooks. This ensures all checks run automatically before each commit:
58+
```sh
59+
pre-commit install
60+
```
61+
5762
- Before running a specific example, set extra environment variables, for exposing extra traces, allowing dev UI, etc.
5863
```sh
5964
. ./.env.lib_debug
@@ -67,10 +72,14 @@ To submit your code:
6772
1. Fork the [CocoIndex repository](https://github.com/cocoindex-io/cocoindex)
6873
2. [Create a new branch](https://docs.github.com/en/desktop/making-changes-in-a-branch/managing-branches-in-github-desktop) on your fork
6974
3. Make your changes
70-
4. Make sure all tests and linting pass by running
71-
```sh
72-
./check.sh
73-
```
75+
4. Run the pre-commit checks (automatically triggered on `git commit`)
76+
77+
:::tip
78+
To run them manually (same as CI):
79+
```sh
80+
pre-commit run --all-files
81+
```
82+
:::
7483
7584
5. [Open a Pull Request (PR)](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) when your work is ready for review
7685

0 commit comments

Comments
 (0)