diff --git a/.gitea/workflows/code-quality.yml b/.gitea/workflows/code-quality.yml index 8891941..1da84fc 100644 --- a/.gitea/workflows/code-quality.yml +++ b/.gitea/workflows/code-quality.yml @@ -39,6 +39,4 @@ jobs: run: uv run pyupgrade --py313-plus $(git ls-files '*.py') && git diff --exit-code - name: Prettier format - run: | - npm install --save-dev --save-exact prettier - npx prettier --check . + run: uv run pre-commit run prettier --all-files diff --git a/README.md b/README.md index 7440821..3baa6c8 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ Subclass an adapter in your own repository to add domain-specific methods while ## Architecture -| Layer | Responsibility | -|-------|----------------| -| **Interfaces** | Abstract contracts for connection, context, and CRUD | -| **Adapters** | Technology-specific base classes (`RedisAdapter`, `MinioAdapter`) | -| **Your project** | Subclass an adapter and add domain methods | +| Layer | Responsibility | +| ---------------- | ----------------------------------------------------------------- | +| **Interfaces** | Abstract contracts for connection, context, and CRUD | +| **Adapters** | Technology-specific base classes (`RedisAdapter`, `MinioAdapter`) | +| **Your project** | Subclass an adapter and add domain methods | ## Optional dependencies @@ -26,18 +26,18 @@ uv add python-repositories[redis,minio] Requires Redis with the RedisJSON module (e.g. redis-stack). -| Environment variable | Description | -|---------------------|-------------| -| `REDIS_URI` | Redis connection URL (e.g. `redis://localhost:6379`) | +| Environment variable | Description | +| -------------------- | ---------------------------------------------------- | +| `REDIS_URI` | Redis connection URL (e.g. `redis://localhost:6379`) | ### MinIO (`ObjectRepositoryInterface`) -| Environment variable | Description | -|---------------------|-------------| -| `MINIO_ENDPOINT` | MinIO server endpoint | -| `MINIO_ACCESS_KEY` | Access key | -| `MINIO_SECRET_KEY` | Secret key | -| `MINIO_BUCKET` | Bucket name (created on connect if missing) | +| Environment variable | Description | +| -------------------- | ------------------------------------------- | +| `MINIO_ENDPOINT` | MinIO server endpoint | +| `MINIO_ACCESS_KEY` | Access key | +| `MINIO_SECRET_KEY` | Secret key | +| `MINIO_BUCKET` | Bucket name (created on connect if missing) | ## Quick start @@ -99,7 +99,16 @@ from python_repositories import ( ```bash uv sync --all-extras +uv run pre-commit install # once per clone — runs hooks on git commit 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).