forktex-cloud 0.2.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.
@@ -0,0 +1,120 @@
1
+ # Copyright (C) 2026 FORKTEX S.R.L.
2
+ #
3
+ # SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-ForkTex-Commercial
4
+ #
5
+ # This file is part of forktex-cloud.
6
+ #
7
+ # For commercial licensing -- including use in proprietary products, SaaS
8
+ # deployments, or any context where AGPL obligations cannot be met -- you
9
+ # MUST obtain a commercial license from FORKTEX S.R.L. (info@forktex.com).
10
+ #
11
+ # This program is free software: you can redistribute it and/or modify
12
+ # it under the terms of the GNU Affero General Public License as published by
13
+ # the Free Software Foundation, either version 3 of the License, or
14
+ # (at your option) any later version.
15
+ #
16
+ # This program is distributed in the hope that it will be useful,
17
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ # GNU Affero General Public License for more details.
20
+ #
21
+ # You should have received a copy of the GNU Affero General Public License
22
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
23
+
24
+ """Shared auto-config defaults for persistence services.
25
+
26
+ Used by the dev compose generator to auto-detect healthchecks, volumes,
27
+ and ports for known database images.
28
+ """
29
+
30
+ from __future__ import annotations
31
+
32
+ from typing import Any
33
+
34
+ PERSISTENCE_DEFAULTS: dict[str, dict[str, Any]] = {
35
+ "postgres": {
36
+ "healthcheck": {
37
+ "test": ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER:-postgres}"],
38
+ "interval": "30s",
39
+ "timeout": "10s",
40
+ "retries": 5,
41
+ },
42
+ "default_port": 5432,
43
+ "default_volume": "/var/lib/postgresql/data",
44
+ },
45
+ "mysql": {
46
+ "healthcheck": {
47
+ "test": ["CMD-SHELL", "mysqladmin ping -h localhost"],
48
+ "interval": "30s",
49
+ "timeout": "10s",
50
+ "retries": 5,
51
+ },
52
+ "default_port": 3306,
53
+ "default_volume": "/var/lib/mysql",
54
+ },
55
+ "mariadb": {
56
+ "healthcheck": {
57
+ "test": ["CMD-SHELL", "healthcheck.sh --connect --innodb_initialized"],
58
+ "interval": "30s",
59
+ "timeout": "10s",
60
+ "retries": 5,
61
+ },
62
+ "default_port": 3306,
63
+ "default_volume": "/var/lib/mysql",
64
+ },
65
+ "redis": {
66
+ "healthcheck": {
67
+ "test": ["CMD", "redis-cli", "ping"],
68
+ "interval": "30s",
69
+ "timeout": "10s",
70
+ "retries": 5,
71
+ },
72
+ "default_port": 6379,
73
+ "default_volume": "/data",
74
+ },
75
+ "mongo": {
76
+ "healthcheck": {
77
+ "test": ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"],
78
+ "interval": "30s",
79
+ "timeout": "10s",
80
+ "retries": 5,
81
+ },
82
+ "default_port": 27017,
83
+ "default_volume": "/data/db",
84
+ },
85
+ "qdrant": {
86
+ "healthcheck": {
87
+ "test": ["CMD-SHELL", "bash -c 'echo > /dev/tcp/localhost/6333'"],
88
+ "interval": "5s",
89
+ "timeout": "5s",
90
+ "retries": 10,
91
+ },
92
+ "default_port": 6333,
93
+ "default_volume": "/qdrant/storage",
94
+ },
95
+ "memcached": {
96
+ "healthcheck": {
97
+ "test": ["CMD-SHELL", "echo stats | nc localhost 11211 | grep pid"],
98
+ "interval": "30s",
99
+ "timeout": "10s",
100
+ "retries": 5,
101
+ },
102
+ "default_port": 11211,
103
+ "default_volume": "",
104
+ },
105
+ }
106
+
107
+
108
+ def detect_persistence_defaults(image: str) -> dict[str, Any] | None:
109
+ """Match image name against known persistence patterns.
110
+
111
+ Returns a dict with ``healthcheck``, ``default_port``, and ``default_volume``
112
+ if the image matches a known persistence engine, otherwise ``None``.
113
+ """
114
+ image_base = image.split(":")[0].split("/")[-1]
115
+
116
+ for key, defaults in PERSISTENCE_DEFAULTS.items():
117
+ if image_base.startswith(key):
118
+ return dict(defaults)
119
+
120
+ return None
@@ -0,0 +1,83 @@
1
+ # Copyright (C) 2026 FORKTEX S.R.L.
2
+ #
3
+ # SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-ForkTex-Commercial
4
+ #
5
+ # This file is part of forktex-cloud.
6
+ #
7
+ # For commercial licensing -- including use in proprietary products, SaaS
8
+ # deployments, or any context where AGPL obligations cannot be met -- you
9
+ # MUST obtain a commercial license from FORKTEX S.R.L. (info@forktex.com).
10
+ #
11
+ # This program is free software: you can redistribute it and/or modify
12
+ # it under the terms of the GNU Affero General Public License as published by
13
+ # the Free Software Foundation, either version 3 of the License, or
14
+ # (at your option) any later version.
15
+ #
16
+ # This program is distributed in the hope that it will be useful,
17
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ # GNU Affero General Public License for more details.
20
+ #
21
+ # You should have received a copy of the GNU Affero General Public License
22
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
23
+
24
+ """Typed httpx client for the ForkTex Cloud API.
25
+
26
+ All response/request models come from ``forktex_cloud.client.generated``
27
+ (emitted by the OpenAPI codegen pipeline). This module re-exports the
28
+ commonly used ones so call sites can ``from forktex_cloud.client import X``
29
+ without touching the ``generated`` namespace directly.
30
+ """
31
+
32
+ from forktex_cloud.client.client import CloudAPIError, ForktexCloudClient
33
+ from forktex_cloud.client.generated import (
34
+ ApiKeyCreated,
35
+ ApiKeyRead,
36
+ CapacityOrgLimits,
37
+ CapacityReport,
38
+ CapacityServers,
39
+ EnvironmentRead,
40
+ EventRead,
41
+ HealthRead,
42
+ JobResponse,
43
+ MeResponse,
44
+ OrgBrief,
45
+ OrgRead,
46
+ ProjectRead,
47
+ ServerDnsRead,
48
+ ServerRead,
49
+ ServerServiceRead,
50
+ ServerSslRead,
51
+ StatusResponse,
52
+ TokenResponse,
53
+ UserRead,
54
+ VaultGetResponse,
55
+ WorkspaceRead,
56
+ )
57
+
58
+ __all__ = [
59
+ "ForktexCloudClient",
60
+ "CloudAPIError",
61
+ "ApiKeyCreated",
62
+ "ApiKeyRead",
63
+ "CapacityOrgLimits",
64
+ "CapacityReport",
65
+ "CapacityServers",
66
+ "EnvironmentRead",
67
+ "EventRead",
68
+ "HealthRead",
69
+ "JobResponse",
70
+ "MeResponse",
71
+ "OrgBrief",
72
+ "OrgRead",
73
+ "ProjectRead",
74
+ "ServerDnsRead",
75
+ "ServerRead",
76
+ "ServerServiceRead",
77
+ "ServerSslRead",
78
+ "StatusResponse",
79
+ "TokenResponse",
80
+ "UserRead",
81
+ "VaultGetResponse",
82
+ "WorkspaceRead",
83
+ ]