Skip to content

Commit fad89de

Browse files
committed
move pre-commit into scripts
Signed-off-by: leohoare <[email protected]>
1 parent a17a10c commit fad89de

File tree

4 files changed

+19
-27
lines changed

4 files changed

+19
-27
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
run: uv sync --extra dev
6767

6868
- name: Run pre-commit
69-
run: uv run pre-commit run --all-files
69+
run: uv run precommit
7070

7171
sast:
7272
runs-on: ubuntu-latest

CONTRIBUTING.md

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ We use [uv](https://github.com/astral-sh/uv) for fast Python package management
1616

1717
To install uv, follow the [installation guide](https://docs.astral.sh/uv/getting-started/installation/).
1818

19-
You will also need to set up the `pre-commit` hooks.
20-
Run `pre-commit install` in the root directory of the repository.
21-
If you don't have `pre-commit` installed, you can install it with `uv run pip install pre-commit`.
22-
2319
### Setup Development Environment
2420

2521
1. **Clone the repository:**
@@ -35,40 +31,30 @@ If you don't have `pre-commit` installed, you can install it with `uv run pip in
3531

3632
### Testing
3733

38-
Run tests with `uv run pytest tests`.
39-
40-
We use `pytest` for our unit testing, making use of `parametrized` to inject cases at scale.
34+
Run tests:
35+
```bash
36+
uv run test
37+
```
4138

4239
### Coverage
4340

44-
Run coverage tests with:
41+
Run tests with a coverage report:
4542
```bash
46-
uv run coverage run -m pytest tests/
47-
# Generate coverage report
43+
uv run cov
4844
```
4945

5046
### End-to-End Tests
5147

5248
Run e2e tests with behave:
5349
```bash
54-
# Update git submodules and run behave tests
55-
git submodule update --init --recursive
56-
cp spec/specification/assets/gherkin/* tests/features/
57-
uv run behave tests/features/
58-
rm tests/features/*.feature
50+
uv run e2e
5951
```
6052

61-
### Code Quality
62-
63-
**Linting and Formatting:**
64-
```bash
65-
uv run ruff check . # Lint code
66-
uv run ruff format . # Format code
67-
```
53+
### Pre-commit
6854

69-
**Type Checking:**
55+
Run pre-commit hooks
7056
```bash
71-
uv run mypy openfeature/
57+
uv run precommit
7258
```
7359

7460

@@ -105,7 +91,7 @@ git remote add fork https://github.com/YOUR_GITHUB_USERNAME/python-sdk.git
10591
Ensure your development environment is all set up by building and testing
10692

10793
```bash
108-
uv run pytest tests/
94+
uv run test
10995
```
11096

11197
To start working on a new feature or bugfix, create a new branch and start working on it.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,5 @@ test = "scripts.scripts:test"
124124
test-cov = "scripts.scripts:test_cov"
125125
cov-report = "scripts.scripts:cov_report"
126126
cov = "scripts.scripts:cov"
127-
e2e = "scripts.scripts:e2e"
127+
e2e = "scripts.scripts:e2e"
128+
precommit = "scripts.scripts:precommit"

scripts/scripts.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,8 @@ def e2e():
3131
)
3232
subprocess.run("behave tests/features/", shell=True, check=True)
3333
subprocess.run("rm tests/features/*.feature", shell=True, check=True)
34+
35+
36+
def precommit():
37+
"""Run pre-commit hooks."""
38+
subprocess.run("uv run pre-commit run --all-files", shell=True, check=True)

0 commit comments

Comments
 (0)