Skip to content

Commit 8aa249b

Browse files
build: Add UV and Pip caching (#8)
* build: Add UV and Pip caching * build: Add UV Lock file. Add UV to devcontainer * Use UV to setup python versions * build: only cache on lock file * build: only cache on lock file * build: Cleanup
1 parent e0df2d2 commit 8aa249b

File tree

5 files changed

+2952
-9
lines changed

5 files changed

+2952
-9
lines changed

.devcontainer/devcontainer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
66
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",
77
"features": {
8-
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
8+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
9+
"ghcr.io/va-h/devcontainers-features/uv:1": {
10+
"shellautocompletion": true
11+
}
912
},
1013

1114
// Features to add to the dev container. More info: https://containers.dev/features.
@@ -25,7 +28,8 @@
2528
"workspaceFolder": "${localWorkspaceFolder}",
2629
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind",
2730
"mounts": [
28-
"source=${localEnv:HOME}/.cache/pip,target=/home/vscode/.cache/pip,type=bind"
31+
"source=${localEnv:HOME}/.cache/pip,target=/home/vscode/.cache/pip,type=bind",
32+
"source=${localEnv:HOME}/.cache/uv,target=/home/vscode/.cache/uv,type=bind"
2933
],
3034
"customizations": {
3135
"vscode": {

.github/workflows/medcat-v2-tutorials_main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
uses: actions/setup-python@v5
2020
with:
2121
python-version: "3.11"
22+
cache: 'pip'
2223
- name: Install dependencies
2324
run: |
2425
pip install -U pip

.github/workflows/medcat-v2_main.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ defaults:
1010
working-directory: ./medcat-v2
1111
jobs:
1212
build:
13-
1413
runs-on: ubuntu-latest
1514
strategy:
1615
matrix:
1716
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
1817
max-parallel: 4
19-
2018
steps:
2119
- uses: actions/checkout@v4
22-
- name: Install uv
23-
uses: astral-sh/setup-uv@v4
24-
- name: Set up Python ${{ matrix.python-version }}
25-
run: uv python install ${{ matrix.python-version }}
20+
- name: Install uv for Python ${{ matrix.python-version }}
21+
uses: astral-sh/setup-uv@v6
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
enable-cache: true
25+
cache-dependency-glob: "medcat-v2/uv.lock"
2626
- name: Install the project
2727
run: |
2828
uv sync --all-extras --dev
@@ -43,3 +43,5 @@ jobs:
4343
- name: Backwards compatibility
4444
run: |
4545
uv run bash tests/backwards_compatibility/check_backwards_compatibility.sh
46+
- name: Minimize uv cache
47+
run: uv cache prune --ci

medcat-v2/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ tmp_*
3737
nohup.out
3838
tmp.py
3939
.DS_Store
40-
*.lock
4140
*.egg*
4241

4342
# models files

0 commit comments

Comments
 (0)