Skip to content

Commit c0653d0

Browse files
committed
refactor: experiment with simplifying build using unreliable markers which seems to work with ibm specifically
1 parent 59d1968 commit c0653d0

9 files changed

+9
-85
lines changed

Dockerfile

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
ARG PYTHON_VERSION=3.10
22
FROM python:${PYTHON_VERSION}-slim-bookworm
3-
ARG POETRY_EXTRAS
4-
5-
ENV PYTHONPATH=/workspace
63

74
ENV POETRY_NO_INTERACTION=1 \
85
POETRY_VIRTUALENVS_IN_PROJECT=1 \
@@ -23,18 +20,10 @@ RUN bash -c 'python -m venv /opt/poetry-venv && source $_/bin/activate && pip in
2320
# install dependencies with poetry
2421
COPY pyproject.toml .
2522
COPY poetry.lock .
26-
RUN if [ "$POETRY_EXTRAS" = "" ]; then \
27-
poetry install --all-extras --with dev --no-root; \
28-
else \
29-
poetry install --extras "$POETRY_EXTRAS" --with dev --no-root; \
30-
fi
23+
RUN poetry install --all-extras --with dev --no-root
3124

3225
# copy project source
3326
COPY . .
3427

3528
# install project with poetry
36-
RUN if [ "$POETRY_EXTRAS" = "" ]; then \
37-
poetry install --all-extras --with dev; \
38-
else \
39-
poetry install --extras "$POETRY_EXTRAS" --with dev; \
40-
fi
29+
RUN poetry install --all-extras --with dev

Makefile

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,15 @@
33

44
PYTHON_VERSION ?= 3.10
55
IMAGE = testcontainers-python:${PYTHON_VERSION}
6-
PACKAGES = core $(addprefix modules/,$(notdir $(filter %/, $(wildcard modules/*/))))
6+
PACKAGES = core $(addprefix modules/,$(notdir $(wildcard modules/*)))
77

88
UPLOAD = $(addsuffix /upload,${PACKAGES})
99
TESTS = $(addsuffix /tests,$(filter-out meta,$(filter-out %.md %.txt,${PACKAGES})))
1010
TESTS_DIND = $(addsuffix -dind,${TESTS})
1111
DOCTESTS = $(addsuffix /doctests,$(filter-out modules/README.md,${PACKAGES}))
1212

13-
ARCH := $(shell uname -m)
14-
ARM_ARCHS := arm64 aarch64
15-
IS_ARM := $(filter $(ARCH),$(ARM_ARCHS))
16-
17-
# List of safe extras (excluding 'db2') with original TOML keys
18-
EXTRAS_LIST := $(shell $(PYTHON) scripts/list_arm_extras.py)
19-
2013
install: ## Set up the project for development
21-
ifeq ($(IS_ARM),$(ARCH))
22-
poetry install $(foreach extra,$(EXTRAS_LIST),--extras $(extra))
23-
else
2414
poetry install --all-extras
25-
endif
2615
poetry run pre-commit install
2716

2817
build: ## Build the python package

core/__init__.py

Whitespace-only changes.

core/tests/__init__.py

Whitespace-only changes.

core/tests/conftest.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33
import pytest
44
from typing import Callable
55
from testcontainers.core.container import DockerClient
6-
from testcontainers.core.utils import is_arm
76
import sys
87

9-
from .list_arm_extras import get_arm_extras
10-
118
PROJECT_DIR = Path(__file__).parent.parent.parent.resolve()
129

1310

@@ -27,16 +24,11 @@ def python_testcontainer_image() -> str:
2724
py_version = ".".join(map(str, sys.version_info[:2]))
2825
image_name = f"testcontainers-python:{py_version}"
2926
client = DockerClient()
30-
build_args = {"PYTHON_VERSION": py_version}
31-
32-
if is_arm():
33-
build_args["POETRY_EXTRAS"] = get_arm_extras()
34-
3527
client.build(
3628
path=str(PROJECT_DIR),
3729
tag=image_name,
3830
rm=False,
39-
buildargs=build_args,
31+
buildargs={"PYTHON_VERSION": py_version},
4032
)
4133
return image_name
4234

core/tests/list_arm_extras.py

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

poetry.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ httpx = { version = "*", optional = true }
118118
azure-cosmos = { version = "*", optional = true }
119119
cryptography = { version = "*", optional = true }
120120
trino = { version = "*", optional = true }
121-
ibm_db_sa = { version = "*", optional = true }
121+
ibm_db_sa = { version = "*", optional = true, markers = "platform_machine != 'aarch64' and platform_machine != 'arm64'" }
122122

123123
[tool.poetry.extras]
124124
arangodb = ["python-arango"]

scripts/list_arm_extras.py

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

0 commit comments

Comments
 (0)