forktex-cloud 0.2.3__tar.gz → 0.5.0__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 (46) hide show
  1. forktex_cloud-0.5.0/LICENSE +21 -0
  2. {forktex_cloud-0.2.3 → forktex_cloud-0.5.0}/PKG-INFO +27 -53
  3. {forktex_cloud-0.2.3 → forktex_cloud-0.5.0}/README.md +22 -46
  4. {forktex_cloud-0.2.3 → forktex_cloud-0.5.0}/pyproject.toml +9 -35
  5. forktex_cloud-0.5.0/src/forktex_cloud/__init__.py +76 -0
  6. forktex_cloud-0.5.0/src/forktex_cloud/bridge/__init__.py +1 -0
  7. {forktex_cloud-0.2.3 → forktex_cloud-0.5.0}/src/forktex_cloud/bridge/local_compose.py +26 -45
  8. forktex_cloud-0.5.0/src/forktex_cloud/bridge/log_formatter.py +39 -0
  9. {forktex_cloud-0.2.3 → forktex_cloud-0.5.0}/src/forktex_cloud/bridge/loki.py +0 -23
  10. {forktex_cloud-0.2.3 → forktex_cloud-0.5.0}/src/forktex_cloud/bridge/persistence_defaults.py +0 -23
  11. {forktex_cloud-0.2.3 → forktex_cloud-0.5.0}/src/forktex_cloud/client/__init__.py +8 -27
  12. forktex_cloud-0.5.0/src/forktex_cloud/client/client.py +1258 -0
  13. forktex_cloud-0.5.0/src/forktex_cloud/client/generated/__init__.py +1552 -0
  14. {forktex_cloud-0.2.3 → forktex_cloud-0.5.0}/src/forktex_cloud/config.py +0 -23
  15. {forktex_cloud-0.2.3 → forktex_cloud-0.5.0}/src/forktex_cloud/manifest/__init__.py +0 -23
  16. forktex_cloud-0.5.0/src/forktex_cloud/manifest/errors.py +11 -0
  17. {forktex_cloud-0.2.3 → forktex_cloud-0.5.0}/src/forktex_cloud/manifest/loader.py +0 -23
  18. forktex_cloud-0.5.0/src/forktex_cloud/manifest/merge.py +29 -0
  19. {forktex_cloud-0.2.3 → forktex_cloud-0.5.0}/src/forktex_cloud/manifest/schema.py +0 -23
  20. {forktex_cloud-0.2.3 → forktex_cloud-0.5.0}/src/forktex_cloud/paths.py +0 -23
  21. forktex_cloud-0.5.0/src/forktex_cloud/scaffold/__init__.py +1 -0
  22. {forktex_cloud-0.2.3 → forktex_cloud-0.5.0}/src/forktex_cloud/scaffold/templates.py +0 -23
  23. forktex_cloud-0.5.0/src/forktex_cloud/secrets/__init__.py +1 -0
  24. forktex_cloud-0.5.0/src/forktex_cloud/secrets/base.py +29 -0
  25. forktex_cloud-0.5.0/src/forktex_cloud/secrets/factory.py +34 -0
  26. {forktex_cloud-0.2.3 → forktex_cloud-0.5.0}/src/forktex_cloud/secrets/fernet.py +0 -23
  27. {forktex_cloud-0.2.3 → forktex_cloud-0.5.0}/src/forktex_cloud/secrets/resolver.py +0 -23
  28. forktex_cloud-0.5.0/src/forktex_cloud/templates/observability/loki.yml +32 -0
  29. forktex_cloud-0.5.0/src/forktex_cloud/templates/observability/promtail.yml +23 -0
  30. forktex_cloud-0.5.0/src/forktex_cloud/vpn/__init__.py +23 -0
  31. forktex_cloud-0.5.0/src/forktex_cloud/vpn/local.py +86 -0
  32. forktex_cloud-0.2.3/LICENSE +0 -45
  33. forktex_cloud-0.2.3/NOTICE +0 -23
  34. forktex_cloud-0.2.3/src/forktex_cloud/__init__.py +0 -92
  35. forktex_cloud-0.2.3/src/forktex_cloud/bridge/__init__.py +0 -24
  36. forktex_cloud-0.2.3/src/forktex_cloud/bridge/log_formatter.py +0 -62
  37. forktex_cloud-0.2.3/src/forktex_cloud/client/client.py +0 -599
  38. forktex_cloud-0.2.3/src/forktex_cloud/client/generated/__init__.py +0 -1057
  39. forktex_cloud-0.2.3/src/forktex_cloud/manifest/errors.py +0 -34
  40. forktex_cloud-0.2.3/src/forktex_cloud/manifest/merge.py +0 -52
  41. forktex_cloud-0.2.3/src/forktex_cloud/scaffold/__init__.py +0 -24
  42. forktex_cloud-0.2.3/src/forktex_cloud/secrets/__init__.py +0 -24
  43. forktex_cloud-0.2.3/src/forktex_cloud/secrets/base.py +0 -52
  44. forktex_cloud-0.2.3/src/forktex_cloud/secrets/factory.py +0 -57
  45. forktex_cloud-0.2.3/src/forktex_cloud/templates/observability/loki.yml +0 -55
  46. forktex_cloud-0.2.3/src/forktex_cloud/templates/observability/promtail.yml +0 -46
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ForkTex
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,23 +1,21 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: forktex-cloud
3
- Version: 0.2.3
3
+ Version: 0.5.0
4
4
  Summary: Typed Python SDK for the ForkTex Cloud platform — provision, deploy, and manage VPS-backed apps via a declarative manifest.
5
- License-Expression: AGPL-3.0-only
5
+ License-Expression: MIT
6
6
  License-File: LICENSE
7
- License-File: NOTICE
8
7
  Keywords: forktex,cloud,deployment,vps,hetzner,ansible,blue-green,iac,infrastructure-as-code,sdk
9
- Author: FORKTEX
8
+ Author: ForkTex
10
9
  Author-email: info@forktex.com
11
- Requires-Python: >=3.12
10
+ Requires-Python: >=3.11
12
11
  Classifier: Development Status :: 5 - Production/Stable
13
12
  Classifier: Intended Audience :: Developers
14
13
  Classifier: Intended Audience :: System Administrators
15
14
  Classifier: Operating System :: OS Independent
16
15
  Classifier: Programming Language :: Python :: 3
17
16
  Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
- Classifier: Programming Language :: Python :: 3.13
20
- Classifier: Programming Language :: Python :: 3.14
21
19
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
20
  Classifier: Topic :: System :: Distributed Computing
23
21
  Classifier: Topic :: System :: Installation/Setup
@@ -52,17 +50,17 @@ You can use it directly from any Python application — no `forktex` CLI require
52
50
  pip install forktex-cloud
53
51
  ```
54
52
 
55
- **Requires Python 3.12+.** Tested on 3.12, 3.13, 3.14.
53
+ Requires Python 3.11.
56
54
 
57
55
  ## Quick Start
58
56
 
59
57
  ### Authenticated client
60
58
 
61
59
  ```python
62
- from forktex_cloud import ForktexCloudClient, CloudContext
60
+ from forktex_cloud import Cloud, CloudContext
63
61
 
64
62
  ctx = CloudContext(controller="https://cloud.forktex.com", account_key="ftx-...")
65
- with ForktexCloudClient.from_context(ctx) as client:
63
+ with Cloud.from_context(ctx) as client:
66
64
  projects = client.list_projects()
67
65
  servers = client.list_servers()
68
66
  health = client.health()
@@ -71,14 +69,14 @@ with ForktexCloudClient.from_context(ctx) as client:
71
69
  ### Direct auth
72
70
 
73
71
  ```python
74
- from forktex_cloud import ForktexCloudClient
72
+ from forktex_cloud import Cloud
75
73
 
76
74
  # JWT bearer (user login)
77
- with ForktexCloudClient("https://cloud.forktex.com", access_token="eyJ...") as client:
75
+ with Cloud("https://cloud.forktex.com", access_token="eyJ...") as client:
78
76
  me = client.me()
79
77
 
80
78
  # Org-scoped API key (CI/CD)
81
- with ForktexCloudClient(
79
+ with Cloud(
82
80
  "https://cloud.forktex.com",
83
81
  account_key="ftx-...",
84
82
  org_id="00000000-0000-0000-0000-000000000001",
@@ -90,7 +88,7 @@ with ForktexCloudClient(
90
88
  ### Local dev (point at your `make local` stack)
91
89
 
92
90
  ```python
93
- client = ForktexCloudClient(
91
+ client = Cloud(
94
92
  base_url="http://localhost:8000",
95
93
  account_key="ftx-dev-key-2026",
96
94
  org_id="<your-org-uuid>",
@@ -100,15 +98,23 @@ client = ForktexCloudClient(
100
98
  ### Trigger a deploy pipeline
101
99
 
102
100
  ```python
103
- # Full up (provision + bootstrap + deploy + DNS + SSL)
104
- job = client.up(project_dir=Path("./my-project")) # reads forktex.json
101
+ # Preview what an apply WOULD do (read-only, no mutation):
102
+ plan = client.plan(project_dir=Path("./my-project"), env="production")
103
+ print(plan.manifest_diff) # added / removed / changed paths
104
+ for role in plan.ansible_plan:
105
+ print(f" {role.role}: {role.changed} changed, {role.failed} failed")
106
+ for d in role.diffs:
107
+ print(f" {d.task}: {d.before_header}") # file-level diff hints
108
+
109
+ # Full apply (provision + bootstrap + deploy + DNS + SSL)
110
+ job = client.apply(project_dir=Path("./my-project")) # reads forktex.json
105
111
  print(job.job_id, job.deployment_id, job.status)
106
112
 
107
113
  # Code push to an existing server (no re-provision)
108
114
  job = client.deploy(server_id="...", service="api") # Ansible deploy tag
109
115
 
110
116
  # Tear down
111
- job = client.down(keep_dns=True) # preserves DNS record
117
+ job = client.destroy(keep_dns=True) # preserves DNS record
112
118
  ```
113
119
 
114
120
  ### Manifest loading + validation
@@ -146,11 +152,11 @@ client.vault_delete("POSTGRES_PASSWORD")
146
152
 
147
153
  | Module | Purpose |
148
154
  |---|---|
149
- | `forktex_cloud.client` | Typed sync httpx client (`ForktexCloudClient`) + all OpenAPI-codegenned Pydantic models (`ServerRead`, `ProjectRead`, `EventRead`, `VaultGetResponse`, ...) |
155
+ | `forktex_cloud.client` | Typed sync httpx client (`Cloud`) + all OpenAPI-codegenned Pydantic models (`ServerRead`, `ProjectRead`, `EventRead`, `VaultGetResponse`, ...) |
150
156
  | `forktex_cloud.manifest` | `Manifest` loader, discriminated-union schema (v1beta2), deep-merge for env overlays, `ManifestError` |
151
157
  | `forktex_cloud.config` | `CloudContext` — controller URL, JWT / account-key, current org + project keys |
152
158
  | `forktex_cloud.scaffold` | `forktex cloud init` template generator (ProjectDeployment / StaticSite / SingleContainer / NativeBuild) |
153
- | `forktex_cloud.bridge` | docker-compose generator (local mode), Loki config, log formatters used by `forktex cloud up --env local` |
159
+ | `forktex_cloud.bridge` | docker-compose generator (local mode), Loki config, log formatters used by `forktex cloud apply --env local` |
154
160
  | `forktex_cloud.secrets` | Fernet vault + `${vault:KEY}` resolver for compile-time secret injection |
155
161
  | `forktex_cloud.paths` | Cross-platform `.forktex/` + `~/.forktex/` filesystem spec (V1). See [docs/forktex-directory-spec.md](https://github.com/forktex/cloud/blob/master/docs/forktex-directory-spec.md) |
156
162
 
@@ -161,7 +167,7 @@ All response models come from the OpenAPI codegen pipeline — **one source of t
161
167
  ```python
162
168
  from forktex_cloud import (
163
169
  # Client
164
- ForktexCloudClient, CloudAPIError,
170
+ Cloud, CloudAPIError,
165
171
  # Config
166
172
  CloudContext,
167
173
  # Manifest
@@ -188,39 +194,7 @@ This SDK lives inside the [`forktex/cloud`](https://github.com/forktex/cloud) mo
188
194
  - Production runbook: [production-runbook.md](https://github.com/forktex/cloud/blob/master/docs/production-runbook.md)
189
195
  - Issues: [https://github.com/forktex/cloud/issues](https://github.com/forktex/cloud/issues)
190
196
 
191
- ## Development
192
-
193
- The [`Makefile`](Makefile) is generated by `forktex fsd makefile sync` from [`forktex.json`](forktex.json) — do not hand-edit.
194
-
195
- ```bash
196
- make help # list every available target
197
- make deps # editable install with the dev group
198
- make format # ruff format
199
- make lint # ruff check
200
- make test # pytest tests/
201
- make codegen-check # verify the generated client imports cleanly
202
- make build # python3 -m build → dist/
203
- make ci # format-check + lint + license-check + audit + test + build
204
- make clean # remove caches and dist/
205
- ```
206
-
207
- `make ci` is the single command that gates a publish: format-check, lint, dual-license header check, dependency CVE audit, full test suite, and `python -m build` + `twine check`.
208
-
209
- ### License headers
210
-
211
- Every source file carries the AGPL-3.0 + Commercial dual-license SPDX header, applied idempotently via:
212
-
213
- ```bash
214
- make license-check # CI gate — fails if any source file is missing the header
215
- make license-fix # add or refresh headers across src/, tests/, scripts/
216
- make license-strip # remove headers (used before license-model changes)
217
- ```
218
-
219
197
  ## License
220
198
 
221
- Dual-licensed**AGPL-3.0-or-later** for open-source use, **commercial** for everything else (proprietary products, SaaS without source release, redistribution in closed-source form). See [`LICENSE`](LICENSE) and [`NOTICE`](NOTICE) for the full terms.
222
-
223
- Commercial licensing inquiries: info@forktex.com.
224
-
225
- The 1.0.x releases on PyPI remain under MIT; from **0.2.3** onwards the package ships AGPL-3.0+Commercial.
199
+ MITsee [LICENSE](LICENSE).
226
200
 
@@ -16,17 +16,17 @@ You can use it directly from any Python application — no `forktex` CLI require
16
16
  pip install forktex-cloud
17
17
  ```
18
18
 
19
- **Requires Python 3.12+.** Tested on 3.12, 3.13, 3.14.
19
+ Requires Python 3.11.
20
20
 
21
21
  ## Quick Start
22
22
 
23
23
  ### Authenticated client
24
24
 
25
25
  ```python
26
- from forktex_cloud import ForktexCloudClient, CloudContext
26
+ from forktex_cloud import Cloud, CloudContext
27
27
 
28
28
  ctx = CloudContext(controller="https://cloud.forktex.com", account_key="ftx-...")
29
- with ForktexCloudClient.from_context(ctx) as client:
29
+ with Cloud.from_context(ctx) as client:
30
30
  projects = client.list_projects()
31
31
  servers = client.list_servers()
32
32
  health = client.health()
@@ -35,14 +35,14 @@ with ForktexCloudClient.from_context(ctx) as client:
35
35
  ### Direct auth
36
36
 
37
37
  ```python
38
- from forktex_cloud import ForktexCloudClient
38
+ from forktex_cloud import Cloud
39
39
 
40
40
  # JWT bearer (user login)
41
- with ForktexCloudClient("https://cloud.forktex.com", access_token="eyJ...") as client:
41
+ with Cloud("https://cloud.forktex.com", access_token="eyJ...") as client:
42
42
  me = client.me()
43
43
 
44
44
  # Org-scoped API key (CI/CD)
45
- with ForktexCloudClient(
45
+ with Cloud(
46
46
  "https://cloud.forktex.com",
47
47
  account_key="ftx-...",
48
48
  org_id="00000000-0000-0000-0000-000000000001",
@@ -54,7 +54,7 @@ with ForktexCloudClient(
54
54
  ### Local dev (point at your `make local` stack)
55
55
 
56
56
  ```python
57
- client = ForktexCloudClient(
57
+ client = Cloud(
58
58
  base_url="http://localhost:8000",
59
59
  account_key="ftx-dev-key-2026",
60
60
  org_id="<your-org-uuid>",
@@ -64,15 +64,23 @@ client = ForktexCloudClient(
64
64
  ### Trigger a deploy pipeline
65
65
 
66
66
  ```python
67
- # Full up (provision + bootstrap + deploy + DNS + SSL)
68
- job = client.up(project_dir=Path("./my-project")) # reads forktex.json
67
+ # Preview what an apply WOULD do (read-only, no mutation):
68
+ plan = client.plan(project_dir=Path("./my-project"), env="production")
69
+ print(plan.manifest_diff) # added / removed / changed paths
70
+ for role in plan.ansible_plan:
71
+ print(f" {role.role}: {role.changed} changed, {role.failed} failed")
72
+ for d in role.diffs:
73
+ print(f" {d.task}: {d.before_header}") # file-level diff hints
74
+
75
+ # Full apply (provision + bootstrap + deploy + DNS + SSL)
76
+ job = client.apply(project_dir=Path("./my-project")) # reads forktex.json
69
77
  print(job.job_id, job.deployment_id, job.status)
70
78
 
71
79
  # Code push to an existing server (no re-provision)
72
80
  job = client.deploy(server_id="...", service="api") # Ansible deploy tag
73
81
 
74
82
  # Tear down
75
- job = client.down(keep_dns=True) # preserves DNS record
83
+ job = client.destroy(keep_dns=True) # preserves DNS record
76
84
  ```
77
85
 
78
86
  ### Manifest loading + validation
@@ -110,11 +118,11 @@ client.vault_delete("POSTGRES_PASSWORD")
110
118
 
111
119
  | Module | Purpose |
112
120
  |---|---|
113
- | `forktex_cloud.client` | Typed sync httpx client (`ForktexCloudClient`) + all OpenAPI-codegenned Pydantic models (`ServerRead`, `ProjectRead`, `EventRead`, `VaultGetResponse`, ...) |
121
+ | `forktex_cloud.client` | Typed sync httpx client (`Cloud`) + all OpenAPI-codegenned Pydantic models (`ServerRead`, `ProjectRead`, `EventRead`, `VaultGetResponse`, ...) |
114
122
  | `forktex_cloud.manifest` | `Manifest` loader, discriminated-union schema (v1beta2), deep-merge for env overlays, `ManifestError` |
115
123
  | `forktex_cloud.config` | `CloudContext` — controller URL, JWT / account-key, current org + project keys |
116
124
  | `forktex_cloud.scaffold` | `forktex cloud init` template generator (ProjectDeployment / StaticSite / SingleContainer / NativeBuild) |
117
- | `forktex_cloud.bridge` | docker-compose generator (local mode), Loki config, log formatters used by `forktex cloud up --env local` |
125
+ | `forktex_cloud.bridge` | docker-compose generator (local mode), Loki config, log formatters used by `forktex cloud apply --env local` |
118
126
  | `forktex_cloud.secrets` | Fernet vault + `${vault:KEY}` resolver for compile-time secret injection |
119
127
  | `forktex_cloud.paths` | Cross-platform `.forktex/` + `~/.forktex/` filesystem spec (V1). See [docs/forktex-directory-spec.md](https://github.com/forktex/cloud/blob/master/docs/forktex-directory-spec.md) |
120
128
 
@@ -125,7 +133,7 @@ All response models come from the OpenAPI codegen pipeline — **one source of t
125
133
  ```python
126
134
  from forktex_cloud import (
127
135
  # Client
128
- ForktexCloudClient, CloudAPIError,
136
+ Cloud, CloudAPIError,
129
137
  # Config
130
138
  CloudContext,
131
139
  # Manifest
@@ -152,38 +160,6 @@ This SDK lives inside the [`forktex/cloud`](https://github.com/forktex/cloud) mo
152
160
  - Production runbook: [production-runbook.md](https://github.com/forktex/cloud/blob/master/docs/production-runbook.md)
153
161
  - Issues: [https://github.com/forktex/cloud/issues](https://github.com/forktex/cloud/issues)
154
162
 
155
- ## Development
156
-
157
- The [`Makefile`](Makefile) is generated by `forktex fsd makefile sync` from [`forktex.json`](forktex.json) — do not hand-edit.
158
-
159
- ```bash
160
- make help # list every available target
161
- make deps # editable install with the dev group
162
- make format # ruff format
163
- make lint # ruff check
164
- make test # pytest tests/
165
- make codegen-check # verify the generated client imports cleanly
166
- make build # python3 -m build → dist/
167
- make ci # format-check + lint + license-check + audit + test + build
168
- make clean # remove caches and dist/
169
- ```
170
-
171
- `make ci` is the single command that gates a publish: format-check, lint, dual-license header check, dependency CVE audit, full test suite, and `python -m build` + `twine check`.
172
-
173
- ### License headers
174
-
175
- Every source file carries the AGPL-3.0 + Commercial dual-license SPDX header, applied idempotently via:
176
-
177
- ```bash
178
- make license-check # CI gate — fails if any source file is missing the header
179
- make license-fix # add or refresh headers across src/, tests/, scripts/
180
- make license-strip # remove headers (used before license-model changes)
181
- ```
182
-
183
163
  ## License
184
164
 
185
- Dual-licensed**AGPL-3.0-or-later** for open-source use, **commercial** for everything else (proprietary products, SaaS without source release, redistribution in closed-source form). See [`LICENSE`](LICENSE) and [`NOTICE`](NOTICE) for the full terms.
186
-
187
- Commercial licensing inquiries: info@forktex.com.
188
-
189
- The 1.0.x releases on PyPI remain under MIT; from **0.2.3** onwards the package ships AGPL-3.0+Commercial.
165
+ MITsee [LICENSE](LICENSE).
@@ -1,37 +1,14 @@
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
1
  [project]
25
2
  name = "forktex-cloud"
26
- version = "0.2.3"
3
+ version = "0.5.0"
27
4
  description = "Typed Python SDK for the ForkTex Cloud platform — provision, deploy, and manage VPS-backed apps via a declarative manifest."
28
5
  authors = [
29
- {name = "FORKTEX", email = "info@forktex.com"}
6
+ {name = "ForkTex", email = "info@forktex.com"}
30
7
  ]
31
8
  readme = "README.md"
32
- license = "AGPL-3.0-only"
33
- license-files = ["LICENSE", "NOTICE"]
34
- requires-python = ">=3.12"
9
+ license = "MIT"
10
+ license-files = ["LICENSE"]
11
+ requires-python = ">=3.11"
35
12
  keywords = [
36
13
  "forktex",
37
14
  "cloud",
@@ -51,9 +28,8 @@ classifiers = [
51
28
  "Operating System :: OS Independent",
52
29
  "Programming Language :: Python :: 3",
53
30
  "Programming Language :: Python :: 3 :: Only",
31
+ "Programming Language :: Python :: 3.11",
54
32
  "Programming Language :: Python :: 3.12",
55
- "Programming Language :: Python :: 3.13",
56
- "Programming Language :: Python :: 3.14",
57
33
  "Topic :: Software Development :: Libraries :: Python Modules",
58
34
  "Topic :: System :: Distributed Computing",
59
35
  "Topic :: System :: Installation/Setup",
@@ -83,14 +59,12 @@ dev = [
83
59
  "pytest (>=8.4.2,<9.0.0)",
84
60
  "pytest-asyncio (>=1.2.0,<2.0.0)",
85
61
  "ruff (>=0.8.0)",
86
- "pyright>=1.1.350",
87
- "pip-audit>=2.7.0",
88
- "build>=1.2.0",
89
- "twine>=5.0.0",
62
+ "pyright (>=1.1.0,<2.0.0)",
63
+ "mypy (>=1.11.0,<2.0.0)",
90
64
  ]
91
65
 
92
66
  [tool.ruff]
93
- target-version = "py312"
67
+ target-version = "py311"
94
68
  line-length = 100
95
69
  extend-exclude = [
96
70
  # Auto-generated by OpenAPI codegen. Canonical import shape comes from
@@ -0,0 +1,76 @@
1
+ """forktex_cloud — Standalone Python SDK for the ForkTex Cloud platform.
2
+
3
+ Usage::
4
+
5
+ from forktex_cloud import Cloud
6
+
7
+ with Cloud("https://cloud.forktex.com", account_key="ftx-...") as cloud:
8
+ projects = cloud.list_projects()
9
+ servers = cloud.list_servers()
10
+
11
+ Or, when you already hold a ``CloudContext``::
12
+
13
+ from forktex_cloud import Cloud, CloudContext
14
+
15
+ ctx = CloudContext(controller="https://cloud.forktex.com", account_key="ftx-...")
16
+ with Cloud.from_context(ctx) as cloud:
17
+ ...
18
+ """
19
+
20
+ __version__ = "0.5.0"
21
+
22
+ from forktex_cloud import paths
23
+ from forktex_cloud.client.client import Cloud, CloudAPIError
24
+ from forktex_cloud.client.generated import (
25
+ SPEC_HASH,
26
+ SPEC_VERSION,
27
+ ApiKeyCreated,
28
+ ApiKeyRead,
29
+ AuditEventRead,
30
+ EnvironmentRead,
31
+ HealthRead,
32
+ JobResponse,
33
+ MeResponse,
34
+ OrgRead,
35
+ ProjectRead,
36
+ ServerRead,
37
+ StatusResponse,
38
+ TokenResponse,
39
+ UserRead,
40
+ VaultGetResponse,
41
+ WorkspaceRead,
42
+ )
43
+ from forktex_cloud.config import CloudContext
44
+ from forktex_cloud.manifest.loader import Manifest, ManifestError
45
+
46
+ __all__ = [
47
+ # Filesystem layout spec (V1)
48
+ "paths",
49
+ # Codegen contract (wire-compatibility markers)
50
+ "SPEC_VERSION",
51
+ "SPEC_HASH",
52
+ # Client
53
+ "Cloud",
54
+ "CloudAPIError",
55
+ # Config
56
+ "CloudContext",
57
+ # Manifest
58
+ "Manifest",
59
+ "ManifestError",
60
+ # Models (from OpenAPI codegen — the single source of truth)
61
+ "ApiKeyCreated",
62
+ "ApiKeyRead",
63
+ "AuditEventRead",
64
+ "EnvironmentRead",
65
+ "HealthRead",
66
+ "JobResponse",
67
+ "MeResponse",
68
+ "OrgRead",
69
+ "ProjectRead",
70
+ "ServerRead",
71
+ "StatusResponse",
72
+ "TokenResponse",
73
+ "UserRead",
74
+ "VaultGetResponse",
75
+ "WorkspaceRead",
76
+ ]
@@ -0,0 +1 @@
1
+ """Bridge modules: manifest-to-Docker Compose for local dev."""
@@ -1,26 +1,3 @@
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
1
  """Manifest -> local docker-compose generator.
25
2
 
26
3
  Generates a simple local-oriented docker-compose.local.yml from a forktex manifest.
@@ -165,24 +142,23 @@ def local_compose_from_manifest(
165
142
 
166
143
  svc: dict[str, Any] = {"image": image}
167
144
 
168
- if svc_type == "compute":
169
- build_cfg = svc_def.get("build")
170
- if build_cfg and isinstance(build_cfg, dict):
171
- # Use explicit build config from manifest overlay
172
- build_entry: dict[str, str] = {}
173
- ctx = build_cfg.get("context", f"./{sid}")
174
- # Rewrite relative context to be relative to .forktex/ dir
175
- if ctx.startswith("./"):
176
- build_entry["context"] = f"../{ctx[2:]}"
177
- else:
178
- build_entry["context"] = ctx
179
- if build_cfg.get("dockerfile"):
180
- build_entry["dockerfile"] = build_cfg["dockerfile"]
181
- svc["build"] = build_entry
182
- else:
183
- dockerfile = project_root / sid / "Dockerfile"
184
- if dockerfile.is_file():
185
- svc["build"] = {"context": f"../{sid}"}
145
+ # Build context — explicit overlay first, else auto-detect a sibling
146
+ # Dockerfile for compute services. Persistence services only opt in
147
+ # when the manifest explicitly declares `build` (zot is the canonical
148
+ # case persistence-typed but first-party).
149
+ build_cfg = svc_def.get("build")
150
+ if build_cfg and isinstance(build_cfg, dict):
151
+ build_entry: dict[str, str] = {}
152
+ ctx = build_cfg.get("context", f"./{sid}")
153
+ # Rewrite relative context to be relative to .forktex/ dir
154
+ build_entry["context"] = f"../{ctx.removeprefix('./')}" if ctx.startswith("./") else ctx
155
+ if build_cfg.get("dockerfile"):
156
+ build_entry["dockerfile"] = build_cfg["dockerfile"]
157
+ svc["build"] = build_entry
158
+ elif svc_type == "compute":
159
+ dockerfile = project_root / sid / "Dockerfile"
160
+ if dockerfile.is_file():
161
+ svc["build"] = {"context": f"../{sid}"}
186
162
 
187
163
  if sid in host_ports:
188
164
  host_port = host_ports[sid]
@@ -230,12 +206,17 @@ def local_compose_from_manifest(
230
206
  else:
231
207
  rewritten.append(v)
232
208
  svc["volumes"] = rewritten
233
- elif svc_type == "persistence":
209
+ if svc_type == "persistence":
210
+ # Bind-mount persistence data under .forktex/data/{sid}/ so it
211
+ # survives `docker compose down -v` and is visible on the host
212
+ # for inspection + backups. Mirrors api/src/bridge/local_compose.py.
234
213
  defaults = detect_persistence_defaults(image)
235
214
  if defaults and defaults.get("default_volume"):
236
- vol_name = f"{sid}-data"
237
- svc["volumes"] = [f"{vol_name}:{defaults['default_volume']}"]
238
- named_volumes[vol_name] = None
215
+ target = defaults["default_volume"]
216
+ existing = svc.get("volumes", [])
217
+ if not any(isinstance(v, str) and v.endswith(f":{target}") for v in existing):
218
+ existing.append(f"./data/{sid}:{target}")
219
+ svc["volumes"] = existing
239
220
 
240
221
  cmd = svc_def.get("command")
241
222
  if cmd:
@@ -0,0 +1,39 @@
1
+ """ANSI color formatting for log output."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import time
6
+
7
+ # 8 distinct ANSI colors for service names
8
+ COLORS = [
9
+ "\033[36m", # cyan
10
+ "\033[32m", # green
11
+ "\033[33m", # yellow
12
+ "\033[35m", # magenta
13
+ "\033[34m", # blue
14
+ "\033[31m", # red
15
+ "\033[37m", # white
16
+ "\033[96m", # bright cyan
17
+ ]
18
+
19
+ DIM = "\033[2m"
20
+ RESET = "\033[0m"
21
+
22
+
23
+ def assign_colors(service_ids: list[str]) -> dict[str, str]:
24
+ """Assign a distinct ANSI color to each service (round-robin)."""
25
+ return {sid: COLORS[i % len(COLORS)] for i, sid in enumerate(sorted(service_ids))}
26
+
27
+
28
+ def format_line(
29
+ ts_ns: int,
30
+ service: str,
31
+ line: str,
32
+ color: str,
33
+ max_name_len: int,
34
+ ) -> str:
35
+ """Format a single log line with timestamp, colored service name, and separator."""
36
+ t = time.gmtime(ts_ns // 1_000_000_000)
37
+ ts_str = time.strftime("%H:%M:%S", t)
38
+ padded = service.ljust(max_name_len)
39
+ return f"{DIM}{ts_str}{RESET} {color}{padded}{RESET} {DIM}|{RESET} {line}"
@@ -1,26 +1,3 @@
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
1
  """Thin Loki HTTP API client using stdlib only."""
25
2
 
26
3
  from __future__ import annotations
@@ -1,26 +1,3 @@
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
1
  """Shared auto-config defaults for persistence services.
25
2
 
26
3
  Used by the dev compose generator to auto-detect healthchecks, volumes,