truefoundry 0.2.10__py3-none-any.whl → 0.3.0__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.

Files changed (112) hide show
  1. truefoundry/__init__.py +1 -0
  2. truefoundry/autodeploy/cli.py +31 -18
  3. truefoundry/deploy/__init__.py +112 -1
  4. truefoundry/deploy/auto_gen/models.py +1714 -0
  5. truefoundry/deploy/builder/__init__.py +134 -0
  6. truefoundry/deploy/builder/builders/__init__.py +22 -0
  7. truefoundry/deploy/builder/builders/dockerfile.py +57 -0
  8. truefoundry/deploy/builder/builders/tfy_notebook_buildpack/__init__.py +46 -0
  9. truefoundry/deploy/builder/builders/tfy_notebook_buildpack/dockerfile_template.py +66 -0
  10. truefoundry/deploy/builder/builders/tfy_python_buildpack/__init__.py +44 -0
  11. truefoundry/deploy/builder/builders/tfy_python_buildpack/dockerfile_template.py +158 -0
  12. truefoundry/deploy/builder/docker_service.py +168 -0
  13. truefoundry/deploy/cli/cli.py +21 -26
  14. truefoundry/deploy/cli/commands/__init__.py +18 -0
  15. truefoundry/deploy/cli/commands/apply_command.py +52 -0
  16. truefoundry/deploy/cli/commands/build_command.py +45 -0
  17. truefoundry/deploy/cli/commands/build_logs_command.py +89 -0
  18. truefoundry/deploy/cli/commands/create_command.py +75 -0
  19. truefoundry/deploy/cli/commands/delete_command.py +77 -0
  20. truefoundry/deploy/cli/commands/deploy_command.py +102 -0
  21. truefoundry/deploy/cli/commands/get_command.py +216 -0
  22. truefoundry/deploy/cli/commands/list_command.py +171 -0
  23. truefoundry/deploy/cli/commands/login_command.py +33 -0
  24. truefoundry/deploy/cli/commands/logout_command.py +20 -0
  25. truefoundry/deploy/cli/commands/logs_command.py +134 -0
  26. truefoundry/deploy/cli/commands/patch_application_command.py +81 -0
  27. truefoundry/deploy/cli/commands/patch_command.py +70 -0
  28. truefoundry/deploy/cli/commands/redeploy_command.py +41 -0
  29. truefoundry/deploy/cli/commands/terminate_comand.py +44 -0
  30. truefoundry/deploy/cli/commands/trigger_command.py +145 -0
  31. truefoundry/deploy/cli/config.py +10 -0
  32. truefoundry/deploy/cli/console.py +5 -0
  33. truefoundry/deploy/cli/const.py +12 -0
  34. truefoundry/deploy/cli/display_util.py +118 -0
  35. truefoundry/deploy/cli/util.py +129 -0
  36. truefoundry/deploy/core/__init__.py +7 -0
  37. truefoundry/deploy/core/login.py +9 -0
  38. truefoundry/deploy/core/logout.py +5 -0
  39. truefoundry/deploy/function_service/__init__.py +3 -0
  40. truefoundry/deploy/function_service/__main__.py +27 -0
  41. truefoundry/deploy/function_service/app.py +92 -0
  42. truefoundry/deploy/function_service/build.py +45 -0
  43. truefoundry/deploy/function_service/remote/__init__.py +6 -0
  44. truefoundry/deploy/function_service/remote/context.py +3 -0
  45. truefoundry/deploy/function_service/remote/method.py +67 -0
  46. truefoundry/deploy/function_service/remote/remote.py +144 -0
  47. truefoundry/deploy/function_service/route.py +137 -0
  48. truefoundry/deploy/function_service/service.py +113 -0
  49. truefoundry/deploy/function_service/utils.py +53 -0
  50. truefoundry/deploy/io/__init__.py +0 -0
  51. truefoundry/deploy/io/output_callback.py +23 -0
  52. truefoundry/deploy/io/rich_output_callback.py +27 -0
  53. truefoundry/deploy/json_util.py +7 -0
  54. truefoundry/deploy/lib/__init__.py +0 -0
  55. truefoundry/deploy/lib/auth/auth_service_client.py +181 -0
  56. truefoundry/deploy/lib/auth/credential_file_manager.py +115 -0
  57. truefoundry/deploy/lib/auth/credential_provider.py +131 -0
  58. truefoundry/deploy/lib/auth/servicefoundry_session.py +59 -0
  59. truefoundry/deploy/lib/clients/__init__.py +0 -0
  60. truefoundry/deploy/lib/clients/servicefoundry_client.py +746 -0
  61. truefoundry/deploy/lib/clients/shell_client.py +13 -0
  62. truefoundry/deploy/lib/clients/utils.py +41 -0
  63. truefoundry/deploy/lib/const.py +43 -0
  64. truefoundry/deploy/lib/dao/__init__.py +0 -0
  65. truefoundry/deploy/lib/dao/application.py +263 -0
  66. truefoundry/deploy/lib/dao/apply.py +80 -0
  67. truefoundry/deploy/lib/dao/version.py +33 -0
  68. truefoundry/deploy/lib/dao/workspace.py +71 -0
  69. truefoundry/deploy/lib/exceptions.py +26 -0
  70. truefoundry/deploy/lib/logs_utils.py +43 -0
  71. truefoundry/deploy/lib/messages.py +12 -0
  72. truefoundry/deploy/lib/model/__init__.py +0 -0
  73. truefoundry/deploy/lib/model/entity.py +400 -0
  74. truefoundry/deploy/lib/session.py +158 -0
  75. truefoundry/deploy/lib/util.py +90 -0
  76. truefoundry/deploy/lib/win32.py +129 -0
  77. truefoundry/deploy/v2/__init__.py +0 -0
  78. truefoundry/deploy/v2/lib/__init__.py +3 -0
  79. truefoundry/deploy/v2/lib/deploy.py +283 -0
  80. truefoundry/deploy/v2/lib/deploy_workflow.py +295 -0
  81. truefoundry/deploy/v2/lib/deployable_patched_models.py +86 -0
  82. truefoundry/deploy/v2/lib/models.py +53 -0
  83. truefoundry/deploy/v2/lib/patched_models.py +479 -0
  84. truefoundry/deploy/v2/lib/source.py +267 -0
  85. truefoundry/langchain/__init__.py +12 -1
  86. truefoundry/langchain/deprecated.py +302 -0
  87. truefoundry/langchain/truefoundry_chat.py +130 -0
  88. truefoundry/langchain/truefoundry_embeddings.py +171 -0
  89. truefoundry/langchain/truefoundry_llm.py +106 -0
  90. truefoundry/langchain/utils.py +85 -0
  91. truefoundry/logger.py +17 -0
  92. truefoundry/pydantic_v1.py +5 -0
  93. truefoundry/python_deploy_codegen.py +132 -0
  94. truefoundry/version.py +6 -0
  95. truefoundry/workflow/__init__.py +19 -0
  96. truefoundry/workflow/container_task.py +12 -0
  97. truefoundry/workflow/example/deploy.sh +1 -0
  98. truefoundry/workflow/example/hello_world_package/workflow.py +20 -0
  99. truefoundry/workflow/example/package/test_workflow.py +152 -0
  100. truefoundry/workflow/example/truefoundry.yaml +9 -0
  101. truefoundry/workflow/example/workflow.yaml +116 -0
  102. truefoundry/workflow/map_task.py +45 -0
  103. truefoundry/workflow/python_task.py +32 -0
  104. truefoundry/workflow/task.py +50 -0
  105. truefoundry/workflow/workflow.py +114 -0
  106. {truefoundry-0.2.10.dist-info → truefoundry-0.3.0.dist-info}/METADATA +27 -7
  107. truefoundry-0.3.0.dist-info/RECORD +136 -0
  108. truefoundry/deploy/cli/deploy.py +0 -165
  109. truefoundry/deploy/cli/version.py +0 -6
  110. truefoundry-0.2.10.dist-info/RECORD +0 -38
  111. {truefoundry-0.2.10.dist-info → truefoundry-0.3.0.dist-info}/WHEEL +0 -0
  112. {truefoundry-0.2.10.dist-info → truefoundry-0.3.0.dist-info}/entry_points.txt +0 -0
truefoundry/__init__.py CHANGED
@@ -0,0 +1 @@
1
+ from truefoundry.deploy.core import login, logout
@@ -13,12 +13,6 @@ from openai import OpenAI
13
13
  from rich.console import Console
14
14
  from rich.prompt import Prompt
15
15
  from rich.status import Status
16
- from servicefoundry import Build, DockerFileBuild, Job, LocalSource, Port, Service
17
- from servicefoundry.cli.const import COMMAND_CLS
18
- from servicefoundry.lib.auth.servicefoundry_session import ServiceFoundrySession
19
- from servicefoundry.lib.clients.service_foundry_client import (
20
- ServiceFoundryServiceClient,
21
- )
22
16
 
23
17
  from truefoundry.autodeploy.agents.developer import Developer
24
18
  from truefoundry.autodeploy.agents.project_identifier import (
@@ -37,6 +31,12 @@ from truefoundry.autodeploy.tools.ask import AskQuestion
37
31
  from truefoundry.autodeploy.tools.commit import CommitConfirmation
38
32
  from truefoundry.autodeploy.tools.docker_run import DockerRun, DockerRunLog
39
33
  from truefoundry.autodeploy.utils.client import get_git_binary
34
+ from truefoundry.deploy import Build, DockerFileBuild, Job, LocalSource, Port, Service
35
+ from truefoundry.deploy.cli.const import COMMAND_CLS
36
+ from truefoundry.deploy.lib.auth.servicefoundry_session import ServiceFoundrySession
37
+ from truefoundry.deploy.lib.clients.servicefoundry_client import (
38
+ ServiceFoundryServiceClient,
39
+ )
40
40
 
41
41
 
42
42
  def _get_openai_client() -> OpenAI:
@@ -58,7 +58,11 @@ def _get_openai_client() -> OpenAI:
58
58
  except requests.exceptions.HTTPError as http_error:
59
59
  if http_error.response.status_code in [401, 403]:
60
60
  raise InvalidRequirementsException(
61
- message='Unauthorized access to Truefoundry server. Please verify your credentials and ensure you have the necessary access rights.\nIf you wish to proceed without Truefoundry AI, you need to either have a truefoundry.yaml file in your project root or pass the path to a yaml file using the "--file file_name" option.'
61
+ message="Unauthorized access to TrueFoundry server. "
62
+ "Please verify your credentials and ensure you have the necessary access rights."
63
+ "\nIf you wish to proceed without TrueFoundry AI, "
64
+ "you need to either have a truefoundry.yaml file in your project root "
65
+ 'or pass the path to a yaml file using the "--file file_name" option.'
62
66
  ) from http_error
63
67
 
64
68
  raise http_error
@@ -146,7 +150,8 @@ def _check_repo(project_root_path: str, console: Console):
146
150
  repo = git.Repo(path=project_root_path, search_parent_directories=True)
147
151
  if repo.is_dirty():
148
152
  console.print(
149
- "[bold red]Error:[/] The repository has uncommitted changes. Please commit or stash them before proceeding."
153
+ "[bold red]Error:[/] The repository has uncommitted changes. "
154
+ "Please commit or stash them before proceeding."
150
155
  )
151
156
  sys.exit(1)
152
157
  current_active_branch = repo.active_branch.name
@@ -211,11 +216,13 @@ def _update_status(event, status: Status, component_type: ComponentType):
211
216
  if isinstance(event, DockerRunLog):
212
217
  if component_type == ComponentType.SERVICE:
213
218
  status.update(
214
- "[bold cyan]Running:[/] [bold magenta]TrueFoundry[/] is running your app in a Docker container. Press ctrl+c once your app is ready for testing."
219
+ "[bold cyan]Running:[/] [bold magenta]TrueFoundry[/] is running your app in a Docker container. "
220
+ "Press ctrl+c once your app is ready for testing."
215
221
  )
216
222
  else:
217
223
  status.update(
218
- "[bold cyan]Running:[/] [bold magenta]TrueFoundry[/] is running your app in a Docker container and waiting for completion."
224
+ "[bold cyan]Running:[/] [bold magenta]TrueFoundry[/] is running your app in a Docker container "
225
+ "and waiting for completion."
219
226
  )
220
227
 
221
228
 
@@ -254,8 +261,10 @@ def cli(project_root_path: str, deploy: bool, workspace_fqn: str = None):
254
261
  )
255
262
  else:
256
263
  console.print(
257
- "[dim]To use your own LLM, set the environment variables [dim italic green]AUTODEPLOY_OPENAI_BASE_URL[/],[/]",
258
- "[dim][dim italic green]AUTODEPLOY_OPENAI_API_KEY[/], and [dim italic green]AUTODEPLOY_MODEL_NAME[/] for URL, API key, and LLM model name respectively.[/]",
264
+ "[dim]To use your own LLM, "
265
+ "set the environment variables [dim italic green]AUTODEPLOY_OPENAI_BASE_URL[/],[/]",
266
+ "[dim][dim italic green]AUTODEPLOY_OPENAI_API_KEY[/], "
267
+ "and [dim italic green]AUTODEPLOY_MODEL_NAME[/] for URL, API key, and LLM model name respectively.[/]",
259
268
  )
260
269
  console.print(
261
270
  "[bold cyan]Note:[/] All changes will be committed to a new branch. Please ensure you have a repository."
@@ -264,11 +273,13 @@ def cli(project_root_path: str, deploy: bool, workspace_fqn: str = None):
264
273
  _check_repo(project_root_path=project_root_path, console=console)
265
274
 
266
275
  choices = {
267
- "Service: An application that runs continuously. Example: web servers, workers polling a job queue, etc.": "SERVICE",
268
- "Job: An application that runs once and then stops. Example: Training an ML model, running a script, etc.": "JOB",
276
+ "Service: An application that runs continuously. "
277
+ "Example: web servers, workers polling a job queue, etc.": "SERVICE",
278
+ "Job: An application that runs once and then stops. "
279
+ "Example: Training an ML model, running a script, etc.": "JOB",
269
280
  }
270
281
  component = questionary.select(
271
- "TrueFoundry: Is your project a", choices=choices.keys()
282
+ "TrueFoundry: Is your project a", choices=list(choices.keys())
272
283
  ).ask()
273
284
  component_type = ComponentType[choices[component]]
274
285
  while True:
@@ -300,8 +311,10 @@ def cli(project_root_path: str, deploy: bool, workspace_fqn: str = None):
300
311
  )
301
312
  if workspace_fqn is None:
302
313
  workspace_fqn = Prompt.ask(
303
- "[bold magenta]TrueFoundry:[/] Enter the Workspace FQN where you would like to deploy, [dim]Ex: cluster-name:workspace-name[/]"
314
+ "[bold magenta]TrueFoundry:[/] Enter the Workspace FQN where you would like to deploy, [dim]"
315
+ "Ex: cluster-name:workspace-name[/]"
304
316
  )
317
+ env = {}
305
318
  while True:
306
319
  try:
307
320
  env = _parse_env(project_root_path, env_path) if env_path else {}
@@ -340,7 +353,7 @@ def cli(project_root_path: str, deploy: bool, workspace_fqn: str = None):
340
353
  break
341
354
 
342
355
  if deploy:
343
- console.rule("[bold green]Deploying to Truefoundry[/]")
356
+ console.rule("[bold green]Deploying to TrueFoundry[/]")
344
357
  deploy_component(
345
358
  workspace_fqn=workspace_fqn,
346
359
  project_root_path=project_root_path,
@@ -367,7 +380,7 @@ def cli(project_root_path: str, deploy: bool, workspace_fqn: str = None):
367
380
  )
368
381
  def autodeploy_cli(path: str, deploy: bool):
369
382
  """
370
- Build and deploy projects using Truefoundry
383
+ Build and deploy projects using TrueFoundry
371
384
  """
372
385
  cli(
373
386
  project_root_path=path,
@@ -1 +1,112 @@
1
- from servicefoundry import * # noqa: F403
1
+ from truefoundry.deploy.auto_gen.models import (
2
+ AppProtocol,
3
+ CanaryStep,
4
+ CapacityType,
5
+ ConcurrencyPolicy,
6
+ Kustomize,
7
+ ParamType,
8
+ Protocol,
9
+ WorkbenchImage,
10
+ )
11
+ from truefoundry.deploy.lib.dao.application import (
12
+ delete_application,
13
+ get_application,
14
+ get_job_run,
15
+ list_applications,
16
+ list_job_runs,
17
+ terminate_job_run,
18
+ trigger_job,
19
+ trigger_workflow,
20
+ )
21
+ from truefoundry.deploy.lib.dao.version import (
22
+ get_version as get_application_version,
23
+ )
24
+ from truefoundry.deploy.lib.dao.version import (
25
+ list_versions as list_application_versions,
26
+ )
27
+ from truefoundry.deploy.lib.dao.workspace import (
28
+ delete_workspace,
29
+ get_workspace_by_fqn,
30
+ list_workspaces,
31
+ )
32
+ from truefoundry.deploy.v2.lib.deployable_patched_models import (
33
+ Application,
34
+ ApplicationSet,
35
+ AsyncService,
36
+ Codeserver,
37
+ Helm,
38
+ Job,
39
+ Notebook,
40
+ Service,
41
+ SSHServer,
42
+ Volume,
43
+ Workflow,
44
+ )
45
+ from truefoundry.deploy.v2.lib.patched_models import (
46
+ AMQPInputConfig,
47
+ AMQPMetricConfig,
48
+ AMQPOutputConfig,
49
+ ArtifactsCacheVolume,
50
+ ArtifactsDownload,
51
+ AsyncProcessorSidecar,
52
+ AsyncServiceAutoscaling,
53
+ Autoscaling,
54
+ AWSAccessKeyAuth,
55
+ AWSInferentia,
56
+ AWSInferentiaAccelerator,
57
+ BasicAuthCreds,
58
+ BlueGreen,
59
+ Build,
60
+ Canary,
61
+ CoreNATSOutputConfig,
62
+ CPUUtilizationMetric,
63
+ CronMetric,
64
+ CUDAVersion,
65
+ DockerFileBuild,
66
+ DynamicVolumeConfig,
67
+ Endpoint,
68
+ GcpTPU,
69
+ GitSource,
70
+ GPUType,
71
+ HealthProbe,
72
+ HelmRepo,
73
+ HttpProbe,
74
+ HuggingfaceArtifactSource,
75
+ Image,
76
+ KafkaInputConfig,
77
+ KafkaMetricConfig,
78
+ KafkaOutputConfig,
79
+ KafkaSASLAuth,
80
+ LocalSource,
81
+ Manual,
82
+ NATSInputConfig,
83
+ NATSMetricConfig,
84
+ NATSOutputConfig,
85
+ NATSUserPasswordAuth,
86
+ NodepoolSelector,
87
+ NodeSelector,
88
+ NvidiaGPU,
89
+ NvidiaMIGGPU,
90
+ NvidiaTimeslicingGPU,
91
+ OCIRepo,
92
+ Param,
93
+ Port,
94
+ PythonBuild,
95
+ RemoteSource,
96
+ Resources,
97
+ Rolling,
98
+ RPSMetric,
99
+ Schedule,
100
+ SecretMount,
101
+ ServiceAutoscaling,
102
+ SQSInputConfig,
103
+ SQSOutputConfig,
104
+ SQSQueueMetricConfig,
105
+ StaticVolumeConfig,
106
+ StringDataMount,
107
+ TPUType,
108
+ TruefoundryArtifactSource,
109
+ VolumeBrowser,
110
+ VolumeMount,
111
+ WorkerConfig,
112
+ )