truss 0.11.5rc501__py3-none-any.whl → 0.11.6rc100__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/cli/train/core.py CHANGED
@@ -458,6 +458,7 @@ def _get_all_train_init_example_options(
458
458
  def _get_train_init_example_info(
459
459
  repo_id: str = "ml-cookbook",
460
460
  examples_subdir: str = "examples",
461
+ training_subdir: str = "training",
461
462
  example_name: Optional[str] = None,
462
463
  token: Optional[str] = None,
463
464
  ) -> list[Dict[str, str]]:
@@ -471,6 +472,7 @@ def _get_train_init_example_info(
471
472
 
472
473
  url = f"https://api.github.com/repos/basetenlabs/{repo_id}/contents/{examples_subdir}/{example_name}"
473
474
 
475
+ console.print(f"Attempting to retrieve example info from: {url}")
474
476
  try:
475
477
  response = requests.get(url, headers=headers)
476
478
  response.raise_for_status()
@@ -478,6 +480,8 @@ def _get_train_init_example_info(
478
480
  items = response.json()
479
481
  if not isinstance(items, list):
480
482
  items = [items]
483
+ # return only training subdirectory info for example
484
+ items = [item for item in items if item["name"] == training_subdir]
481
485
  return items
482
486
 
483
487
  except requests.exceptions.HTTPError as e:
@@ -785,9 +785,6 @@ class ServingImageBuilder(ImageBuilder):
785
785
  )
786
786
 
787
787
  non_root_user = os.getenv("BT_USE_NON_ROOT_USER", False)
788
- enable_model_container_admin_commands = os.getenv(
789
- "BT_ENABLE_MODEL_CONTAINER_ADMIN_CMDS"
790
- )
791
788
  dockerfile_contents = dockerfile_template.render(
792
789
  should_install_server_requirements=should_install_server_requirements,
793
790
  base_image_name_and_tag=base_image_name_and_tag,
@@ -822,7 +819,6 @@ class ServingImageBuilder(ImageBuilder):
822
819
  use_local_src=config.use_local_src,
823
820
  passthrough_environment_variables=passthrough_environment_variables,
824
821
  non_root_user=non_root_user,
825
- enable_model_container_admin_commands=enable_model_container_admin_commands,
826
822
  **FILENAME_CONSTANTS_MAP,
827
823
  )
828
824
  # Consolidate repeated empty lines to single empty lines.
@@ -32,16 +32,6 @@ RUN useradd -u {{ app_user_uid }} -ms /bin/bash {{ app_username }}
32
32
  {#- at the very beginning, set non-interactive mode for apt #}
33
33
  ENV DEBIAN_FRONTEND=noninteractive
34
34
 
35
- {# If non-root user is enabled and model container admin commands are enabled, install sudo #}
36
- {# to allow the non-root user to install packages. #}
37
- {%- if non_root_user and enable_model_container_admin_commands %}
38
- RUN apt update && apt install -y sudo
39
- {%- set allowed_admin_commands = ["/usr/bin/apt install *", "/usr/bin/apt update"] %}
40
- RUN echo "Defaults:{{ app_username }} passwd_tries=0\n{{ app_username }} ALL=(root) NOPASSWD: {{ allowed_admin_commands | join(", ") }}" > /etc/sudoers.d/app-packages
41
- RUN chmod 0440 /etc/sudoers.d/app-packages
42
- {#- optional but good practice: check if the sudoers file is valid #}
43
- RUN visudo -c
44
- {%- endif %} {#- endif non_root_user and enable_model_container_admin_commands #}
45
35
 
46
36
  {%- set UV_VERSION = "0.7.19" %}
47
37
  {#
@@ -182,6 +182,12 @@ class BasetenEndpoints:
182
182
  """
183
183
  Executes a predictive endpoint
184
184
  """
185
+ request_id = request.headers.get("x-baseten-request-id")
186
+
187
+ logging.debug(
188
+ f"Request received - {request.method} {method.__name__} "
189
+ f", Request ID: {request_id}"
190
+ )
185
191
  self.check_healthy()
186
192
  trace_ctx = otel_propagate.extract(request.headers) or None
187
193
  # This is the top-level span in the truss-server, so we set the context here.
@@ -160,7 +160,7 @@ class TestGetTrainInitExampleInfo:
160
160
  """Test cases for _get_train_init_example_info function"""
161
161
 
162
162
  @patch("requests.get")
163
- def test_successful_request_without_token(self, mock_get):
163
+ def test_request_without_token(self, mock_get):
164
164
  """Test successful API call without authentication token"""
165
165
  # Arrange
166
166
  mock_response = Mock()
@@ -179,12 +179,32 @@ class TestGetTrainInitExampleInfo:
179
179
  "https://api.github.com/repos/basetenlabs/ml-cookbook/contents/examples/test_example",
180
180
  headers={},
181
181
  )
182
- assert len(result) == 2
183
- assert result[0]["name"] == "file1.py"
184
- assert result[1]["name"] == "file2.py"
182
+ assert len(result) == 0 # No training subdir in mock response
185
183
 
186
184
  @patch("requests.get")
187
- def test_successful_request_with_token(self, mock_get):
185
+ def test_successful_request_without_token(self, mock_get):
186
+ """Test successful API call without authentication token"""
187
+ # Arrange
188
+ mock_response = Mock()
189
+ mock_response.json.return_value = [
190
+ {"name": "training", "path": "git_path_1", "type": "dir"},
191
+ {"name": "file2.py", "type": "file"},
192
+ ]
193
+ mock_response.raise_for_status.return_value = None
194
+ mock_get.return_value = mock_response
195
+
196
+ # Act
197
+ result = _get_train_init_example_info(example_name="test_example")
198
+
199
+ # Assert
200
+ mock_get.assert_called_once_with(
201
+ "https://api.github.com/repos/basetenlabs/ml-cookbook/contents/examples/test_example",
202
+ headers={},
203
+ )
204
+ assert len(result) == 1 # One training subdir in mock response
205
+
206
+ @patch("requests.get")
207
+ def test_request_with_token(self, mock_get):
188
208
  """Test successful API call with authentication token"""
189
209
  # Arrange
190
210
  mock_response = Mock()
@@ -202,7 +222,7 @@ class TestGetTrainInitExampleInfo:
202
222
  "https://api.github.com/repos/basetenlabs/ml-cookbook/contents/examples/test_example",
203
223
  headers={"Authorization": "token test_token"},
204
224
  )
205
- assert len(result) == 1
225
+ assert len(result) == 0 # No training subdir in mock response
206
226
 
207
227
  @patch("requests.get")
208
228
  def test_custom_repo_and_subdir(self, mock_get):
@@ -226,22 +246,6 @@ class TestGetTrainInitExampleInfo:
226
246
  headers={},
227
247
  )
228
248
 
229
- @patch("requests.get")
230
- def test_single_item_response(self, mock_get):
231
- """Test when API returns a single item instead of a list"""
232
- # Arrange
233
- mock_response = Mock()
234
- mock_response.json.return_value = {"name": "single_file.py", "type": "file"}
235
- mock_response.raise_for_status.return_value = None
236
- mock_get.return_value = mock_response
237
-
238
- # Act
239
- result = _get_train_init_example_info(example_name="test_example")
240
-
241
- # Assert
242
- assert len(result) == 1
243
- assert result[0]["name"] == "single_file.py"
244
-
245
249
  @patch("requests.get")
246
250
  @patch("click.echo")
247
251
  def test_404_error_returns_empty_list(self, mock_echo, mock_get):
@@ -1,4 +1,5 @@
1
1
  ARG PYVERSION=py39
2
+ ARG HOME
2
3
  FROM baseten/truss-server-base:3.9-v0.4.3 AS truss_server
3
4
  ENV PYTHON_EXECUTABLE="/usr/local/bin/python3"
4
5
  ENV HOME=${HOME:-/root}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: truss
3
- Version: 0.11.5rc501
3
+ Version: 0.11.6rc100
4
4
  Summary: A seamless bridge from model development to model delivery
5
5
  Project-URL: Repository, https://github.com/basetenlabs/truss
6
6
  Project-URL: Homepage, https://truss.baseten.co
@@ -17,7 +17,7 @@ truss/cli/logs/model_log_watcher.py,sha256=NACcP-wkcaroYa2Cb9BZC7Yr0554WZa_FSM2L
17
17
  truss/cli/logs/training_log_watcher.py,sha256=r6HRqrLnz-PiKTUXiDYYxg4ZnP8vYcXlEX1YmgHhzlo,1173
18
18
  truss/cli/logs/utils.py,sha256=z-U_FG4BUzdZLbE3BnXb4DZQ0zt3LSZ3PiQpLaDuc3o,1031
19
19
  truss/cli/train/common.py,sha256=xTR41U5FeSndXfNBBHF9wF5XwZH1sOIVFlv-XHjsKIU,1547
20
- truss/cli/train/core.py,sha256=4vPnREmaJh8R_rlwR0_H5NRaXhdyY2g07w11uab-9qw,25908
20
+ truss/cli/train/core.py,sha256=Xyl0SgCXIyvoQJLnkIvX6R2gWUVyeDiFHLB1caWJZjs,26154
21
21
  truss/cli/train/deploy_from_checkpoint_config.yml,sha256=mktaVrfhN8Kjx1UveC4xr-gTW-kjwbHvq6bx_LpO-Wg,371
22
22
  truss/cli/train/deploy_from_checkpoint_config_whisper.yml,sha256=6GbOorYC8ml0UyOUvuBpFO_fuYtYE646JqsalR-D4oY,406
23
23
  truss/cli/train/metrics_watcher.py,sha256=smz-zrEsBj_-wJHI0pAZ-EAPrvfCWzq1eQjGiFNM-Mk,12755
@@ -36,7 +36,7 @@ truss/contexts/docker_build_setup.py,sha256=cF4ExZgtYvrWxvyCAaUZUvV_DB_7__MqVomU
36
36
  truss/contexts/truss_context.py,sha256=uS6L-ACHxNk0BsJwESOHh1lA0OGGw0pb33aFKGsASj4,436
37
37
  truss/contexts/image_builder/cache_warmer.py,sha256=TGMV1Mh87n2e_dSowH0sf0rZhZraDOR-LVapZL3a5r8,7377
38
38
  truss/contexts/image_builder/image_builder.py,sha256=IuRgDeeoHVLzIkJvKtX3807eeqEyaroCs_KWDcIHZUg,1461
39
- truss/contexts/image_builder/serving_image_builder.py,sha256=ywPV6qsItc7FgxAvgVq1ktQdtFAAQ6tyy5nzwO6pBaA,33647
39
+ truss/contexts/image_builder/serving_image_builder.py,sha256=n6MTHMZsANSTGXPfkKDJ1Ch4fEc6HIjbOXA_1B9zt9Q,33438
40
40
  truss/contexts/image_builder/util.py,sha256=y2-CjUKv0XV-0w2sr1fUCflysDJLsoU4oPp6tvvoFnk,1203
41
41
  truss/contexts/local_loader/docker_build_emulator.py,sha256=3n0eIlJblz_sldh4AN8AHQDyfjQGdYyld5FabBdd9wE,3563
42
42
  truss/contexts/local_loader/dockerfile_parser.py,sha256=GoRJ0Af_3ILyLhjovK5lrCGn1rMxz6W3l681ro17ZzI,1344
@@ -66,7 +66,7 @@ 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=GH4Pu8EAezoolWT7qhB5NlQ_N5tm-2LuC8WcZAx4dhc,5813
69
+ truss/templates/base.Dockerfile.jinja,sha256=93UgFjjDzmRILsWjvQBMcWuHY2j-HlP8pkCLmvZz_0o,5098
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
@@ -97,7 +97,7 @@ truss/templates/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
97
97
  truss/templates/server/main.py,sha256=kWXrdD8z8IpamyWxc8qcvd5ck9gM1Kz2QH5qHJCnmOQ,222
98
98
  truss/templates/server/model_wrapper.py,sha256=k75VVISwwlsx5EGb82UZsu8kCM_i6Yi3-Hd0-Kpm1yo,42055
99
99
  truss/templates/server/requirements.txt,sha256=lhJYYExWE1IdBlYYFW-kmfmuKZTWyIg1TNyoWIIuuDg,780
100
- truss/templates/server/truss_server.py,sha256=noXfGJMsKIhgF4oI_8LC1UHkcx8Vg8nGSITZJ_bkRFQ,19598
100
+ truss/templates/server/truss_server.py,sha256=DWC821e1LPHrdgz4qEnHiduuFHjDE-kYfv_SBhdXmWU,19809
101
101
  truss/templates/server/common/__init__.py,sha256=qHIqr68L5Tn4mV6S-PbORpcuJ4jmtBR8aCuRTIWDvNo,85
102
102
  truss/templates/server/common/errors.py,sha256=My0P6-Y7imVTICIhazHT0vlSu3XJDH7As06OyVzu4Do,8589
103
103
  truss/templates/server/common/patches.py,sha256=uEOzvDnXsHOkTSa8zygGYuR4GHhrFNVHNQc5peJcwvo,1393
@@ -144,7 +144,7 @@ truss/tests/cli/test_cli.py,sha256=yfbVS5u1hnAmmA8mJ539vj3lhH-JVGUvC4Q_Mbort44,7
144
144
  truss/tests/cli/train/test_cache_view.py,sha256=aVRCh3atRpFbJqyYgq7N-vAW0DiKMftQ7ajUqO2ClOg,22606
145
145
  truss/tests/cli/train/test_deploy_checkpoints.py,sha256=lDk88uAUPYatJ30JKVVtJDdXv_zWNk1nxXFyUH6IVGw,44800
146
146
  truss/tests/cli/train/test_train_cli_core.py,sha256=vzYfxKdwoa3NaFMrVZbSg5qOoLXivMvZXN1ClQirGTQ,16148
147
- truss/tests/cli/train/test_train_init.py,sha256=pv8BfyLlVG0QtdowTziITjKa_OE1KigatmAGx8XSZrM,17238
147
+ truss/tests/cli/train/test_train_init.py,sha256=SRAZvvD5-PWYlpHHek2MftYTA4I3ZHi7gniHl2fYV98,17464
148
148
  truss/tests/cli/train/resources/test_deploy_from_checkpoint_config.yml,sha256=GF7r9l0KaeXiUYCPSBpeMPd2QG6PeWWyI12NdbqLOgc,1930
149
149
  truss/tests/contexts/image_builder/test_serving_image_builder.py,sha256=16niCXZnuxFHXYQw2vPFZ8svSZafkH5DT0Gx3Z9Xdd8,22377
150
150
  truss/tests/contexts/local_loader/test_load_local.py,sha256=D1qMH2IpYA2j5009v50QMgUnKdeOsX15ndkwXe10a4E,801
@@ -184,7 +184,7 @@ truss/tests/test_data/pima-indians-diabetes.csv,sha256=BvW3ws17ymhv2k-S6rX2Hn_2Q
184
184
  truss/tests/test_data/readme_int_example.md,sha256=fuHvpLtdkJy1f4NAR_djotVBdzusHYNXc-Fwh588XAE,1586
185
185
  truss/tests/test_data/readme_no_example.md,sha256=T2CzFMRvICXeX3_5XbFoqhHchcHGot-xM7izx34B3aQ,1607
186
186
  truss/tests/test_data/readme_str_example.md,sha256=fP4pvMqgLdIapaOf_BgRiV0H7pw4so0RNxrlq5lbROE,1726
187
- truss/tests/test_data/server.Dockerfile,sha256=EdJKGqEztRXOzXec021BBH7C4rV4QEDGqD357s0IPZU,1976
187
+ truss/tests/test_data/server.Dockerfile,sha256=64M9aAB-Ar5Yl0k9r5WFxVb-4iUShm_OR1w9pKJfDgg,1985
188
188
  truss/tests/test_data/annotated_types_truss/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
189
189
  truss/tests/test_data/annotated_types_truss/config.yaml,sha256=B-ZyyjLLqtxGfXj2tkH68Hy7NOMB_coYvoWyWom61g0,147
190
190
  truss/tests/test_data/annotated_types_truss/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -368,8 +368,8 @@ truss_train/deployment.py,sha256=lWWANSuzBWu2M4oK4qD7n-oVR1JKdmw2Pn5BJQHg-Ck,307
368
368
  truss_train/loader.py,sha256=0o66EjBaHc2YY4syxxHVR4ordJWs13lNXnKjKq2wq0U,1630
369
369
  truss_train/public_api.py,sha256=9N_NstiUlmBuLUwH_fNG_1x7OhGCytZLNvqKXBlStrM,1220
370
370
  truss_train/restore_from_checkpoint.py,sha256=8hdPm-WSgkt74HDPjvCjZMBpvA9MwtoYsxVjOoa7BaM,1176
371
- truss-0.11.5rc501.dist-info/METADATA,sha256=o6fjTFC_junPHCRvoSsJUFNaqEHbWMMKRpwLMyUbju8,6682
372
- truss-0.11.5rc501.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
373
- truss-0.11.5rc501.dist-info/entry_points.txt,sha256=-MwKfHHQHQ6j0HqIgvxrz3CehCmczDLTD-OsRHnjjuU,130
374
- truss-0.11.5rc501.dist-info/licenses/LICENSE,sha256=FTqGzu85i-uw1Gi8E_o0oD60bH9yQ_XIGtZbA1QUYiw,1064
375
- truss-0.11.5rc501.dist-info/RECORD,,
371
+ truss-0.11.6rc100.dist-info/METADATA,sha256=JeWzo9x1qjdlserdUekOwKC8UjV3sZmT39hsmqWQJm8,6682
372
+ truss-0.11.6rc100.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
373
+ truss-0.11.6rc100.dist-info/entry_points.txt,sha256=-MwKfHHQHQ6j0HqIgvxrz3CehCmczDLTD-OsRHnjjuU,130
374
+ truss-0.11.6rc100.dist-info/licenses/LICENSE,sha256=FTqGzu85i-uw1Gi8E_o0oD60bH9yQ_XIGtZbA1QUYiw,1064
375
+ truss-0.11.6rc100.dist-info/RECORD,,