apolo-app-types 25.4.3__tar.gz

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.
Files changed (80) hide show
  1. apolo_app_types-25.4.3/PKG-INFO +33 -0
  2. apolo_app_types-25.4.3/README.md +3 -0
  3. apolo_app_types-25.4.3/pyproject.toml +163 -0
  4. apolo_app_types-25.4.3/src/apolo_app_types/__init__.py +159 -0
  5. apolo_app_types-25.4.3/src/apolo_app_types/app_types.py +70 -0
  6. apolo_app_types-25.4.3/src/apolo_app_types/cli.py +50 -0
  7. apolo_app_types-25.4.3/src/apolo_app_types/clients/__init__.py +0 -0
  8. apolo_app_types-25.4.3/src/apolo_app_types/clients/kube.py +106 -0
  9. apolo_app_types-25.4.3/src/apolo_app_types/helm/__init__.py +0 -0
  10. apolo_app_types-25.4.3/src/apolo_app_types/helm/apps/__init__.py +14 -0
  11. apolo_app_types-25.4.3/src/apolo_app_types/helm/apps/base.py +32 -0
  12. apolo_app_types-25.4.3/src/apolo_app_types/helm/apps/common.py +264 -0
  13. apolo_app_types-25.4.3/src/apolo_app_types/helm/apps/custom_deployment.py +133 -0
  14. apolo_app_types-25.4.3/src/apolo_app_types/helm/apps/dockerhub.py +42 -0
  15. apolo_app_types-25.4.3/src/apolo_app_types/helm/apps/fooocus.py +119 -0
  16. apolo_app_types-25.4.3/src/apolo_app_types/helm/apps/ingress.py +90 -0
  17. apolo_app_types-25.4.3/src/apolo_app_types/helm/apps/llm.py +185 -0
  18. apolo_app_types-25.4.3/src/apolo_app_types/helm/apps/postgres.py +231 -0
  19. apolo_app_types-25.4.3/src/apolo_app_types/helm/apps/spark_job.py +191 -0
  20. apolo_app_types-25.4.3/src/apolo_app_types/helm/apps/stable_diffusion.py +88 -0
  21. apolo_app_types-25.4.3/src/apolo_app_types/helm/apps/weaviate.py +133 -0
  22. apolo_app_types-25.4.3/src/apolo_app_types/helm/utils/__init__.py +0 -0
  23. apolo_app_types-25.4.3/src/apolo_app_types/helm/utils/credentials.py +28 -0
  24. apolo_app_types-25.4.3/src/apolo_app_types/helm/utils/deep_merging.py +24 -0
  25. apolo_app_types-25.4.3/src/apolo_app_types/helm/utils/images.py +51 -0
  26. apolo_app_types-25.4.3/src/apolo_app_types/helm/utils/storage.py +13 -0
  27. apolo_app_types-25.4.3/src/apolo_app_types/inputs/__init__.py +0 -0
  28. apolo_app_types-25.4.3/src/apolo_app_types/inputs/args.py +100 -0
  29. apolo_app_types-25.4.3/src/apolo_app_types/outputs/__init__.py +0 -0
  30. apolo_app_types-25.4.3/src/apolo_app_types/outputs/custom_deployment.py +42 -0
  31. apolo_app_types-25.4.3/src/apolo_app_types/outputs/dockerhub.py +29 -0
  32. apolo_app_types-25.4.3/src/apolo_app_types/outputs/huggingface_cache.py +22 -0
  33. apolo_app_types-25.4.3/src/apolo_app_types/outputs/llm.py +71 -0
  34. apolo_app_types-25.4.3/src/apolo_app_types/outputs/postgres.py +64 -0
  35. apolo_app_types-25.4.3/src/apolo_app_types/outputs/spark_job.py +11 -0
  36. apolo_app_types-25.4.3/src/apolo_app_types/outputs/stable_diffusion.py +45 -0
  37. apolo_app_types-25.4.3/src/apolo_app_types/outputs/update_outputs.py +76 -0
  38. apolo_app_types-25.4.3/src/apolo_app_types/outputs/utils/__init__.py +0 -0
  39. apolo_app_types-25.4.3/src/apolo_app_types/outputs/utils/ingress.py +37 -0
  40. apolo_app_types-25.4.3/src/apolo_app_types/outputs/utils/parsing.py +18 -0
  41. apolo_app_types-25.4.3/src/apolo_app_types/outputs/weaviate.py +94 -0
  42. apolo_app_types-25.4.3/src/apolo_app_types/protocols/__init__.py +0 -0
  43. apolo_app_types-25.4.3/src/apolo_app_types/protocols/apolo_deploy.py +11 -0
  44. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/__init__.py +69 -0
  45. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/abc_.py +55 -0
  46. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/auth.py +28 -0
  47. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/autoscaling.py +24 -0
  48. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/buckets.py +128 -0
  49. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/containers.py +20 -0
  50. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/hugging_face.py +49 -0
  51. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/ingress.py +36 -0
  52. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/k8s.py +56 -0
  53. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/networking.py +41 -0
  54. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/postgres.py +33 -0
  55. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/preset.py +19 -0
  56. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/py.typed +0 -0
  57. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/redis.py +9 -0
  58. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/schema_extra.py +20 -0
  59. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/secrets_.py +45 -0
  60. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/storage.py +125 -0
  61. apolo_app_types-25.4.3/src/apolo_app_types/protocols/common/validator.py +26 -0
  62. apolo_app_types-25.4.3/src/apolo_app_types/protocols/custom_deployment.py +39 -0
  63. apolo_app_types-25.4.3/src/apolo_app_types/protocols/dify.py +44 -0
  64. apolo_app_types-25.4.3/src/apolo_app_types/protocols/dockerhub.py +61 -0
  65. apolo_app_types-25.4.3/src/apolo_app_types/protocols/fooocus.py +54 -0
  66. apolo_app_types-25.4.3/src/apolo_app_types/protocols/huggingface_cache.py +9 -0
  67. apolo_app_types-25.4.3/src/apolo_app_types/protocols/jupyter.py +19 -0
  68. apolo_app_types-25.4.3/src/apolo_app_types/protocols/llm.py +130 -0
  69. apolo_app_types-25.4.3/src/apolo_app_types/protocols/mlflow.py +16 -0
  70. apolo_app_types-25.4.3/src/apolo_app_types/protocols/postgres.py +125 -0
  71. apolo_app_types-25.4.3/src/apolo_app_types/protocols/private_gpt.py +29 -0
  72. apolo_app_types-25.4.3/src/apolo_app_types/protocols/py.typed +0 -0
  73. apolo_app_types-25.4.3/src/apolo_app_types/protocols/pycharm.py +10 -0
  74. apolo_app_types-25.4.3/src/apolo_app_types/protocols/shell.py +10 -0
  75. apolo_app_types-25.4.3/src/apolo_app_types/protocols/spark_job.py +189 -0
  76. apolo_app_types-25.4.3/src/apolo_app_types/protocols/stable_diffusion.py +81 -0
  77. apolo_app_types-25.4.3/src/apolo_app_types/protocols/text_embeddings.py +24 -0
  78. apolo_app_types-25.4.3/src/apolo_app_types/protocols/vscode.py +10 -0
  79. apolo_app_types-25.4.3/src/apolo_app_types/protocols/weaviate.py +75 -0
  80. apolo_app_types-25.4.3/src/apolo_app_types/py.typed +0 -0
@@ -0,0 +1,33 @@
1
+ Metadata-Version: 2.3
2
+ Name: apolo-app-types
3
+ Version: 25.4.3
4
+ Summary: Apolo Platform App Types.
5
+ License: Apache 2
6
+ Author: Apolo.us
7
+ Requires-Python: >=3.9.0,<4.0
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Information Technology
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Topic :: Software Development
19
+ Classifier: Topic :: Utilities
20
+ Requires-Dist: apolo-sdk (>=24.12.3,<25.0.0)
21
+ Requires-Dist: click (>=8.0.3,<9.0.0)
22
+ Requires-Dist: httpx (>=0.28.0,<0.29.0)
23
+ Requires-Dist: kubernetes (>=31.0.0,<32.0.0)
24
+ Requires-Dist: pydantic (>=2.9.2,<3.0.0)
25
+ Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
26
+ Requires-Dist: types-PyYAML (>=6.0.12.20241230,<7.0.0.0)
27
+ Requires-Dist: yarl (>=1.18.3,<2.0.0)
28
+ Description-Content-Type: text/markdown
29
+
30
+ # Preface
31
+
32
+ Apolo app types https://apolo.us/.
33
+
@@ -0,0 +1,3 @@
1
+ # Preface
2
+
3
+ Apolo app types https://apolo.us/.
@@ -0,0 +1,163 @@
1
+ [build-system]
2
+ requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
3
+ build-backend = "poetry_dynamic_versioning.backend"
4
+
5
+ [project]
6
+ name = "apolo-app-types"
7
+ description = "Apolo Platform App Types."
8
+ readme = "README.md"
9
+ license = "Apache 2"
10
+ authors = [{name = "Apolo.us"}]
11
+ classifiers = [
12
+ "Development Status :: 4 - Beta",
13
+ "Environment :: Console",
14
+ "Intended Audience :: Developers",
15
+ "Intended Audience :: Information Technology",
16
+ "Intended Audience :: Science/Research",
17
+ "License :: OSI Approved :: Apache Software License",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3 :: Only",
21
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
22
+ "Topic :: Software Development",
23
+ "Topic :: Utilities"
24
+ ]
25
+ dynamic = []
26
+ requires-python = ">=3.9.0,<4.0"
27
+ version = "25.4.3"
28
+
29
+ [project.scripts]
30
+ app-types = "apolo_app_types.cli:cli"
31
+
32
+ [tool.poetry]
33
+ packages = [
34
+ { include = "apolo_app_types", from = "src" },
35
+ ]
36
+
37
+ [tool.poetry.dependencies]
38
+ apolo-sdk = "^24.12.3"
39
+ click = "^8.0.3"
40
+ httpx = "^0.28.0"
41
+ kubernetes = "^31.0.0"
42
+ pydantic = "^2.9.2"
43
+ pyyaml = "^6.0.2"
44
+ types-PyYAML = "^6.0.12.20241230"
45
+ yarl = "^1.18.3"
46
+
47
+ [tool.poetry-dynamic-versioning]
48
+ enable = false
49
+ vcs = "git"
50
+
51
+ [tool.poetry.group.dev]
52
+ optional = true
53
+
54
+ [tool.poetry.group.dev.dependencies]
55
+ pre-commit = "^4.0.1"
56
+ pytest = "^8.3.4"
57
+ pytest-asyncio = "^0.25.3"
58
+ pytest-cov = "^6.0.0"
59
+ mypy = "^1.15.0"
60
+
61
+ [tool.ruff]
62
+ target-version = "py311"
63
+ lint.select = [
64
+ "E", "F", "I", "C90", "UP", "B", "ASYNC", "N", "FBT", "A", "C4", "EM", "FA", "ICN",
65
+ "G", "PIE", "T20", "PYI", "PT", "RET", "PTH"
66
+ ]
67
+ lint.ignore = [
68
+ "A003", # Class attribute "..." is shadowing a Python builtin
69
+ "N818"
70
+ ]
71
+
72
+ [tool.ruff.lint.isort.sections]
73
+ ApoloSDK = ["apolo-sdk"]
74
+
75
+ [tool.ruff.lint.isort]
76
+ combine-as-imports = true
77
+ lines-after-imports = 2
78
+ #profile = "black"
79
+ section-order = ["future", "standard-library", "third-party", "ApoloSDK", "first-party", "local-folder"]
80
+ known-first-party = ["apolo_app_types"]
81
+ known-local-folder = ["tests"]
82
+
83
+ [tool.mypy]
84
+ check_untyped_defs = true
85
+ disallow_any_generics = true
86
+ disallow_untyped_defs = true
87
+ follow_imports = "silent"
88
+ strict_optional = true
89
+ warn_redundant_casts = true
90
+ warn_unused_ignores = true
91
+ warn_unused_configs = true
92
+ plugins = ['pydantic.mypy']
93
+
94
+
95
+ [[tool.mypy.overrides]]
96
+ module = "pytest"
97
+ ignore_missing_imports = true
98
+
99
+ [[tool.mypy.overrides]]
100
+ module = "aiodocker.*"
101
+ ignore_missing_imports = true
102
+
103
+ [tool.flake8]
104
+ extend-exclude = [
105
+ ".git",
106
+ ".env",
107
+ "__pycache__",
108
+ ".eggs",
109
+ ]
110
+ max-line-length = 88
111
+ extend-ignore = [
112
+ "N801",
113
+ "N802",
114
+ "N803",
115
+ "E252",
116
+ "W503", # line break before binary operator (conflicts with Black)
117
+ "E133",
118
+ "E203", # whitespace before ':' (conflicts with Black)
119
+ "F541",
120
+ ]
121
+
122
+ [tool.coverage.report]
123
+ fail_under = 0
124
+ skip_empty = true
125
+ sort = "-cover"
126
+ omit = [
127
+ "build-tools/*",
128
+ "tests/*",
129
+ ]
130
+
131
+ [tool.pytest.ini_options]
132
+ asyncio_mode = "auto"
133
+ asyncio_default_fixture_loop_scope = "session"
134
+ log_cli = false
135
+ log_level = "INFO"
136
+ junit_family = "xunit2"
137
+ testpaths = [
138
+ "tests/",
139
+ ]
140
+ markers = [
141
+ "e2e",
142
+ "e2e_job",
143
+ "require_admin",
144
+ "xdist_group",
145
+ ]
146
+ filterwarnings = [
147
+ "error",
148
+ "ignore:.*PROTOCOL_TLS is deprecated:DeprecationWarning:apolo_sdk",
149
+ "ignore:.*PROTOCOL_TLS is deprecated:DeprecationWarning:tests",
150
+ "ignore:.*PROTOCOL_TLS is deprecated:DeprecationWarning:aiohttp",
151
+ "ignore:Inheritance class AuthorizedSession from ClientSession is discouraged:DeprecationWarning:google",
152
+ "ignore:returning HTTPException object is deprecated.+:DeprecationWarning:aiodocker",
153
+ "ignore:ssl_context is deprecated.+:DeprecationWarning:aiodocker",
154
+ "ignore:the imp module is deprecated.+:DeprecationWarning:past",
155
+ "ignore:Flags not at the start of the expression.+:DeprecationWarning:cookiecutter",
156
+ "ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working:DeprecationWarning:jinja2",
157
+ "ignore:(rm_rf) error removing.+:UserWarning:pytest",
158
+ "ignore::ResourceWarning:asyncio",
159
+ "ignore::UserWarning:_pytest",
160
+ "ignore:The loop argument is deprecated*:DeprecationWarning:asyncio",
161
+ "ignore:'autocompletion' is renamed to 'shell_complete'.+:DeprecationWarning:click",
162
+ "ignore:.*pkg_resources.declare_namespace.*:DeprecationWarning:pkg_resources",
163
+ ]
@@ -0,0 +1,159 @@
1
+ from apolo_app_types.protocols.apolo_deploy import ApoloDeployInputs, ApoloDeployOutputs
2
+ from apolo_app_types.protocols.common import (
3
+ ApoloFilesMount,
4
+ ApoloSecret,
5
+ AppInputs,
6
+ AppInputsDeployer,
7
+ AppOutputs,
8
+ AppOutputsDeployer,
9
+ BasicAuth,
10
+ Bucket,
11
+ Env,
12
+ HuggingFaceModel,
13
+ OptionalStrOrSecret,
14
+ StrOrSecret,
15
+ )
16
+ from apolo_app_types.protocols.custom_deployment import (
17
+ Container,
18
+ ContainerImage,
19
+ CustomDeploymentInputs,
20
+ CustomDeploymentOutputs,
21
+ Service,
22
+ )
23
+ from apolo_app_types.protocols.dify import (
24
+ DifyApi,
25
+ DifyInputs,
26
+ DifyOutputs,
27
+ DifyProxy,
28
+ DifyWeb,
29
+ DifyWorker,
30
+ )
31
+ from apolo_app_types.protocols.dockerhub import (
32
+ DockerConfigModel,
33
+ DockerHubInputs,
34
+ DockerHubOutputs,
35
+ )
36
+ from apolo_app_types.protocols.fooocus import (
37
+ FooocusAppInputs,
38
+ FooocusInputs,
39
+ FooocusOutputs,
40
+ )
41
+ from apolo_app_types.protocols.huggingface_cache import (
42
+ HuggingFaceCacheInputs,
43
+ HuggingFaceCacheOutputs,
44
+ )
45
+ from apolo_app_types.protocols.jupyter import (
46
+ JupyterInputs,
47
+ JupyterOutputs,
48
+ JupyterTypes,
49
+ )
50
+ from apolo_app_types.protocols.llm import (
51
+ LLMInputs,
52
+ OpenAICompatibleAPI,
53
+ OpenAICompatibleChatAPI,
54
+ OpenAICompatibleCompletionsAPI,
55
+ OpenAICompatibleEmbeddingsAPI,
56
+ VLLMOutputs,
57
+ VLLMOutputsV2,
58
+ )
59
+ from apolo_app_types.protocols.mlflow import MLFlowInputs, MLFlowOutputs
60
+ from apolo_app_types.protocols.postgres import (
61
+ CrunchyPostgresOutputs,
62
+ CrunchyPostgresUserCredentials,
63
+ PGBouncer,
64
+ PostgresConfig,
65
+ PostgresInputs,
66
+ PostgresOutputs,
67
+ )
68
+ from apolo_app_types.protocols.private_gpt import PrivateGPTInputs, PrivateGPTOutputs
69
+ from apolo_app_types.protocols.pycharm import PycharmInputs, PycharmOutputs
70
+ from apolo_app_types.protocols.shell import ShellInputs, ShellOutputs
71
+ from apolo_app_types.protocols.spark_job import SparkJobInputs, SparkJobOutputs
72
+ from apolo_app_types.protocols.stable_diffusion import (
73
+ SDModel,
74
+ SDOutputs,
75
+ StableDiffusionInputs,
76
+ StableDiffusionOutputs,
77
+ TextToImgAPI,
78
+ )
79
+ from apolo_app_types.protocols.text_embeddings import (
80
+ TextEmbeddingsInferenceInputs,
81
+ TextEmbeddingsInferenceOutputs,
82
+ )
83
+ from apolo_app_types.protocols.vscode import VSCodeInputs, VSCodeOutputs
84
+ from apolo_app_types.protocols.weaviate import WeaviateInputs, WeaviateOutputs
85
+
86
+
87
+ __all__ = [
88
+ "AppInputs",
89
+ "AppOutputs",
90
+ "DifyApi",
91
+ "DifyInputs",
92
+ "DifyOutputs",
93
+ "DifyProxy",
94
+ "DifyWeb",
95
+ "DifyWorker",
96
+ "PycharmInputs",
97
+ "PycharmOutputs",
98
+ "VSCodeInputs",
99
+ "VSCodeOutputs",
100
+ "FooocusInputs",
101
+ "FooocusOutputs",
102
+ "JupyterInputs",
103
+ "JupyterOutputs",
104
+ "LLMInputs",
105
+ "VLLMOutputs",
106
+ "MLFlowInputs",
107
+ "MLFlowOutputs",
108
+ "PostgresInputs",
109
+ "CrunchyPostgresOutputs",
110
+ "ShellInputs",
111
+ "ShellOutputs",
112
+ "SDOutputs",
113
+ "StableDiffusionInputs",
114
+ "TextEmbeddingsInferenceInputs",
115
+ "TextEmbeddingsInferenceOutputs",
116
+ "WeaviateInputs",
117
+ "WeaviateOutputs",
118
+ "OpenAICompatibleEmbeddingsAPI",
119
+ "OpenAICompatibleAPI",
120
+ "OpenAICompatibleChatAPI",
121
+ "OpenAICompatibleCompletionsAPI",
122
+ "TextToImgAPI",
123
+ "CrunchyPostgresUserCredentials",
124
+ "SDModel",
125
+ "BasicAuth",
126
+ "ApoloDeployInputs",
127
+ "ApoloDeployOutputs",
128
+ "JupyterTypes",
129
+ "PrivateGPTInputs",
130
+ "PrivateGPTOutputs",
131
+ "ApoloSecret",
132
+ "StrOrSecret",
133
+ "OptionalStrOrSecret",
134
+ "StableDiffusionOutputs",
135
+ "HuggingFaceModel",
136
+ "VLLMOutputsV2",
137
+ "AppInputsDeployer",
138
+ "PGBouncer",
139
+ "PostgresConfig",
140
+ "DockerHubInputs",
141
+ "DockerHubOutputs",
142
+ "DockerConfigModel",
143
+ "ApoloFilesMount",
144
+ "HuggingFaceCacheInputs",
145
+ "HuggingFaceCacheOutputs",
146
+ "CustomDeploymentInputs",
147
+ "CustomDeploymentOutputs",
148
+ "ContainerImage",
149
+ "Container",
150
+ "Service",
151
+ "Env",
152
+ "AppOutputsDeployer",
153
+ "PostgresOutputs",
154
+ "SparkJobInputs",
155
+ "SparkJobOutputs",
156
+ "FooocusAppInputs",
157
+ "ApoloFilesMount",
158
+ "Bucket",
159
+ ]
@@ -0,0 +1,70 @@
1
+ import enum
2
+
3
+ from apolo_app_types import StableDiffusionInputs
4
+ from apolo_app_types.protocols.common import AppInputs
5
+ from apolo_app_types.protocols.dockerhub import DockerHubInputs
6
+ from apolo_app_types.protocols.huggingface_cache import (
7
+ HuggingFaceCacheInputs,
8
+ )
9
+ from apolo_app_types.protocols.llm import LLMInputs
10
+ from apolo_app_types.protocols.spark_job import SparkJobInputs
11
+ from apolo_app_types.protocols.weaviate import WeaviateInputs
12
+
13
+
14
+ class AppType(enum.StrEnum):
15
+ PostgreSQL = "postgresql"
16
+ TextEmbeddingsInference = "text-embeddings-inference"
17
+ LLMInference = "llm-inference"
18
+ PrivateGPT = "private-gpt"
19
+ Dify = "dify"
20
+ StableDiffusion = "stable-diffusion"
21
+ Weaviate = "weaviate"
22
+ Fooocus = "fooocus"
23
+ Jupyter = "jupyter"
24
+ VSCode = "vscode"
25
+ Pycharm = "pycharm"
26
+ MLFlow = "mlflow"
27
+ Shell = "shell"
28
+ ApoloDeploy = "apolo-deploy"
29
+ DockerHub = "dockerhub"
30
+ HuggingFaceCache = "huggingface-cache"
31
+ CustomDeployment = "custom-deployment"
32
+ SparkJob = "spark-job"
33
+
34
+ def __repr__(self) -> str:
35
+ return str(self)
36
+
37
+ def deploys_as_job(self) -> bool:
38
+ return self in {
39
+ AppType.PrivateGPT,
40
+ AppType.Fooocus,
41
+ AppType.Jupyter,
42
+ AppType.VSCode,
43
+ AppType.Pycharm,
44
+ AppType.MLFlow,
45
+ AppType.Shell,
46
+ AppType.ApoloDeploy,
47
+ }
48
+
49
+ def is_appless(self) -> bool:
50
+ return self in {
51
+ AppType.HuggingFaceCache,
52
+ }
53
+
54
+ @classmethod
55
+ def from_app_inputs(cls, inputs: AppInputs) -> "AppType":
56
+ if isinstance(inputs, LLMInputs):
57
+ return AppType.LLMInference
58
+ if isinstance(inputs, WeaviateInputs):
59
+ return AppType.Weaviate
60
+ if isinstance(inputs, StableDiffusionInputs):
61
+ return AppType.StableDiffusion
62
+ if isinstance(inputs, DockerHubInputs):
63
+ return AppType.DockerHub
64
+ if isinstance(inputs, HuggingFaceCacheInputs):
65
+ return AppType.HuggingFaceCache
66
+ if isinstance(inputs, SparkJobInputs):
67
+ return AppType.SparkJob
68
+
69
+ error_message = f"Unsupported input type: {type(inputs).__name__}"
70
+ raise ValueError(error_message)
@@ -0,0 +1,50 @@
1
+ import asyncio
2
+ import json
3
+ import logging
4
+ import os
5
+ import sys
6
+
7
+ import click
8
+
9
+ from apolo_app_types.outputs.update_outputs import update_app_outputs
10
+
11
+
12
+ log_level = os.getenv("LOG_LEVEL", "INFO").upper()
13
+
14
+ logging.basicConfig(
15
+ level=log_level,
16
+ format="%(asctime)s - %(levelname)s - %(message)s",
17
+ handlers=[logging.StreamHandler(sys.stdout)],
18
+ )
19
+
20
+ logger = logging.getLogger(__name__)
21
+
22
+
23
+ @click.group()
24
+ def cli() -> None:
25
+ pass
26
+
27
+
28
+ @cli.command("update-outputs", context_settings={"ignore_unknown_options": True})
29
+ @click.argument("helm_outputs_json", type=str)
30
+ def update_outputs(
31
+ helm_outputs_json: str,
32
+ ) -> None:
33
+ try:
34
+ logger.info("Helm input: %s", helm_outputs_json)
35
+ helm_outputs_dict = json.loads(helm_outputs_json)
36
+ logger.info("Helm outputs: %s", helm_outputs_dict)
37
+ result = asyncio.run(update_app_outputs(helm_outputs_dict))
38
+ if not result:
39
+ m = "Failed to run update_app_outputs"
40
+ raise Exception(m)
41
+ except json.JSONDecodeError as e:
42
+ logger.error("Failed to parse JSON input: %s", e)
43
+ sys.exit(1)
44
+ except Exception as e:
45
+ logger.error("An error occurred: %s", e)
46
+ sys.exit(1)
47
+
48
+
49
+ if __name__ == "__main__":
50
+ cli()
@@ -0,0 +1,106 @@
1
+ import logging
2
+ import typing
3
+ from pathlib import Path
4
+
5
+ from kubernetes import client, config # type: ignore
6
+ from kubernetes.client.rest import ApiException # type: ignore
7
+
8
+
9
+ logger = logging.getLogger(__name__)
10
+
11
+ SERVICE_ACC_NAMESPACE_FILE = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"
12
+
13
+
14
+ def get_current_namespace() -> str:
15
+ """
16
+ Retrieve the current namespace from the Kubernetes service account namespace file.
17
+ """
18
+ try:
19
+ with Path.open(Path(SERVICE_ACC_NAMESPACE_FILE)) as f:
20
+ return f.read().strip()
21
+ except FileNotFoundError:
22
+ logger.error("Namespace file not found. Are you running in a Kubernetes pod?")
23
+ raise
24
+ except Exception as e:
25
+ err_msg = f"Error while reading namespace file: {e}"
26
+ logger.error(err_msg)
27
+ raise
28
+
29
+
30
+ async def get_ingresses_as_dict(label_selectors: str) -> dict[str, typing.Any]:
31
+ try:
32
+ config.load_incluster_config()
33
+
34
+ networking_v1 = client.NetworkingV1Api()
35
+ namespace = get_current_namespace()
36
+ ingresses = networking_v1.list_namespaced_ingress(
37
+ namespace=namespace, label_selector=label_selectors
38
+ )
39
+
40
+ return client.ApiClient().sanitize_for_serialization(ingresses)
41
+
42
+ except ApiException as e:
43
+ err_msg = (
44
+ f"Exception when calling NetworkingV1Api->list_namespaced_ingress: {e}"
45
+ )
46
+ logger.error(err_msg)
47
+ raise e
48
+
49
+
50
+ async def get_services_by_label(label_selectors: str) -> dict[str, typing.Any]:
51
+ try:
52
+ config.load_incluster_config()
53
+
54
+ v1 = client.CoreV1Api()
55
+ namespace = get_current_namespace()
56
+ services = v1.list_namespaced_service(
57
+ namespace=namespace, label_selector=label_selectors
58
+ )
59
+
60
+ return client.ApiClient().sanitize_for_serialization(services)
61
+
62
+ except ApiException as e:
63
+ err_msg = f"Exception when calling CoreV1Api->list_namespaced_service: {e}"
64
+ logger.error(err_msg)
65
+ raise e
66
+
67
+
68
+ async def get_services(match_labels: dict[str, str]) -> list[dict[str, typing.Any]]:
69
+ label_selectors = ",".join(f"{k}={v}" for k, v in match_labels.items())
70
+ get_svc_stdout = await get_services_by_label(label_selectors)
71
+
72
+ return get_svc_stdout["items"]
73
+
74
+
75
+ async def get_service_host_port(match_labels: dict[str, str]) -> tuple[str, str]:
76
+ services = await get_services(match_labels)
77
+ if not services:
78
+ msg = f"Service with labels {match_labels} not found"
79
+ raise Exception(msg)
80
+ if len(services) > 1:
81
+ msg = f"Multiple services with labels {match_labels} found"
82
+ logger.warning(msg)
83
+
84
+ service = services[0]
85
+ host = f"{service['metadata']['name']}.{service['metadata']['namespace']}"
86
+ post = str(service["spec"]["ports"][0]["port"])
87
+
88
+ return host, post
89
+
90
+
91
+ async def get_secret(label: str) -> typing.Any:
92
+ try:
93
+ config.load_incluster_config()
94
+
95
+ v1 = client.CoreV1Api()
96
+ namespace = get_current_namespace()
97
+
98
+ return v1.list_namespaced_secret(
99
+ namespace=namespace,
100
+ label_selector=label,
101
+ )
102
+
103
+ except ApiException as e:
104
+ err_msg = f"Exception when calling CoreV1Api->read_namespaced_secret: {e}"
105
+ logger.error(err_msg)
106
+ raise e
@@ -0,0 +1,14 @@
1
+ from .base import BaseChartValueProcessor
2
+ from .common import parse_chart_values_simple
3
+ from .custom_deployment import CustomDeploymentChartValueProcessor
4
+ from .llm import LLMChartValueProcessor
5
+ from .stable_diffusion import StableDiffusionChartValueProcessor
6
+
7
+
8
+ __all__ = [
9
+ "BaseChartValueProcessor",
10
+ "LLMChartValueProcessor",
11
+ "StableDiffusionChartValueProcessor",
12
+ "parse_chart_values_simple",
13
+ "CustomDeploymentChartValueProcessor",
14
+ ]
@@ -0,0 +1,32 @@
1
+ import abc
2
+ import logging
3
+ import typing as t
4
+
5
+ import apolo_sdk
6
+
7
+ from apolo_app_types import AppInputs
8
+
9
+
10
+ logger = logging.getLogger()
11
+
12
+ AppInputT = t.TypeVar("AppInputT", bound="AppInputs")
13
+
14
+
15
+ class BaseChartValueProcessor(abc.ABC, t.Generic[AppInputT]):
16
+ def __init__(self, client: apolo_sdk.Client):
17
+ self.client = client
18
+
19
+ async def gen_extra_helm_args(self, *_: t.Any) -> list[str]:
20
+ return ["--timeout", "15m", "--dependency-update"]
21
+
22
+ @abc.abstractmethod
23
+ async def gen_extra_values(
24
+ self,
25
+ input_: AppInputT,
26
+ app_name: str,
27
+ namespace: str,
28
+ app_secrets_name: str,
29
+ *args: t.Any,
30
+ **kwargs: t.Any,
31
+ ) -> dict[str, t.Any]:
32
+ raise NotImplementedError