Skip to content

Commit

Permalink
[deps] Add aai-jobq to backend dependencies as a source (#122)
Browse files Browse the repository at this point in the history
* Add uv lock hook to pre-commit, remove references to lock script

* Add jobq from main as a source

* Bump uv again, add -P to package upgrade options
  • Loading branch information
nicholasjng authored Oct 8, 2024
1 parent 28c0261 commit 037d13c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
9 changes: 7 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-json
Expand All @@ -11,7 +11,7 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.3
rev: v0.6.9
hooks:
- id: ruff
args: [--fix]
Expand All @@ -30,3 +30,8 @@ repos:
--non-interactive,
--install-types,
]
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.4.19
hooks:
- id: uv-lock
name: Lock project dependencies
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,19 +148,19 @@ If you have to update a dependency during development, you should do the followi
2. In case of a development dependency, add it to the `dev` section of the `project.optional-dependencies` table instead.
3. Dependencies needed for documentation generation are found in the `docs` sections of `project.optional-dependencies`.

After adding the dependency in either of these sections, run the helper script `hack/lock-deps.sh` (which in turn uses `uv pip compile`) to pin all dependencies again:
After adding the dependency in either of these sections, lock all dependencies again:

```console
hack/lock-deps.sh
uv lock
```

In addition to these manual steps, we also provide `pre-commit` hooks that automatically lock the dependencies whenever `pyproject.toml` is changed.
In addition to these manual steps, we also provide a `pre-commit` hook that automatically locks the dependencies whenever `pyproject.toml` is changed.

Selective package upgrade for existing dependencies are also handled by the helper script above.
If you want to update the Pydantic dependency, for example, simply run:

```console
hack/lock-deps.sh pydantic
uv add -P pydantic
```

> [!IMPORTANT]
Expand Down
6 changes: 4 additions & 2 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ dependencies = [
"uvicorn",
"docker",
"kubernetes",
# FIXME: Revert to main branch once PR is merged
"aai-jobq @ git+https://github.com/aai-institute/jobq.git@28b535e905e9b7dd4195c928ed02bbf186235f91#subdirectory=client",
"aai-jobq",
]
dynamic = ["version"]

Expand Down Expand Up @@ -63,3 +62,6 @@ exclude_also = ["@overload", "raise NotImplementedError", "if TYPE_CHECKING:"]
markers = [
"e2e: mark a test as an end-to-end test (requires Kubernetes tooling)",
]

[tool.uv.sources]
aai-jobq = { git = "https://github.com/aai-institute/jobq", branch = "main", subdirectory = "client" }
8 changes: 4 additions & 4 deletions backend/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 037d13c

Please sign in to comment.