truefoundry 0.4.2rc5__py3-none-any.whl → 0.4.3__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 truefoundry might be problematic. Click here for more details.

@@ -6,6 +6,8 @@ CREDENTIAL_FILEPATH = TFY_CONFIG_DIR / "credentials.json"
6
6
  TFY_HOST_ENV_KEY = "TFY_HOST"
7
7
  TFY_API_KEY_ENV_KEY = "TFY_API_KEY"
8
8
  TFY_CLI_LOCAL_DEV_MODE_ENV_KEY = "TFY_CLI_LOCAL_DEV_MODE"
9
+ TFY_CLI_PYTHONBUILD_PYTHON_IMAGE_REPO_ENV_KEY = "TFY_CLI_PYTHONBUILD_PYTHON_IMAGE_REPO"
10
+
9
11
 
10
12
  API_SERVER_RELATIVE_PATH = "api/svc"
11
13
  MLFOUNDRY_SERVER_RELATIVE_PATH = "api/ml"
@@ -21,11 +21,9 @@ DOCKERFILE_TEMPLATE = Template(
21
21
  """
22
22
  FROM ${base_image_uri}
23
23
  USER root
24
-
25
24
  % if build_script_docker_commands is not None:
26
25
  ${build_script_docker_commands}
27
26
  % endif
28
-
29
27
  USER $NB_UID
30
28
  """
31
29
  )
@@ -3,6 +3,7 @@ from typing import Dict, List, Optional
3
3
 
4
4
  from mako.template import Template
5
5
 
6
+ from truefoundry.common.constants import TFY_CLI_PYTHONBUILD_PYTHON_IMAGE_REPO_ENV_KEY
6
7
  from truefoundry.deploy.auto_gen.models import PythonBuild
7
8
  from truefoundry.deploy.builder.constants import (
8
9
  PIP_CONF_BUILDKIT_SECRET_MOUNT,
@@ -12,26 +13,25 @@ from truefoundry.deploy.v2.lib.patched_models import CUDAVersion
12
13
 
13
14
  # TODO (chiragjn): Switch to a non-root user inside the container
14
15
 
16
+ DEFAULT_PYTHON_IMAGE_REPO = "public.ecr.aws/docker/library/python"
17
+
15
18
  _POST_PYTHON_INSTALL_TEMPLATE = """
16
19
  % if apt_install_command is not None:
17
20
  RUN ${apt_install_command}
18
21
  % endif
19
-
20
22
  % if requirements_path is not None:
21
23
  COPY ${requirements_path} ${requirements_destination_path}
22
24
  % endif
23
-
24
25
  % if pip_install_command is not None:
25
26
  RUN ${pip_config_secret_mount} ${pip_install_command}
26
27
  % endif
27
-
28
28
  COPY . /app
29
29
  WORKDIR /app
30
30
  """
31
31
 
32
32
  DOCKERFILE_TEMPLATE = Template(
33
33
  """
34
- FROM --platform=linux/amd64 public.ecr.aws/docker/library/python:${python_version}
34
+ FROM --platform=linux/amd64 ${python_image_repo}:${python_version}
35
35
  ENV PATH=/virtualenvs/venv/bin:$PATH
36
36
  RUN apt update && \
37
37
  DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends git && \
@@ -155,8 +155,10 @@ def generate_dockerfile_content(
155
155
  apt_install_command = generate_apt_install_command(
156
156
  apt_packages=build_configuration.apt_packages
157
157
  )
158
-
159
158
  template_args = {
159
+ "python_image_repo": os.getenv(
160
+ TFY_CLI_PYTHONBUILD_PYTHON_IMAGE_REPO_ENV_KEY, DEFAULT_PYTHON_IMAGE_REPO
161
+ ),
160
162
  "python_version": build_configuration.python_version,
161
163
  "apt_install_command": apt_install_command,
162
164
  "requirements_path": requirements_path,
@@ -1,11 +1,9 @@
1
- import os
2
1
  import subprocess
3
2
  from typing import Dict, List, Optional
4
3
 
5
4
  import docker
6
5
  from rich.console import Console
7
6
 
8
- from truefoundry.deploy.lib.clients.shell_client import Shell
9
7
  from truefoundry.logger import logger
10
8
 
11
9
  __all__ = [
@@ -17,15 +15,6 @@ __all__ = [
17
15
  ]
18
16
 
19
17
 
20
- def _get_build_args_string(build_args: Optional[Dict[str, str]] = None) -> str:
21
- if not build_args:
22
- return None
23
- result = []
24
- for param, value in build_args.items():
25
- result.extend(["--build-arg", f"{param.strip()}={value}"])
26
- return result
27
-
28
-
29
18
  def _get_docker_client():
30
19
  try:
31
20
  return docker.from_env()
@@ -73,53 +62,30 @@ def build_docker_image(
73
62
  extra_opts: Optional[List[str]] = None,
74
63
  build_args: Optional[Dict[str, str]] = None,
75
64
  ):
76
- use_depot = bool(os.environ.get("USE_DEPOT"))
77
- depot_project_id = os.environ.get("DEPOT_PROJECT_KEY")
78
65
  logger.info("Starting docker build...")
79
- if use_depot and depot_project_id:
80
- try:
81
- command = [
82
- "depot",
83
- "build",
84
- "--project",
85
- depot_project_id,
86
- "-f",
87
- dockerfile,
88
- "-t",
89
- tag,
90
- path,
91
- ]
92
- final_build_args = _get_build_args_string(build_args=build_args)
93
- if final_build_args:
94
- command.extend(final_build_args)
95
- command.append("--push") # keep push at last
96
- Shell().execute_shell_command(command=command)
97
- except Exception as e:
98
- raise Exception("Error while building Docker image using Depot") from e
99
- else:
100
- try:
101
- # TODO (chiragjn): Maybe consider using client.images.build
102
- build_args_list = []
103
- if build_args:
104
- for k, v in build_args.items():
105
- build_args_list += ["--build-arg", f"{k}={v}"]
106
-
107
- docker_build_cmd = [
108
- "docker",
109
- "build",
110
- "-t",
111
- tag,
112
- "-f",
113
- dockerfile,
114
- "--platform",
115
- platform,
116
- ]
117
- docker_build_cmd += [path]
118
- docker_build_cmd += build_args_list
119
- docker_build_cmd += extra_opts if extra_opts else []
120
- _run_cmds(docker_build_cmd)
121
- except Exception as e:
122
- raise Exception(f"Error while building Docker image: {e}") from e
66
+ try:
67
+ # TODO (chiragjn): Maybe consider using client.images.build
68
+ build_args_list = []
69
+ if build_args:
70
+ for k, v in build_args.items():
71
+ build_args_list += ["--build-arg", f"{k}={v}"]
72
+
73
+ docker_build_cmd = [
74
+ "docker",
75
+ "build",
76
+ "-t",
77
+ tag,
78
+ "-f",
79
+ dockerfile,
80
+ "--platform",
81
+ platform,
82
+ ]
83
+ docker_build_cmd += [path]
84
+ docker_build_cmd += build_args_list
85
+ docker_build_cmd += extra_opts if extra_opts else []
86
+ _run_cmds(docker_build_cmd)
87
+ except Exception as e:
88
+ raise Exception(f"Error while building Docker image: {e}") from e
123
89
 
124
90
 
125
91
  def push_docker_image(
@@ -125,7 +125,7 @@ def deploy_command(
125
125
  help="FQN of the Workspace to deploy to.",
126
126
  )
127
127
  @handle_exception_wrapper
128
- def deploy_workflow_command(name: str, workflow_file: str, workspace_fqn: str):
128
+ def deploy_workflow_command(name: str, file: str, workspace_fqn: str):
129
129
  from truefoundry.deploy.lib.auth.servicefoundry_session import ServiceFoundrySession
130
130
 
131
131
  try:
@@ -137,7 +137,7 @@ def deploy_workflow_command(name: str, workflow_file: str, workspace_fqn: str):
137
137
 
138
138
  workflow = Workflow(
139
139
  name=name,
140
- workflow_file_path=workflow_file,
140
+ workflow_file_path=file,
141
141
  )
142
142
  workflow.deploy(workspace_fqn=workspace_fqn)
143
143
 
@@ -3,7 +3,5 @@ from truefoundry.deploy.io.rich_output_callback import RichOutputCallBack
3
3
  ENTITY_JSON_DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
4
4
  RICH_OUTPUT_CALLBACK = RichOutputCallBack()
5
5
 
6
- SFY_DEBUG_ENV_KEY = "SFY_DEBUG"
7
6
  TFY_DEBUG_ENV_KEY = "TFY_DEBUG"
8
- SFY_INTERNAL_ENV_KEY = "SFY_INTERNAL"
9
7
  TFY_INTERNAL_ENV_KEY = "TFY_INTERNAL"
@@ -3,25 +3,17 @@ import re
3
3
  from typing import Union
4
4
 
5
5
  from truefoundry.deploy.lib.const import (
6
- SFY_DEBUG_ENV_KEY,
7
- SFY_INTERNAL_ENV_KEY,
8
6
  TFY_DEBUG_ENV_KEY,
9
7
  TFY_INTERNAL_ENV_KEY,
10
8
  )
11
9
 
12
10
 
13
11
  def is_debug_env_set() -> bool:
14
- return (
15
- True if os.getenv(TFY_DEBUG_ENV_KEY) or os.getenv(SFY_DEBUG_ENV_KEY) else False
16
- )
12
+ return bool(os.getenv(TFY_DEBUG_ENV_KEY))
17
13
 
18
14
 
19
15
  def is_internal_env_set() -> bool:
20
- return (
21
- True
22
- if os.getenv(TFY_INTERNAL_ENV_KEY) or os.getenv(SFY_INTERNAL_ENV_KEY)
23
- else False
24
- )
16
+ return bool(os.getenv(TFY_INTERNAL_ENV_KEY))
25
17
 
26
18
 
27
19
  def get_application_fqn_from_deployment_fqn(deployment_fqn: str) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: truefoundry
3
- Version: 0.4.2rc5
3
+ Version: 0.4.3
4
4
  Summary: Truefoundry CLI
5
5
  Author: Abhishek Choudhary
6
6
  Author-email: abhishek@truefoundry.com
@@ -27,7 +27,7 @@ truefoundry/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  truefoundry/cli/__main__.py,sha256=-NkhYlT3mC5MhtekueKAvCw-sWvguj0LJRpXWzvvFjc,727
28
28
  truefoundry/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  truefoundry/common/auth_service_client.py,sha256=tZOa0NdATnItsMeTnEnUeTZQIgUJtpU-nvLdWtB4Px8,7978
30
- truefoundry/common/constants.py,sha256=JT8wcc9IxX3K_xbzXgxTp1FMQfKwnLam5XoJjhiCw1M,395
30
+ truefoundry/common/constants.py,sha256=gnswB-aK5atSRY-GE1Cji6ZCEs2FoK9n1lCX5JuQGqI,484
31
31
  truefoundry/common/credential_file_manager.py,sha256=1yEk1Zm2xS4G0VDFwKSZ4w0VUrcPWQ1nJnoBaz9xyKA,4251
32
32
  truefoundry/common/credential_provider.py,sha256=YQ6HKl8ZZFTg48vBZMauEAnM6IrEO3oOzM2DA47N-P0,4071
33
33
  truefoundry/common/entities.py,sha256=8O-EGPk4PKqnyoFMKUTxISCU19rz0KBnfRDJU695DhY,3797
@@ -41,11 +41,11 @@ truefoundry/deploy/builder/__init__.py,sha256=1qjHMNBE1poRCZW0WrG46dFM1f1IlivD53
41
41
  truefoundry/deploy/builder/builders/__init__.py,sha256=tlFLXqyDaKLd4iZbo4Hcu_8gOmgtL6drnXpbmQ6x1P8,636
42
42
  truefoundry/deploy/builder/builders/dockerfile.py,sha256=AXXTziCkaqIhuM_bwyD1vT1znOwemN1TKgU7eyo-KuM,1522
43
43
  truefoundry/deploy/builder/builders/tfy_notebook_buildpack/__init__.py,sha256=UmMcTY-8MrLY3H5owpn6ax-VePQl4MiMTmHlQ9qEtQw,1742
44
- truefoundry/deploy/builder/builders/tfy_notebook_buildpack/dockerfile_template.py,sha256=nRG3yXhIQ3Taq1B1loQWazQd05A3nrp5zKDYvNZh87s,2487
44
+ truefoundry/deploy/builder/builders/tfy_notebook_buildpack/dockerfile_template.py,sha256=IZbXsSj86SxWRZNQXepEnsOL_eYwWaOq5oh-WiyvL2c,2485
45
45
  truefoundry/deploy/builder/builders/tfy_python_buildpack/__init__.py,sha256=XNJ3MKWqyWIbFNnUQMpB8oVC5Pt5Wsm_bRKbvkXRIG8,1696
46
- truefoundry/deploy/builder/builders/tfy_python_buildpack/dockerfile_template.py,sha256=dccCNOUKbK1X8F4f2J4ddSTCturvzQKx6H23xxJdCTk,7202
46
+ truefoundry/deploy/builder/builders/tfy_python_buildpack/dockerfile_template.py,sha256=cJlQK_kgNELULcp2Q_kMWyPNmUuZdhOELDnI0rMiqRc,7473
47
47
  truefoundry/deploy/builder/constants.py,sha256=eIukBjD6I4KvEmAPpdbPlPPr76yhS-uNr3RVFkzEdgs,257
48
- truefoundry/deploy/builder/docker_service.py,sha256=vQS15790njzlFJZ3JW6txYLBdT11ltxqqpf78ZFL_Ng,5208
48
+ truefoundry/deploy/builder/docker_service.py,sha256=OI8efqK0Gnoii8bcHihpA2StwHVzsMREfBk7NvMR4hY,3950
49
49
  truefoundry/deploy/builder/utils.py,sha256=9RZnkhoHFTRUt_x3nck0aVz7cLpzA3jiwQH-ZZZrjf8,938
50
50
  truefoundry/deploy/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
51
  truefoundry/deploy/cli/cli.py,sha256=o19n7MsMzXXXG3GlpRYaxX3l9Xvtof-iPK4-y31Dw9k,2811
@@ -55,7 +55,7 @@ truefoundry/deploy/cli/commands/build_command.py,sha256=DQ7NARgkIgV4z0Zdnl3zMDKU
55
55
  truefoundry/deploy/cli/commands/build_logs_command.py,sha256=WrPOlFec_wwuzdJmKZ8mjca-oFVvxgfblcqj2LlhWJA,2804
56
56
  truefoundry/deploy/cli/commands/create_command.py,sha256=ZjA4EP1jHYuVE1zx0kN-giBr3y0sEiXnu8xMsNyD2Rg,1850
57
57
  truefoundry/deploy/cli/commands/delete_command.py,sha256=4tyIameA1pVu9uZZNJPK6rqdV-cJogf51iCCrG-9noI,2390
58
- truefoundry/deploy/cli/commands/deploy_command.py,sha256=ixn3uQoDRfJ9D8GOMwXJ9W9VbyNce9Qzb3Mx7h5InRM,4018
58
+ truefoundry/deploy/cli/commands/deploy_command.py,sha256=d2Yhgn-zTEIlFUR-IBYpt7-dsec__hsGd1no207u-Q8,4000
59
59
  truefoundry/deploy/cli/commands/get_command.py,sha256=w7h5C4bJpmHJ99rgiGg9J_X0xi8aZUeB6Q-SoZUV1tg,5979
60
60
  truefoundry/deploy/cli/commands/list_command.py,sha256=cFARY22L5xspBX7TWsx41IF4RiRMok7KBwv7hQRFXNs,4498
61
61
  truefoundry/deploy/cli/commands/login_command.py,sha256=WV4Ad8PJ2_yNfCJi1VWW2GNwU6khZ2sWZbKebxJ7oVM,1038
@@ -93,8 +93,7 @@ truefoundry/deploy/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
93
93
  truefoundry/deploy/lib/auth/servicefoundry_session.py,sha256=5TCYPunAygtn5mb0mp_VcWKEalKMKPbyWMWer-Vty2g,1916
94
94
  truefoundry/deploy/lib/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
95
95
  truefoundry/deploy/lib/clients/servicefoundry_client.py,sha256=vFrd5yeStjT_uWL3JxHrx0iAmNpuv26K7IEnsF1RMM8,26101
96
- truefoundry/deploy/lib/clients/shell_client.py,sha256=tMrc0Ha1DmGtUCJrZD8eusOzfe8R_WIe6AAH7nxL0xA,461
97
- truefoundry/deploy/lib/const.py,sha256=FCQfnO7IecB1ikQHdLGNvvubq_iF900C9l5TJtDfvFc,314
96
+ truefoundry/deploy/lib/const.py,sha256=repGJLuoMqtzeq5tCjjkN4bH187FVHVKI30BricOlvc,244
98
97
  truefoundry/deploy/lib/dao/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
99
98
  truefoundry/deploy/lib/dao/application.py,sha256=uUTFSQkLUrFCtQQgS2Jm9BpyHyhMkN4GI1yx9oJo4_E,9161
100
99
  truefoundry/deploy/lib/dao/apply.py,sha256=sXnQY6RVzLVm1fX2BKuWHAoKlKISirrcByHEhY3x4zo,2570
@@ -106,7 +105,7 @@ truefoundry/deploy/lib/messages.py,sha256=nhp0bCYf_XpUM68hTq5lBY-__vtEyV2uP7NgnJ
106
105
  truefoundry/deploy/lib/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
107
106
  truefoundry/deploy/lib/model/entity.py,sha256=8J8yd98iWtSy8giShdDRNyzbN1UgSXx4XtmZLljdWnE,8552
108
107
  truefoundry/deploy/lib/session.py,sha256=Vg6rCA315T0yS0xG4ayJ84Ia_9ZfibH8utOSwPBMAmw,4953
109
- truefoundry/deploy/lib/util.py,sha256=RlL3bjZu5Z0LU_OKYaMVfcMU8k7_rmkAp89_0CrZDLk,1520
108
+ truefoundry/deploy/lib/util.py,sha256=3TapV7yczkheC1MMMfmJDGGzTl2l6e4jCYd_Rr5aoQ8,1330
110
109
  truefoundry/deploy/lib/win32.py,sha256=1RcvPTdlOAJ48rt8rCbE2Ufha2ztRqBAE9dueNXArrY,5009
111
110
  truefoundry/deploy/python_deploy_codegen.py,sha256=Ok7ufDY2x3aMJv9KpaRqxiS-ZI-kxBWauIUHst-ug7E,4020
112
111
  truefoundry/deploy/v2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -342,7 +341,7 @@ truefoundry/workflow/map_task.py,sha256=2m3qGXQ90k9LdS45q8dqCCECc3qr8t2m_LMCVd1m
342
341
  truefoundry/workflow/python_task.py,sha256=SRXRLC4vdBqGjhkwuaY39LEWN6iPCpJAuW17URRdWTY,1128
343
342
  truefoundry/workflow/task.py,sha256=ToitYiKcNzFCtOVQwz1W8sRjbR97eVS7vQBdbgUQtKg,1779
344
343
  truefoundry/workflow/workflow.py,sha256=WaTqUjhwfAXDWu4E5ehuwAxrCbDJkoAf1oWmR2E9Qy0,4575
345
- truefoundry-0.4.2rc5.dist-info/METADATA,sha256=DHj98HZ0ufy1bGW-6FAVI-3Vwgzk3nBoybNHi4M3uB8,3101
346
- truefoundry-0.4.2rc5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
347
- truefoundry-0.4.2rc5.dist-info/entry_points.txt,sha256=TXvUxQkI6zmqJuycPsyxEIMr3oqfDjgrWj0m_9X12x4,95
348
- truefoundry-0.4.2rc5.dist-info/RECORD,,
344
+ truefoundry-0.4.3.dist-info/METADATA,sha256=GWyg6SdKw3D3tmYLGzlQ6tYsosmIVMAC0NuUMJ3qsJs,3098
345
+ truefoundry-0.4.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
346
+ truefoundry-0.4.3.dist-info/entry_points.txt,sha256=TXvUxQkI6zmqJuycPsyxEIMr3oqfDjgrWj0m_9X12x4,95
347
+ truefoundry-0.4.3.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: poetry-core 1.9.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,13 +0,0 @@
1
- import subprocess
2
-
3
- from truefoundry.logger import logger
4
-
5
-
6
- class Shell:
7
- def execute_shell_command(self, command, ip=None):
8
- logger.debug(f"executing command: {command}")
9
- try:
10
- p = subprocess.run(command, stdout=subprocess.PIPE, check=True, input=ip)
11
- return p.stdout.decode("UTF-8")
12
- except subprocess.CalledProcessError as cpe:
13
- raise Exception(f"failed to execute: {command}, error: {cpe}") from cpe