truss 0.10.9rc548__py3-none-any.whl → 0.10.9rc549__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of truss might be problematic. Click here for more details.
- truss/templates/base.Dockerfile.jinja +2 -1
- truss/templates/control/control/helpers/truss_patch/model_container_patch_applier.py +61 -24
- truss/templates/server.Dockerfile.jinja +4 -4
- {truss-0.10.9rc548.dist-info → truss-0.10.9rc549.dist-info}/METADATA +1 -1
- {truss-0.10.9rc548.dist-info → truss-0.10.9rc549.dist-info}/RECORD +8 -8
- {truss-0.10.9rc548.dist-info → truss-0.10.9rc549.dist-info}/WHEEL +0 -0
- {truss-0.10.9rc548.dist-info → truss-0.10.9rc549.dist-info}/entry_points.txt +0 -0
- {truss-0.10.9rc548.dist-info → truss-0.10.9rc549.dist-info}/licenses/LICENSE +0 -0
|
@@ -8,6 +8,7 @@ FROM {{ base_image_name_and_tag }} AS truss_server
|
|
|
8
8
|
{%- set python_executable = config.base_image.python_executable_path or 'python3' %}
|
|
9
9
|
ENV PYTHON_EXECUTABLE="{{ python_executable }}"
|
|
10
10
|
|
|
11
|
+
{%- set bundled_packages_path = "/packages" %} {# path for bundled packages #}
|
|
11
12
|
{%- set app_username = "app" %} {# needed later for USER directive#}
|
|
12
13
|
{% block user_setup %}
|
|
13
14
|
{%- set app_user_uid = 60000 %}
|
|
@@ -119,7 +120,7 @@ WORKDIR $APP_HOME
|
|
|
119
120
|
|
|
120
121
|
{% block bundled_packages_copy %}
|
|
121
122
|
{%- if bundled_packages_dir_exists %}
|
|
122
|
-
COPY --chown={{ default_owner }} ./{{ config.bundled_packages_dir }}
|
|
123
|
+
COPY --chown={{ default_owner }} ./{{ config.bundled_packages_dir }} {{ bundled_packages_path }}
|
|
123
124
|
{%- endif %}
|
|
124
125
|
{% endblock %}
|
|
125
126
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import os
|
|
3
|
+
import shutil
|
|
2
4
|
import subprocess
|
|
3
5
|
from pathlib import Path
|
|
4
6
|
from typing import Optional
|
|
@@ -91,27 +93,38 @@ class ModelContainerPatchApplier:
|
|
|
91
93
|
)
|
|
92
94
|
action = python_requirement_patch.action
|
|
93
95
|
|
|
94
|
-
if
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"uninstall",
|
|
99
|
-
"-y",
|
|
96
|
+
if self._pip_path == "uv-control-env":
|
|
97
|
+
# Use uv pip with the control environment's Python
|
|
98
|
+
if action == Action.REMOVE:
|
|
99
|
+
subprocess.run([
|
|
100
|
+
"uv", "pip", "uninstall", "-y",
|
|
100
101
|
python_requirement_patch.requirement,
|
|
101
|
-
|
|
102
|
-
check=True
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
[
|
|
107
|
-
self._pip_path,
|
|
108
|
-
"install",
|
|
102
|
+
"--python", "/control/.env/bin/python"
|
|
103
|
+
], check=True)
|
|
104
|
+
elif action in [Action.ADD, Action.UPDATE]:
|
|
105
|
+
subprocess.run([
|
|
106
|
+
"uv", "pip", "install",
|
|
109
107
|
python_requirement_patch.requirement,
|
|
110
108
|
"--upgrade",
|
|
111
|
-
|
|
112
|
-
check=True
|
|
113
|
-
)
|
|
109
|
+
"--python", "/control/.env/bin/python"
|
|
110
|
+
], check=True)
|
|
114
111
|
else:
|
|
112
|
+
# Deprecated: use traditional pip executable
|
|
113
|
+
# This code block should eventually be removed,
|
|
114
|
+
# because we now use uv.
|
|
115
|
+
if action == Action.REMOVE:
|
|
116
|
+
subprocess.run([
|
|
117
|
+
self._pip_path, "uninstall", "-y",
|
|
118
|
+
python_requirement_patch.requirement,
|
|
119
|
+
], check=True)
|
|
120
|
+
elif action in [Action.ADD, Action.UPDATE]:
|
|
121
|
+
subprocess.run([
|
|
122
|
+
self._pip_path, "install",
|
|
123
|
+
python_requirement_patch.requirement,
|
|
124
|
+
"--upgrade",
|
|
125
|
+
], check=True)
|
|
126
|
+
|
|
127
|
+
if action not in [Action.REMOVE, Action.ADD, Action.UPDATE]:
|
|
115
128
|
raise ValueError(f"Unknown python requirement patch action {action}")
|
|
116
129
|
|
|
117
130
|
def _apply_system_package_patch(self, system_package_patch: SystemPackagePatch):
|
|
@@ -120,17 +133,34 @@ class ModelContainerPatchApplier:
|
|
|
120
133
|
)
|
|
121
134
|
action = system_package_patch.action
|
|
122
135
|
|
|
136
|
+
# Check if we're running as root
|
|
137
|
+
# Deprecated: this code should be removed eventually.
|
|
138
|
+
is_root = os.getuid() == 0
|
|
139
|
+
|
|
140
|
+
# If not root, check for sudo availability
|
|
141
|
+
if not is_root:
|
|
142
|
+
if not shutil.which("sudo"):
|
|
143
|
+
raise RuntimeError(
|
|
144
|
+
"Cannot install system packages for security reasons, please redeploy the model. "
|
|
145
|
+
"System package installation requires elevated privileges that are not available in this environment."
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
# Build the apt command with sudo if needed
|
|
149
|
+
apt_prefix = [] if is_root else ["sudo"]
|
|
150
|
+
|
|
123
151
|
if action == Action.REMOVE:
|
|
124
152
|
subprocess.run(
|
|
125
|
-
["apt", "remove", "-y", system_package_patch.package],
|
|
153
|
+
apt_prefix + ["apt", "remove", "-y", system_package_patch.package],
|
|
154
|
+
check=True
|
|
126
155
|
)
|
|
127
156
|
elif action in [Action.ADD, Action.UPDATE]:
|
|
128
|
-
subprocess.run(["apt", "update"], check=True)
|
|
157
|
+
subprocess.run(apt_prefix + ["apt", "update"], check=True)
|
|
129
158
|
subprocess.run(
|
|
130
|
-
["apt", "install", "-y", system_package_patch.package],
|
|
159
|
+
apt_prefix + ["apt", "install", "-y", system_package_patch.package],
|
|
160
|
+
check=True
|
|
131
161
|
)
|
|
132
162
|
else:
|
|
133
|
-
raise ValueError(f"Unknown
|
|
163
|
+
raise ValueError(f"Unknown system package patch action {action}")
|
|
134
164
|
|
|
135
165
|
def _apply_config_patch(self, config_patch: ConfigPatch):
|
|
136
166
|
self._app_logger.debug(f"Applying config patch {config_patch.to_dict()}")
|
|
@@ -176,10 +206,17 @@ class ModelContainerPatchApplier:
|
|
|
176
206
|
|
|
177
207
|
|
|
178
208
|
def _identify_pip_path() -> str:
|
|
209
|
+
# For uv-managed environments, we don't use a pip executable directly
|
|
210
|
+
# Instead, we return a special marker that indicates we should use uv pip
|
|
211
|
+
control_python = Path("/control/.env/bin/python")
|
|
212
|
+
if control_python.exists():
|
|
213
|
+
return "uv-control-env" # Special marker
|
|
214
|
+
|
|
215
|
+
# Fallback to system pip if control environment doesn't exist
|
|
179
216
|
if Path("/usr/local/bin/pip3").exists():
|
|
180
217
|
return "/usr/local/bin/pip3"
|
|
181
|
-
|
|
218
|
+
|
|
182
219
|
if Path("/usr/local/bin/pip").exists():
|
|
183
220
|
return "/usr/local/bin/pip"
|
|
184
|
-
|
|
185
|
-
raise RuntimeError("Unable to find pip, make sure it's installed.")
|
|
221
|
+
|
|
222
|
+
raise RuntimeError("Unable to find pip, make sure it's installed.")
|
|
@@ -104,7 +104,7 @@ COPY --chown={{ default_owner }} ./{{ config.model_module_dir }} ${APP_HOME}/mod
|
|
|
104
104
|
{# Macro to change ownership of directories and switch to regular user #}
|
|
105
105
|
{%- macro chown_and_switch_to_regular_user_if_enabled(additional_chown_dirs=[]) -%}
|
|
106
106
|
{%- if non_root_user %}
|
|
107
|
-
RUN chown -R {{ app_username }}:{{ app_username }} {% for dir in additional_chown_dirs %}{{ dir }} {% endfor %}${HOME} ${APP_HOME}
|
|
107
|
+
RUN chown -R {{ app_username }}:{{ app_username }} {% for dir in additional_chown_dirs %}{{ dir }} {% endfor %}${HOME} ${APP_HOME} {{ bundled_packages_path }}
|
|
108
108
|
USER {{ app_username }}
|
|
109
109
|
{%- endif %} {#- endif non_root_user #}
|
|
110
110
|
{%- endmacro -%}
|
|
@@ -115,9 +115,9 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
|
|
|
115
115
|
COPY --chown={{ default_owner }} ./docker_server_requirements.txt ${APP_HOME}/docker_server_requirements.txt
|
|
116
116
|
|
|
117
117
|
{# NB(nikhil): Use the same python version for custom server proxy as the control server, for consistency. #}
|
|
118
|
-
RUN
|
|
119
|
-
RUN
|
|
120
|
-
RUN
|
|
118
|
+
RUN uv python install {{ control_python_version }}
|
|
119
|
+
RUN uv venv /docker_server/.venv --python {{ control_python_version }}
|
|
120
|
+
RUN uv pip install --python /docker_server/.venv/bin/python -r /app/docker_server_requirements.txt --no-cache-dir
|
|
121
121
|
{% set proxy_config_path = "/etc/nginx/conf.d/proxy.conf" %}
|
|
122
122
|
{% set supervisor_config_path = "/etc/supervisor/supervisord.conf" %}
|
|
123
123
|
{% set supervisor_server_url = "http://localhost:8080" %}
|
|
@@ -66,12 +66,12 @@ truss/remote/baseten/utils/time.py,sha256=Ry9GMjYnbIGYVIGwtmv4V8ljWjvdcaCf5NOQzl
|
|
|
66
66
|
truss/remote/baseten/utils/transfer.py,sha256=d3VptuQb6M1nyS6kz0BAfeOYDLkMKUjatJXpY-mp-As,1548
|
|
67
67
|
truss/templates/README.md.jinja,sha256=N7CJdyldZuJamj5jLh47le0hFBdu9irVsTBqoxhPNPQ,2476
|
|
68
68
|
truss/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
69
|
-
truss/templates/base.Dockerfile.jinja,sha256=
|
|
69
|
+
truss/templates/base.Dockerfile.jinja,sha256=ExTV995fE_1M-o0IXh5bJxqnISgb7rlttvUw7lXRc0M,5708
|
|
70
70
|
truss/templates/cache.Dockerfile.jinja,sha256=1qZqDo1phrcqi-Vwol-VafYJkADsBbQWU6huQ-_1x00,1146
|
|
71
71
|
truss/templates/cache_requirements.txt,sha256=xoPoJ-OVnf1z6oq_RVM3vCr3ionByyqMLj7wGs61nUs,87
|
|
72
72
|
truss/templates/copy_cache_files.Dockerfile.jinja,sha256=Os5zFdYLZ_AfCRGq4RcpVTObOTwL7zvmwYcvOzd_Zqo,126
|
|
73
73
|
truss/templates/docker_server_requirements.txt,sha256=PyhOPKAmKW1N2vLvTfLMwsEtuGpoRrbWuNo7tT6v2Mc,18
|
|
74
|
-
truss/templates/server.Dockerfile.jinja,sha256=
|
|
74
|
+
truss/templates/server.Dockerfile.jinja,sha256=4mVJGgFUcP6wtMEYcEbl5bzregHqOsKxeFIe3BYVNrA,7097
|
|
75
75
|
truss/templates/control/requirements.txt,sha256=Kk0tYID7trPk5gwX38Wrt2-YGWZAXFJCJRcqJ8ZzCjc,251
|
|
76
76
|
truss/templates/control/control/application.py,sha256=jYeta6hWe1SkfLL3W4IDmdYjg3ZuKqI_UagWYs5RB_E,3793
|
|
77
77
|
truss/templates/control/control/endpoints.py,sha256=FM-sgao7I3gMoUTasM3Xq_g2LDoJQe75JxIoaQxzeNo,10031
|
|
@@ -84,7 +84,7 @@ truss/templates/control/control/helpers/inference_server_process_controller.py,s
|
|
|
84
84
|
truss/templates/control/control/helpers/inference_server_starter.py,sha256=Fz2Puijro6Cc5cvTsAqOveNJbBQR_ARYJXl4lvETJ8Y,2633
|
|
85
85
|
truss/templates/control/control/helpers/truss_patch/__init__.py,sha256=CXZdUV_ylqLTJrKuFpvSnUT6PUFrZrMF2y6jiHbdaKU,998
|
|
86
86
|
truss/templates/control/control/helpers/truss_patch/model_code_patch_applier.py,sha256=LTIIADLz0wRn7V49j64dU1U7Hbta9YLde3pb5YZWvzQ,2001
|
|
87
|
-
truss/templates/control/control/helpers/truss_patch/model_container_patch_applier.py,sha256=
|
|
87
|
+
truss/templates/control/control/helpers/truss_patch/model_container_patch_applier.py,sha256=EnPMfoqtw3tjGhp1vQF_hAIhQqslsuM9M4mBcwWAe3Q,9053
|
|
88
88
|
truss/templates/control/control/helpers/truss_patch/requirement_name_identifier.py,sha256=CL3KEAj4B3ApMQShd7TI5umXVbazLZY5StrNlwHwWtc,1995
|
|
89
89
|
truss/templates/control/control/helpers/truss_patch/system_packages.py,sha256=IYh1CVU_kooAvtSGXKQDDWnNdOhlv7ENWagsL1wvhgw,208
|
|
90
90
|
truss/templates/custom/examples.yaml,sha256=2UcCtEdavImWmiCtj31ckBlAKVOwNMC5AwMIIznKDag,48
|
|
@@ -365,8 +365,8 @@ truss_train/definitions.py,sha256=RZs4bCWkq7gBJALDLgmd4QxjlxWk6GMs2a62kiAalvw,67
|
|
|
365
365
|
truss_train/deployment.py,sha256=zmeJ66kg1Wc7l7bwA_cXqv85uMF77hYl7NPHuhc1NPs,2493
|
|
366
366
|
truss_train/loader.py,sha256=0o66EjBaHc2YY4syxxHVR4ordJWs13lNXnKjKq2wq0U,1630
|
|
367
367
|
truss_train/public_api.py,sha256=9N_NstiUlmBuLUwH_fNG_1x7OhGCytZLNvqKXBlStrM,1220
|
|
368
|
-
truss-0.10.
|
|
369
|
-
truss-0.10.
|
|
370
|
-
truss-0.10.
|
|
371
|
-
truss-0.10.
|
|
372
|
-
truss-0.10.
|
|
368
|
+
truss-0.10.9rc549.dist-info/METADATA,sha256=N9YtbH5yEBV6gtiLQFltXblIxRbVlW7kyyGekB35-FI,6674
|
|
369
|
+
truss-0.10.9rc549.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
370
|
+
truss-0.10.9rc549.dist-info/entry_points.txt,sha256=-MwKfHHQHQ6j0HqIgvxrz3CehCmczDLTD-OsRHnjjuU,130
|
|
371
|
+
truss-0.10.9rc549.dist-info/licenses/LICENSE,sha256=FTqGzu85i-uw1Gi8E_o0oD60bH9yQ_XIGtZbA1QUYiw,1064
|
|
372
|
+
truss-0.10.9rc549.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|