Skip to content

Commit d26304e

Browse files
committed
tests should work with and without LEGACY_DEPS. legacydeps-flavour image generation documented and configured in CI
1 parent 72cc393 commit d26304e

File tree

11 files changed

+37
-67
lines changed

11 files changed

+37
-67
lines changed

.dockerignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@
66
# Now un-exclude:
77
#
88
!src
9-
!compile-protos.sh
9+
!compile_protos.py
10+
!dynamic_dependencies.py
1011
!dataclay-common
12+
!requirements.txt
1113
!requirements-legacydeps.txt
12-
!requirements-dev.txt
1314
!pyproject.toml
1415
!README.md
1516
!MANIFEST.in
1617
!tests
1718
!tox.ini
1819
.dockerignore
20+
21+
# Reexclude protos
22+
src/dataclay/proto

.github/workflows/docker-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ jobs:
8484
uses: docker/build-push-action@v6
8585
with:
8686
context: .
87-
file: Dockerfile.legacy-deps
8887
platforms: linux/amd64,linux/arm64
8988
build-args:
9089
PYTHON_VERSION=${{ matrix.python-version }}-bullseye
90+
LEGACY_DEPS=True
9191
push: ${{ github.event_name != 'pull_request' }}
9292
tags: ${{ steps.meta.outputs.tags }}-legacydeps
9393
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ ARG PYTHON_VERSION=3.10-bookworm
55
# install dataclay
66
FROM python:$PYTHON_VERSION
77
COPY . /app
8+
9+
ARG LEGACY_DEPS=False
810
RUN python -m pip install --upgrade pip \
9-
&& python -m pip install /app[telemetry]
11+
&& python -m pip install --config-settings=LEGACY_DEPS=$LEGACY_DEPS /app[telemetry]
1012

1113
# prepare dataclay storage dir
1214
RUN mkdir -p /data/storage;

Dockerfile.dev

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ ARG PYTHON_VERSION=3.10-bookworm
55
# install dataclay
66
FROM python:$PYTHON_VERSION
77
COPY . /app
8+
9+
ARG LEGACY_DEPS=False
810
RUN python -m pip install --upgrade pip \
9-
&& python -m pip install -e /app[telemetry,dev]
11+
&& python -m pip install --config-settings=LEGACY_DEPS=$LEGACY_DEPS -e /app[telemetry,dev]
1012

1113
# prepare dataclay storage dir
1214
RUN mkdir -p /data/storage;

Dockerfile.legacy-deps

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

Dockerfile.legacy-deps.dev

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

PUBLISH.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,22 @@
6868
docker buildx build --platform linux/amd64,linux/arm64 \
6969
-t ghcr.io/bsc-dom/dataclay:$VERSION-py3.13-bookworm \
7070
--build-arg PYTHON_VERSION=3.13-bookworm --push .
71+
72+
# Repeat for Python 3.9 and 3.10 with the _legacy dependency flavour_
73+
# Build and push Python 3.9 bookworm
74+
docker buildx build --platform linux/amd64,linux/arm64 \
75+
-t ghcr.io/bsc-dom/dataclay:$VERSION-legacydeps-py3.9-bookworm \
76+
--build-arg PYTHON_VERSION=3.9-bookworm \
77+
--build-arg LEGACY_DEPS=True \
78+
--push .
79+
80+
# Build and push Python 3.10 bookworm
81+
docker buildx build --platform linux/amd64,linux/arm64 \
82+
-t ghcr.io/bsc-dom/dataclay:$VERSION-legacydeps-py3.10-bookworm \
83+
-t ghcr.io/bsc-dom/dataclay:$VERSION-legacydeps \
84+
--build-arg PYTHON_VERSION=3.10-bookworm \
85+
--build-arg LEGACY_DEPS=True \
86+
--push .
7187
```
7288

7389
6. Publish the release distribution to PyPI:

compile_protos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def find_config_settings_in_hatchling() -> dict[str, Any]:
4646
and module.__name__.startswith("hatchling.build")
4747
and "config_settings" in frame.f_locals
4848
):
49-
return frame.f_locals["config_settings"]
49+
return frame.f_locals["config_settings"] or {}
5050

5151
return {}
5252

dynamic_dependencies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def find_config_settings_in_hatchling() -> dict[str, Any]:
2727
and module.__name__.startswith("hatchling.build")
2828
and "config_settings" in frame.f_locals
2929
):
30-
return frame.f_locals["config_settings"]
30+
return frame.f_locals["config_settings"] or {}
3131

3232
return {}
3333

noxfile.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,9 @@ def tests(session):
2222
@nox.session(python=["3.9", "3.10"], tags=["citests"])
2323
def legacy_deps_tests(session):
2424
"""Run the test suite with legacy dependencies."""
25-
session.install("grpcio-tools==1.48.2", "pytest", "pytest-asyncio", "pytest-docker", "pytest-cov", "-r", "requirements-legacydeps.txt")
26-
session.run(
27-
# See compile-protos.sh, it should be the same command
28-
"python3",
29-
"-m",
30-
"grpc_tools.protoc",
31-
"--proto_path=dataclay-common",
32-
"--python_out=src",
33-
"--grpc_python_out=src",
34-
"dataclay-common/dataclay/proto/common/common.proto",
35-
"dataclay-common/dataclay/proto/backend/backend.proto",
36-
"dataclay-common/dataclay/proto/metadata/metadata.proto",
37-
)
38-
39-
session.install(".", "--no-deps")
25+
session.install("pytest", "pytest-asyncio", "pytest-docker", "pytest-cov")
26+
27+
session.install("--config-settings=LEGACY_DEPS=True", ".")
4028
session.run("pytest", "--disable-warnings", "--cov", "--cov-report=term-missing", "--build-legacy-deps", "tests/functional")
4129

4230

0 commit comments

Comments
 (0)