Skip to content

Commit eff06a0

Browse files
[BUZZOK-27659] Migrate genai agents images to use UV instead of pip and sync minor image differences (#1684)
* Migrate genai agents images to use UV instead of pip * Reconcile dependencies, updated IDs, tags * Fixes * Fix dockerfile * Fix all diffs between repos --------- Co-authored-by: svc-harness-git2 <[email protected]>
1 parent d5878f9 commit eff06a0

File tree

6 files changed

+236
-544
lines changed

6 files changed

+236
-544
lines changed

public_dropin_environments/python311_genai_agents/Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ RUN apk add --no-cache uv graphviz openblas openssh-server gzip zip unzip curl \
3333
RUN apk add --no-cache rust sqlite
3434

3535
ENV PYTHONUNBUFFERED=1 \
36+
PYTHONDONTWRITEBYTECODE=1 \
3637
PYTHONPYCACHEPREFIX=/tmp/.python_cache \
3738
UV_COMPILE_BYTECODE=1 \
3839
VENV_PATH=${VENV_PATH} \
@@ -44,7 +45,7 @@ ENV PYTHONUNBUFFERED=1 \
4445
ENV PATH="$VENV_PATH/bin:$PATH" \
4546
PYTHONPATH="/home/notebooks/.ipython/extensions:/home/notebooks/storage"
4647

47-
# hadolint ignore=DL3013
48+
# hadolint ignore=SC1091
4849
RUN uv venv ${VENV_PATH} && \
4950
. ${VENV_PATH}/bin/activate && \
5051
uv pip install -U pip setuptools
@@ -93,12 +94,14 @@ ENV ANNOY_COMPILER_ARGS="-D_CRT_SECURE_NO_WARNINGS,-DANNOYLIB_MULTITHREADED_BUIL
9394

9495
ARG WORKDIR
9596
ARG VENV_PATH
97+
ARG EXT=""
9698

97-
COPY ./requirements.txt ${WORKDIR}/
99+
COPY ./pyproject.toml${EXT} ${WORKDIR}/pyproject.toml
98100

99-
# hadolint ignore=DL3013, SC1091
101+
WORKDIR ${WORKDIR}
100102
RUN . ${VENV_PATH}/bin/activate && \
101-
uv pip install --no-cache-dir -r ${WORKDIR}/requirements.txt && rm ${WORKDIR}/requirements.txt
103+
uv sync --no-cache
104+
WORKDIR /
102105

103106
# Copy agent runtime into work directory
104107
COPY ./run_agent.py ${WORKDIR}/

public_dropin_environments/python311_genai_agents/Dockerfile.local

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,16 @@ RUN apk add --no-cache rust sqlite
7474

7575
ENV PYTHONUNBUFFERED=1 \
7676
PYTHONDONTWRITEBYTECODE=1 \
77+
PYTHONPYCACHEPREFIX=/tmp/.python_cache \
78+
UV_COMPILE_BYTECODE=1 \
7779
VENV_PATH=${VENV_PATH} \
7880
PIP_NO_CACHE_DIR=1 \
7981
NOTEBOOKS_KERNEL="python" \
8082
DEEPEVAL_HOME=/tmp/.deepeval \
8183
DEEPEVAL_TELEMETRY_OPT_OUT="YES"
8284

8385
ENV PATH="$VENV_PATH/bin:$PATH" \
84-
PYTHONPATH="/home/notebooks/.ipython/extensions:/home/notebooks/storage"
86+
PYTHONPATH="/home/notebooks/.ipython/extensions:/home/notebooks/storage"
8587

8688
# hadolint ignore=SC1091
8789
RUN uv venv ${VENV_PATH} && \
@@ -132,12 +134,14 @@ ENV ANNOY_COMPILER_ARGS="-D_CRT_SECURE_NO_WARNINGS,-DANNOYLIB_MULTITHREADED_BUIL
132134

133135
ARG WORKDIR
134136
ARG VENV_PATH
137+
ARG EXT=""
135138

136-
COPY ./requirements.txt ${WORKDIR}/
139+
COPY ./pyproject.toml${EXT} ${WORKDIR}/pyproject.toml
137140

138-
# hadolint ignore=DL3013, SC1091
141+
WORKDIR ${WORKDIR}
139142
RUN . ${VENV_PATH}/bin/activate && \
140-
uv pip install --no-cache-dir -r ${WORKDIR}/requirements.txt && rm ${WORKDIR}/requirements.txt
143+
uv sync --no-cache
144+
WORKDIR /
141145

142146
# Copy agent runtime into work directory
143147
COPY ./run_agent.py ${WORKDIR}/
@@ -154,6 +158,7 @@ FROM base AS kernel
154158
ARG UNAME
155159
ARG WORKDIR
156160
ARG GIT_COMMIT
161+
ARG VENV_PATH
157162

158163
LABEL com.datarobot.repo-name="notebooks"
159164
LABEL com.datarobot.repo-sha=$GIT_COMMIT
@@ -162,6 +167,9 @@ RUN chown -R $UNAME:$UNAME ${WORKDIR} /home/notebooks
162167

163168
COPY --from=builder --chown=$UNAME $WORKDIR $WORKDIR
164169

170+
# Warm the heavy dependencies
171+
RUN . ${VENV_PATH}/bin/activate && python -c "import numpy; import pandas; import PIL; import ragas; import scipy; import scipy.io;";
172+
165173
# This is required for custom models to work with this image
166174
COPY ./start_server_drum.sh /opt/code/start_server.sh
167175
ENV HOME=/opt CODE_DIR=/opt/code ADDRESS=0.0.0.0:8080

public_dropin_environments/python311_genai_agents/env_info.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "This template environment can be used to create GenAI-powered agents using CrewAI, LangGraph, or Llama-Index. Similar to other drop-in environments, you can either include a .pth artifact or any other code needed to deserialize your model, and optionally a custom.py file. You can also use this environment in codespaces.",
55
"programmingLanguage": "python",
66
"label": "",
7-
"environmentVersionId": "68ddb0110077fa6855000ec5",
7+
"environmentVersionId": "68deb12c6f40b61231db3f78",
88
"environmentVersionDescription": "",
99
"isPublic": true,
1010
"isDownloadable": true,
@@ -15,8 +15,8 @@
1515
"contextUrl": "https://github.com/datarobot/datarobot-user-models/tree/master/public_dropin_environments/python311_genai_agents",
1616
"imageRepository": "env-python-genai-agents",
1717
"tags": [
18-
"v11.2.0-68ddb0110077fa6855000ec5",
19-
"68ddb0110077fa6855000ec5",
18+
"v11.2.0-68deb12c6f40b61231db3f78",
19+
"68deb12c6f40b61231db3f78",
2020
"v11.2.0-latest"
2121
]
2222
}
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
[project]
2+
3+
name = "DockerContext"
4+
version = "0.1.0"
5+
description = "Implementation of DockerContext"
6+
readme = "README.md"
7+
requires-python = ">=3.10, <3.13"
8+
dependencies = [
9+
"annotated-types>=0.7.0",
10+
"click>=8.1.8",
11+
"datarobot-drum>=1.16.22",
12+
"datarobot-mlops>=11.1.0",
13+
"datarobot-predict>=1.13.2",
14+
"dotenv>=0.9.9",
15+
"langchain-community>=0.3.27",
16+
"langchain-mcp-adapters>=0.1.9",
17+
"langchain>=0.3.23",
18+
"legacy-cgi>=2.6.3",
19+
"litellm>=1.72.1",
20+
"mcp>=1.11.0",
21+
"multidict>=6.5.0",
22+
"onnxruntime>=1.22.0,<1.23.0",
23+
"openai>=1.76.2",
24+
"opentelemetry-api>=1.33.0,<2.0.0",
25+
"opentelemetry-instrumentation-aiohttp-client>=0.54b0",
26+
"opentelemetry-instrumentation-httpx>=0.54b0",
27+
"opentelemetry-instrumentation-langchain>=0.40.5",
28+
"opentelemetry-instrumentation-openai>=0.40.5",
29+
"opentelemetry-instrumentation-requests>=0.54b0",
30+
"opentelemetry-sdk>=1.33.0",
31+
"python-dotenv>=1.1.0",
32+
"ragas @ git+https://github.com/explodinggradients/ragas@5d59549ad5ef511f621502c563bc55ac5aeb9188#subdirectory=ragas",
33+
# pyarrow==21.0.0 breaks the current ragas version https://github.com/apache/arrow/issues/47155
34+
"pyarrow<21.0.0",
35+
"requests>=2.32.4",
36+
"traceloop-sdk>=0.40.2",
37+
"uvicorn>=0.32.0",
38+
"datarobot[auth]>=3.8.2",
39+
"datarobot-moderations>=11.2.3",
40+
41+
# Docker image requirements (These MUST be included to avoid docker conflicts)
42+
"ecs-logging>=2.2.0",
43+
"fastapi[all]==0.115.14",
44+
"ipykernel<6.29.0",
45+
"jupyter-client>=8.6.3",
46+
"jupyter-core>=5.8.1",
47+
"jupyter-kernel-gateway>=3.0.1",
48+
"mistune>=3.1.4",
49+
"numpy>=1.26.4",
50+
"pandas>=2.2.3",
51+
"psutil==5.9.8",
52+
"setuptools>=80.9.0",
53+
"ujson<5.8.0",
54+
"uwsgi>=2.0.30",
55+
56+
# Agent framework requirements
57+
"crewai>=0.177.0",
58+
"crewai-tools>=0.69.0",
59+
"opentelemetry-instrumentation-crewai>=0.40.5",
60+
"pybase64>=1.4.2",
61+
"langgraph>=0.4.10",
62+
"langgraph-prebuilt>=0.2.3",
63+
"llama-index<14.0",
64+
"llama-index-core<14.0",
65+
"llama-index-llms-langchain>=0.6.1",
66+
"llama-index-llms-litellm>=0.4.1",
67+
"llama-index-llms-openai>=0.3.38",
68+
"opentelemetry-instrumentation-llamaindex>=0.40.5",
69+
"pypdf>=6.0.0",
70+
"logfire>=4.6.0",
71+
"pydantic-ai>=1.0.5",
72+
]
73+
74+
[project.optional-dependencies]
75+
dev = [
76+
"mypy>=1.15.0",
77+
"pre-commit>=4.2.0",
78+
"pydantic>=2.6.1",
79+
"pytest-cov>=6.1.1",
80+
"pytest>=7.4.0",
81+
"requests-mock>=1.12.1",
82+
"ruff>=0.12.0",
83+
"types-requests>=2.32.4.20250913",
84+
"yamlfix>=1.17.0",
85+
]
86+
87+
[tool.pytest.ini_options]
88+
testpaths = ["tests"]
89+
python_files = ["test_*.py"]
90+
python_functions = ["test_*"]
91+
pythonpath = ["custom_model"]
92+
93+
[tool.ruff]
94+
# Exclude a variety of commonly ignored directories.
95+
exclude = [
96+
".bzr",
97+
".direnv",
98+
".eggs",
99+
".git",
100+
".git-rewrite",
101+
".hg",
102+
".ipynb_checkpoints",
103+
".mypy_cache",
104+
".nox",
105+
".pants.d",
106+
".pyenv",
107+
".pytest_cache",
108+
".pytype",
109+
".ruff_cache",
110+
".svn",
111+
".tox",
112+
".venv",
113+
".vscode",
114+
"__pycache__",
115+
"__pypackages__",
116+
"_build",
117+
"buck-out",
118+
"build",
119+
"docker_context",
120+
"dist",
121+
"node_modules",
122+
"site-packages",
123+
"venv",
124+
]
125+
126+
# Same as Black.
127+
line-length = 88
128+
indent-width = 4
129+
130+
target-version = "py311"
131+
132+
[tool.ruff.lint]
133+
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
134+
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
135+
# McCabe complexity (`C901`) by default.
136+
select = ["E4", "E7", "E9", "F", "I"]
137+
ignore = []
138+
139+
# Allow fix for all enabled rules (when `--fix`) is provided.
140+
fixable = ["ALL"]
141+
unfixable = []
142+
143+
# Allow unused variables when underscore-prefixed.
144+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
145+
146+
[tool.ruff.format]
147+
# Like Black, use double quotes for strings.
148+
quote-style = "double"
149+
150+
# Like Black, indent with spaces, rather than tabs.
151+
indent-style = "space"
152+
153+
# Like Black, respect magic trailing commas.
154+
skip-magic-trailing-comma = false
155+
156+
# Like Black, automatically detect the appropriate line ending.
157+
line-ending = "auto"
158+
159+
# Enable auto-formatting of code examples in docstrings. Markdown,
160+
# reStructuredText code/literal blocks and doctests are all supported.
161+
#
162+
# This is currently disabled by default, but it is planned for this
163+
# to be opt-out in the future.
164+
docstring-code-format = false
165+
166+
# Set the line length limit used when formatting code snippets in
167+
# docstrings.
168+
#
169+
# This only has an effect when the `docstring-code-format` setting is
170+
# enabled.
171+
docstring-code-line-length = "dynamic"
172+
173+
[tool.yamlfix]
174+
allow_duplicate_keys = true
175+
line_length = 120
176+
177+
# Pydantic plugin must be disabled with llamaindex, see https://github.com/python/mypy/issues/15927
178+
[tool.mypy]
179+
strict = true
180+
python_version = "3.11"
181+
182+
plugins = "pydantic.mypy"
183+
184+
exclude = """(?x)(
185+
output/ # exclude files starting with "output"
186+
| deployment_.*/
187+
| docker_context/
188+
| include/ # or files starting with "include."
189+
| venv/
190+
| .venv/
191+
| .cache
192+
| e2e/
193+
| tests/
194+
)"""
195+
check_untyped_defs = true
196+
disallow_any_generics = true
197+
disallow_incomplete_defs = true
198+
disallow_subclassing_any = true
199+
disallow_untyped_calls = true
200+
disallow_untyped_decorators = true
201+
disallow_untyped_defs = true
202+
enable_error_code = "ignore-without-code"
203+
implicit_reexport = true
204+
ignore_missing_imports = true
205+
no_implicit_optional = true
206+
show_column_numbers = true
207+
warn_redundant_casts = true
208+
warn_return_any = true
209+
warn_unused_configs = true
210+
warn_unused_ignores = true
211+
212+
[[tool.mypy.overrides]]
213+
module = "datarobot.*"
214+
implicit_reexport = true

0 commit comments

Comments
 (0)