Use pre-commit for Prettier in CI and document local hook setup.
Code Quality Pipeline / code-quality (pull_request) Successful in 31s
Test Python Package / test (pull_request) Successful in 50s

Run prettier via pre-commit in code-quality workflow and add README instructions for installing and running hooks during development.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Brian Bjarke Jensen
2026-06-28 19:56:25 +02:00
co-authored by Cursor
parent 497533f0e3
commit c5169df10d
2 changed files with 24 additions and 17 deletions
+1 -3
View File
@@ -39,6 +39,4 @@ jobs:
run: uv run pyupgrade --py313-plus $(git ls-files '*.py') && git diff --exit-code run: uv run pyupgrade --py313-plus $(git ls-files '*.py') && git diff --exit-code
- name: Prettier format - name: Prettier format
run: | run: uv run pre-commit run prettier --all-files
npm install --save-dev --save-exact prettier
npx prettier --check .
+23 -14
View File
@@ -6,11 +6,11 @@ Subclass an adapter in your own repository to add domain-specific methods while
## Architecture ## Architecture
| Layer | Responsibility | | Layer | Responsibility |
|-------|----------------| | ---------------- | ----------------------------------------------------------------- |
| **Interfaces** | Abstract contracts for connection, context, and CRUD | | **Interfaces** | Abstract contracts for connection, context, and CRUD |
| **Adapters** | Technology-specific base classes (`RedisAdapter`, `MinioAdapter`) | | **Adapters** | Technology-specific base classes (`RedisAdapter`, `MinioAdapter`) |
| **Your project** | Subclass an adapter and add domain methods | | **Your project** | Subclass an adapter and add domain methods |
## Optional dependencies ## Optional dependencies
@@ -26,18 +26,18 @@ uv add python-repositories[redis,minio]
Requires Redis with the RedisJSON module (e.g. redis-stack). Requires Redis with the RedisJSON module (e.g. redis-stack).
| Environment variable | Description | | Environment variable | Description |
|---------------------|-------------| | -------------------- | ---------------------------------------------------- |
| `REDIS_URI` | Redis connection URL (e.g. `redis://localhost:6379`) | | `REDIS_URI` | Redis connection URL (e.g. `redis://localhost:6379`) |
### MinIO (`ObjectRepositoryInterface`) ### MinIO (`ObjectRepositoryInterface`)
| Environment variable | Description | | Environment variable | Description |
|---------------------|-------------| | -------------------- | ------------------------------------------- |
| `MINIO_ENDPOINT` | MinIO server endpoint | | `MINIO_ENDPOINT` | MinIO server endpoint |
| `MINIO_ACCESS_KEY` | Access key | | `MINIO_ACCESS_KEY` | Access key |
| `MINIO_SECRET_KEY` | Secret key | | `MINIO_SECRET_KEY` | Secret key |
| `MINIO_BUCKET` | Bucket name (created on connect if missing) | | `MINIO_BUCKET` | Bucket name (created on connect if missing) |
## Quick start ## Quick start
@@ -99,7 +99,16 @@ from python_repositories import (
```bash ```bash
uv sync --all-extras uv sync --all-extras
uv run pre-commit install # once per clone — runs hooks on git commit
uv run pytest tests/integration/ -v uv run pytest tests/integration/ -v
``` ```
`pre-commit` is included in the dev dependency group. `uv sync` installs the CLI, but git does not run hooks until you install them with `pre-commit install` (one time per clone). After that, commits run the checks defined in [`.pre-commit-config.yaml`](.pre-commit-config.yaml) (ruff, mypy, pyupgrade, prettier, and general file hygiene).
To run all hooks manually without committing:
```bash
uv run pre-commit run --all-files
```
Integration tests require Docker (testcontainers). Integration tests require Docker (testcontainers).