Skip to content

Commit 74f9c0c

Browse files
authored
Merge pull request #3485 from effigies/uv
chore: Migrate pipenv->uv, Python 3.13, git-annex @ PyPI
2 parents eebc15c + a98578d commit 74f9c0c

File tree

8 files changed

+1126
-1910
lines changed

8 files changed

+1126
-1910
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ updates:
88
actions-infrastructure:
99
patterns:
1010
- "actions/*"
11-
- package-ecosystem: "pip"
11+
- package-ecosystem: "uv"
1212
directory: "/services/datalad"
1313
schedule:
1414
interval: "monthly"
1515
groups:
16-
pipenv:
16+
datalad:
1717
patterns:
1818
- "*"

.github/workflows/python.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,30 @@ jobs:
1414
steps:
1515
- name: Checkout
1616
uses: actions/checkout@v4
17-
- name: Set up Python 3.11
18-
uses: actions/setup-python@v5
17+
- name: Set up Python 3.13 (uv)
18+
uses: astral-sh/setup-uv@v6
1919
with:
20-
python-version: "3.11"
20+
version: "latest"
21+
python-version: "3.13"
2122
- name: Use Node.js 20.x
2223
uses: actions/setup-node@v4
2324
with:
2425
node-version: 20.x
2526
- name: Setup Deno stable
2627
uses: denoland/setup-deno@v2
2728
with:
28-
deno-version: v1.x
29+
deno-version: v2.x
2930
- name: Install git-annex
30-
run: curl -L http://archive.org/download/git-annex-builds/SHA256E-s53592796--6e0a3c16d50379f89d2064081376a3f7f6efa1a89eb1afc2a2335597e7cf9fac.tar.gz | tar -C /usr/local/bin --strip-components 1 -xvz
31-
- name: Install pipenv
32-
run: pip install 'pipenv==2023.7.23'
31+
run: uv tool install git-annex
3332
- name: Install dependencies
34-
run: pipenv install --dev
33+
run: uv sync --locked --dev
3534
- name: Configure git defaults
3635
run: |
3736
git config --global user.name "Git Worker"
3837
git config --global user.email "[email protected]"
3938
git config --global receive.denyCurrentBranch updateInstead
4039
- name: Run tests and collect coverage
41-
run: pipenv run pytest -n 4 --cov=./datalad_service --cov-report=xml:coverage.xml ./tests
40+
run: uv run pytest -n 4 --cov=./datalad_service --cov-report=xml:coverage.xml ./tests
4241
- name: Upload coverage to Codecov
4342
uses: codecov/codecov-action@v5
4443
with:

services/datalad/Dockerfile

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
11
ARG LERNA_JSON
22
FROM docker.io/denoland/deno:bin-2.2.0 AS deno
3-
FROM docker.io/library/python:3.11-slim as production
3+
FROM ghcr.io/astral-sh/uv:0.7.11-python3.13-bookworm-slim as production
44

55
WORKDIR /srv
66

7-
COPY hooks /hooks
8-
COPY Pipfile /srv/Pipfile
9-
COPY Pipfile.lock /srv/Pipfile.lock
10-
COPY datalad_service /srv/datalad_service
11-
COPY get_docker_scale.py /get_docker_scale.py
12-
COPY ./ssh_config /root/.ssh/config
13-
COPY tests /srv/tests
14-
# Install Deno the Dockery-but-hacky-way
15-
COPY --from=deno /deno /usr/local/bin/deno
16-
177
RUN apt-get update \
18-
&& apt-get install -y curl openssh-client \
8+
&& apt-get install -y git curl openssh-client \
9+
&& apt-get clean
10+
11+
RUN mkdir -p /root/.ssh \
1912
&& ssh-keyscan github.com >> /root/.ssh/known_hosts \
20-
&& curl -L https://storage.googleapis.com/openneuro-git-annex/10.20250320/SHA256E-s62052170--58aadf91f6b05a8ed9fb6a351d5e786da9fe1890e202b9b935d18e876caf25a1.tar.gz | tar -C /usr/local/bin --strip-components 1 -xvz \
21-
&& pip3 install 'pipenv==2020.6.2' \
22-
&& pipenv install --deploy --system \
23-
&& chmod 600 /root/.ssh/config \
24-
&& rm -rf /var/lib/apt/lists/* \
2513
&& git config --global user.name "Git Worker" \
2614
&& git config --global user.email "[email protected]" \
27-
&& git config --global receive.denyCurrentBranch updateInstead \
15+
&& git config --global receive.denyCurrentBranch updateInstead
16+
17+
# Install Deno the Dockery-but-hacky-way
18+
COPY --from=deno /deno /usr/local/bin/deno
19+
20+
RUN uv tool install git-annex==10.20250520b7
21+
22+
COPY . /srv
23+
24+
RUN ln -s /srv/hooks /hooks \
25+
&& mv /srv/ssh_config /root/.ssh/config \
26+
&& chmod 600 /root/.ssh/config \
27+
&& ln -s /srv/get_docker_scale.py /get_docker_scale.py \
2828
&& echo "$LERNA_JSON" > /srv/lerna.json
2929

30+
RUN uv sync --locked
31+
32+
ENV PATH="/srv/.venv/bin:${PATH}"
33+
3034
HEALTHCHECK --interval=5s --timeout=30s --start-period=10s --retries=10 CMD [ "curl", "-f", "http://localhost/heartbeat" ]
3135

3236
ENV LOCPATH=""

services/datalad/Pipfile

Lines changed: 0 additions & 27 deletions
This file was deleted.

services/datalad/Pipfile.lock

Lines changed: 0 additions & 1851 deletions
This file was deleted.

services/datalad/README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@ A backend component of OpenNeuro, this service provides HTTP interfaces for crea
88

99
# Setup
1010

11+
## uv (recommended)
12+
13+
```bash
14+
uv sync --locked
15+
```
16+
17+
## virtualenv
18+
1119
```bash
1220
virtualenv --python python3 .venv
1321
source .venv/bin/activate
14-
pip install -r requirements.txt
22+
pip install .
1523
```
1624

1725
You will also need [npm](https://www.npmjs.com) or [Yarn](https://yarnpkg.com) to install the [bids-validator](https://github.com/INCF/bids-validator).
@@ -29,11 +37,14 @@ npm install
2937
# Running
3038

3139
```bash
32-
gunicorn --reload "datalad_service.app:create_app('/path-to-repos')"
40+
source .venv/bin/activate
41+
export DATALAD_DATASET_PATH=/path/to/repos
42+
uvicorn --factory "datalad_service.app:create_app"
3343
```
3444

3545
# Tests
3646

3747
```bash
38-
pytest
48+
uv sync --dev
49+
uv run pytest -n auto
3950
```

services/datalad/pyproject.toml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[project]
2+
name = "datalad-service"
3+
description = "HTTP interfaces for manipulating DataLad datasets"
4+
readme = "README.md"
5+
requires-python = ">=3.13"
6+
dependencies = [
7+
"aiofiles>=24.1.0",
8+
"aioshutil>=1.5",
9+
"bidsschematools>=1.0.10",
10+
"boto3>=1.38.30",
11+
"charset-normalizer>=3.4.2",
12+
"falcon>=4.0.2",
13+
"pygit2>=1.18.0",
14+
"pygithub>=2.6.1",
15+
"pyjwt>=2.10.1",
16+
"requests>=2.32.3",
17+
"sentry-sdk[falcon]>=2.29.1",
18+
"uvicorn[standard]>=0.34.3",
19+
]
20+
dynamic = ["version"]
21+
22+
[build-system]
23+
requires = ["hatchling", "hatch-vcs"]
24+
build-backend = "hatchling.build"
25+
26+
[dependency-groups]
27+
dev = [
28+
"coverage>=7.8.2",
29+
"datalad>=1.2.0",
30+
"exceptiongroup>=1.3.0",
31+
"pytest>=8.4.0",
32+
"pytest-asyncio>=1.0.0",
33+
"pytest-cov>=6.1.1",
34+
"pytest-xdist>=3.7.0",
35+
]
36+
37+
[tool.hatch.version]
38+
source = "vcs"
39+
fallback-version = "0+unknown"
40+
41+
[tool.hatch.version.raw-options]
42+
root = "../.."

0 commit comments

Comments
 (0)