lamia-cloud 0.1.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.
- lamia_cloud-0.1.0/.github/workflows/publish.yml +29 -0
- lamia_cloud-0.1.0/.github/workflows/test.yml +28 -0
- lamia_cloud-0.1.0/.gitignore +9 -0
- lamia_cloud-0.1.0/LICENSE +21 -0
- lamia_cloud-0.1.0/PKG-INFO +155 -0
- lamia_cloud-0.1.0/README.md +100 -0
- lamia_cloud-0.1.0/lamia_cloud.egg-info/PKG-INFO +155 -0
- lamia_cloud-0.1.0/lamia_cloud.egg-info/SOURCES.txt +29 -0
- lamia_cloud-0.1.0/lamia_cloud.egg-info/dependency_links.txt +1 -0
- lamia_cloud-0.1.0/lamia_cloud.egg-info/entry_points.txt +2 -0
- lamia_cloud-0.1.0/lamia_cloud.egg-info/requires.txt +12 -0
- lamia_cloud-0.1.0/lamia_cloud.egg-info/top_level.txt +1 -0
- lamia_cloud-0.1.0/pyproject.toml +67 -0
- lamia_cloud-0.1.0/setup.cfg +4 -0
- lamia_cloud-0.1.0/src/__init__.py +59 -0
- lamia_cloud-0.1.0/src/_version.py +24 -0
- lamia_cloud-0.1.0/src/gcp/__init__.py +10 -0
- lamia_cloud-0.1.0/src/gcp/deployer.py +366 -0
- lamia_cloud-0.1.0/src/gcp/scheduler.py +213 -0
- lamia_cloud-0.1.0/src/gcp/vertex.py +451 -0
- lamia_cloud-0.1.0/src/interfaces.py +74 -0
- lamia_cloud-0.1.0/src/loader.py +53 -0
- lamia_cloud-0.1.0/src/templates/Dockerfile +13 -0
- lamia_cloud-0.1.0/src/templates/main.py +55 -0
- lamia_cloud-0.1.0/src/types.py +50 -0
- lamia_cloud-0.1.0/tests/__init__.py +1 -0
- lamia_cloud-0.1.0/tests/test_deployer.py +82 -0
- lamia_cloud-0.1.0/tests/test_gcp.py +33 -0
- lamia_cloud-0.1.0/tests/test_llm_adapter.py +182 -0
- lamia_cloud-0.1.0/tests/test_loader.py +50 -0
- lamia_cloud-0.1.0/tests/test_quickstart.py +89 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
with:
|
|
16
|
+
fetch-depth: 0
|
|
17
|
+
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.12"
|
|
21
|
+
|
|
22
|
+
- name: Install build tools
|
|
23
|
+
run: pip install build setuptools-scm
|
|
24
|
+
|
|
25
|
+
- name: Build package
|
|
26
|
+
run: python -m build
|
|
27
|
+
|
|
28
|
+
- name: Publish to PyPI
|
|
29
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python-version }}
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: |
|
|
25
|
+
pip install -e ".[dev]"
|
|
26
|
+
|
|
27
|
+
- name: Run tests
|
|
28
|
+
run: pytest
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sergey Sargsyan
|
|
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.
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lamia-cloud
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Cloud scheduling backend for Lamia — deploy and run .lm scripts on GCP.
|
|
5
|
+
Author: Sergey Sargsyan
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Sergey Sargsyan
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/lamia-lang/lamia-cloud
|
|
29
|
+
Project-URL: Repository, https://github.com/lamia-lang/lamia-cloud
|
|
30
|
+
Project-URL: Issues, https://github.com/lamia-lang/lamia-cloud/issues
|
|
31
|
+
Keywords: lamia,cloud,scheduler,gcp,automation
|
|
32
|
+
Classifier: Development Status :: 3 - Alpha
|
|
33
|
+
Classifier: Intended Audience :: Developers
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Programming Language :: Python :: 3
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
40
|
+
Requires-Python: >=3.10
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
License-File: LICENSE
|
|
43
|
+
Requires-Dist: lamia-lang>=0.1.0
|
|
44
|
+
Requires-Dist: google-cloud-scheduler>=2.13.0
|
|
45
|
+
Requires-Dist: google-cloud-build>=3.20.0
|
|
46
|
+
Requires-Dist: google-cloud-run>=0.10.0
|
|
47
|
+
Requires-Dist: google-cloud-storage>=2.14.0
|
|
48
|
+
Requires-Dist: google-cloud-service-usage>=1.8.0
|
|
49
|
+
Requires-Dist: google-cloud-resource-manager>=1.3.0
|
|
50
|
+
Requires-Dist: pyyaml>=6.0.0
|
|
51
|
+
Provides-Extra: dev
|
|
52
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
53
|
+
Requires-Dist: pytest-asyncio>=0.18.0; extra == "dev"
|
|
54
|
+
Dynamic: license-file
|
|
55
|
+
|
|
56
|
+
# lamia-cloud
|
|
57
|
+
|
|
58
|
+
Cloud scheduling backend for [Lamia](https://github.com/lamia-lang/lamia). Deploy `.lm` scripts to run on a schedule in the cloud — fully automated. Currently supports GCP.
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install "lamia-lang[cloud]"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Prerequisites
|
|
67
|
+
|
|
68
|
+
- GCP project with billing enabled
|
|
69
|
+
- Application Default Credentials: `gcloud auth application-default login`
|
|
70
|
+
|
|
71
|
+
All required GCP APIs (including Service Usage) are enabled automatically on first deploy.
|
|
72
|
+
|
|
73
|
+
## Quick Start
|
|
74
|
+
|
|
75
|
+
1. Add a `cloud` section to your project's `config.yaml`:
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
cloud:
|
|
79
|
+
provider: gcp
|
|
80
|
+
project_id: my-gcp-project
|
|
81
|
+
location: us-central1 # optional, default: us-central1
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
2. Schedule your script with the `--remote` flag:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
lamia schedule add my_script.lm --every day --remote
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The `--remote` flag tells lamia to deploy and run the script in the cloud instead of locally.
|
|
91
|
+
|
|
92
|
+
## Managing Schedules
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
lamia schedule list # shows all jobs (local + cloud) with live status
|
|
96
|
+
lamia schedule add X --remote # deploy and schedule a new cloud job
|
|
97
|
+
lamia schedule remove <id> # tears down cloud resources and removes the job
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## How It Works
|
|
101
|
+
|
|
102
|
+
1. `lamia schedule add --remote` packages your project and deploys it as a Cloud Run service
|
|
103
|
+
2. Cloud Scheduler triggers it on your cron schedule
|
|
104
|
+
3. Logs are available in Cloud Logging
|
|
105
|
+
4. `lamia schedule list` fetches live execution status from the cloud
|
|
106
|
+
|
|
107
|
+
## LLM on Cloud — Vertex AI
|
|
108
|
+
|
|
109
|
+
Scripts that use LLM calls run through **Vertex AI** on cloud. This gives you:
|
|
110
|
+
|
|
111
|
+
- **No API keys** — authentication via IAM, no keys to store, rotate, or leak
|
|
112
|
+
- **Budget control** — Vertex AI quotas and billing alerts
|
|
113
|
+
- **Secure by default** — no API key transport or storage, traffic stays within GCP
|
|
114
|
+
|
|
115
|
+
### Supported Models
|
|
116
|
+
|
|
117
|
+
| Provider | Cloud routing |
|
|
118
|
+
|----------|--------------|
|
|
119
|
+
| **Anthropic** (Claude) | Runs natively on Vertex AI — same models, same quality |
|
|
120
|
+
| **Google** (Gemini) | Runs natively on Vertex AI |
|
|
121
|
+
| **OpenAI** (GPT, o-series) | Automatically mapped to Gemini by tier (strong/medium/light) with runtime selection of the best available current Gemini model |
|
|
122
|
+
|
|
123
|
+
Anthropic and Google models run as-is. OpenAI models are mapped because they're not available on Vertex AI — tier classification is stable while the selected Gemini model is discovered dynamically at runtime.
|
|
124
|
+
|
|
125
|
+
## Configuration Reference
|
|
126
|
+
|
|
127
|
+
| Field | Required | Default | Description |
|
|
128
|
+
|-------|----------|---------|-------------|
|
|
129
|
+
| `cloud.provider` | Yes | — | Cloud provider (currently `gcp`) |
|
|
130
|
+
| `cloud.project_id` | Yes | — | Your GCP project ID |
|
|
131
|
+
| `cloud.location` | No | `us-central1` | Region for Cloud Run deployment |
|
|
132
|
+
|
|
133
|
+
No environment variables are required.
|
|
134
|
+
|
|
135
|
+
## Troubleshooting
|
|
136
|
+
|
|
137
|
+
- If Vertex AI access is not enabled yet, lamia-cloud logs a project-specific URL and attempts to open it automatically in your browser:
|
|
138
|
+
`https://console.cloud.google.com/vertex-ai?project=<your-project-id>`
|
|
139
|
+
- After accepting terms, re-run the schedule/install command once.
|
|
140
|
+
|
|
141
|
+
## Development
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
git clone https://github.com/lamia-lang/lamia-cloud.git
|
|
145
|
+
cd lamia-cloud
|
|
146
|
+
pip install -e ".[dev]"
|
|
147
|
+
pytest
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Releasing
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
git tag v0.1.0
|
|
154
|
+
git push origin v0.1.0
|
|
155
|
+
```
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# lamia-cloud
|
|
2
|
+
|
|
3
|
+
Cloud scheduling backend for [Lamia](https://github.com/lamia-lang/lamia). Deploy `.lm` scripts to run on a schedule in the cloud — fully automated. Currently supports GCP.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install "lamia-lang[cloud]"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
- GCP project with billing enabled
|
|
14
|
+
- Application Default Credentials: `gcloud auth application-default login`
|
|
15
|
+
|
|
16
|
+
All required GCP APIs (including Service Usage) are enabled automatically on first deploy.
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
1. Add a `cloud` section to your project's `config.yaml`:
|
|
21
|
+
|
|
22
|
+
```yaml
|
|
23
|
+
cloud:
|
|
24
|
+
provider: gcp
|
|
25
|
+
project_id: my-gcp-project
|
|
26
|
+
location: us-central1 # optional, default: us-central1
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
2. Schedule your script with the `--remote` flag:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
lamia schedule add my_script.lm --every day --remote
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The `--remote` flag tells lamia to deploy and run the script in the cloud instead of locally.
|
|
36
|
+
|
|
37
|
+
## Managing Schedules
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
lamia schedule list # shows all jobs (local + cloud) with live status
|
|
41
|
+
lamia schedule add X --remote # deploy and schedule a new cloud job
|
|
42
|
+
lamia schedule remove <id> # tears down cloud resources and removes the job
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## How It Works
|
|
46
|
+
|
|
47
|
+
1. `lamia schedule add --remote` packages your project and deploys it as a Cloud Run service
|
|
48
|
+
2. Cloud Scheduler triggers it on your cron schedule
|
|
49
|
+
3. Logs are available in Cloud Logging
|
|
50
|
+
4. `lamia schedule list` fetches live execution status from the cloud
|
|
51
|
+
|
|
52
|
+
## LLM on Cloud — Vertex AI
|
|
53
|
+
|
|
54
|
+
Scripts that use LLM calls run through **Vertex AI** on cloud. This gives you:
|
|
55
|
+
|
|
56
|
+
- **No API keys** — authentication via IAM, no keys to store, rotate, or leak
|
|
57
|
+
- **Budget control** — Vertex AI quotas and billing alerts
|
|
58
|
+
- **Secure by default** — no API key transport or storage, traffic stays within GCP
|
|
59
|
+
|
|
60
|
+
### Supported Models
|
|
61
|
+
|
|
62
|
+
| Provider | Cloud routing |
|
|
63
|
+
|----------|--------------|
|
|
64
|
+
| **Anthropic** (Claude) | Runs natively on Vertex AI — same models, same quality |
|
|
65
|
+
| **Google** (Gemini) | Runs natively on Vertex AI |
|
|
66
|
+
| **OpenAI** (GPT, o-series) | Automatically mapped to Gemini by tier (strong/medium/light) with runtime selection of the best available current Gemini model |
|
|
67
|
+
|
|
68
|
+
Anthropic and Google models run as-is. OpenAI models are mapped because they're not available on Vertex AI — tier classification is stable while the selected Gemini model is discovered dynamically at runtime.
|
|
69
|
+
|
|
70
|
+
## Configuration Reference
|
|
71
|
+
|
|
72
|
+
| Field | Required | Default | Description |
|
|
73
|
+
|-------|----------|---------|-------------|
|
|
74
|
+
| `cloud.provider` | Yes | — | Cloud provider (currently `gcp`) |
|
|
75
|
+
| `cloud.project_id` | Yes | — | Your GCP project ID |
|
|
76
|
+
| `cloud.location` | No | `us-central1` | Region for Cloud Run deployment |
|
|
77
|
+
|
|
78
|
+
No environment variables are required.
|
|
79
|
+
|
|
80
|
+
## Troubleshooting
|
|
81
|
+
|
|
82
|
+
- If Vertex AI access is not enabled yet, lamia-cloud logs a project-specific URL and attempts to open it automatically in your browser:
|
|
83
|
+
`https://console.cloud.google.com/vertex-ai?project=<your-project-id>`
|
|
84
|
+
- After accepting terms, re-run the schedule/install command once.
|
|
85
|
+
|
|
86
|
+
## Development
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
git clone https://github.com/lamia-lang/lamia-cloud.git
|
|
90
|
+
cd lamia-cloud
|
|
91
|
+
pip install -e ".[dev]"
|
|
92
|
+
pytest
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Releasing
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
git tag v0.1.0
|
|
99
|
+
git push origin v0.1.0
|
|
100
|
+
```
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lamia-cloud
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Cloud scheduling backend for Lamia — deploy and run .lm scripts on GCP.
|
|
5
|
+
Author: Sergey Sargsyan
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Sergey Sargsyan
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/lamia-lang/lamia-cloud
|
|
29
|
+
Project-URL: Repository, https://github.com/lamia-lang/lamia-cloud
|
|
30
|
+
Project-URL: Issues, https://github.com/lamia-lang/lamia-cloud/issues
|
|
31
|
+
Keywords: lamia,cloud,scheduler,gcp,automation
|
|
32
|
+
Classifier: Development Status :: 3 - Alpha
|
|
33
|
+
Classifier: Intended Audience :: Developers
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Programming Language :: Python :: 3
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
40
|
+
Requires-Python: >=3.10
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
License-File: LICENSE
|
|
43
|
+
Requires-Dist: lamia-lang>=0.1.0
|
|
44
|
+
Requires-Dist: google-cloud-scheduler>=2.13.0
|
|
45
|
+
Requires-Dist: google-cloud-build>=3.20.0
|
|
46
|
+
Requires-Dist: google-cloud-run>=0.10.0
|
|
47
|
+
Requires-Dist: google-cloud-storage>=2.14.0
|
|
48
|
+
Requires-Dist: google-cloud-service-usage>=1.8.0
|
|
49
|
+
Requires-Dist: google-cloud-resource-manager>=1.3.0
|
|
50
|
+
Requires-Dist: pyyaml>=6.0.0
|
|
51
|
+
Provides-Extra: dev
|
|
52
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
53
|
+
Requires-Dist: pytest-asyncio>=0.18.0; extra == "dev"
|
|
54
|
+
Dynamic: license-file
|
|
55
|
+
|
|
56
|
+
# lamia-cloud
|
|
57
|
+
|
|
58
|
+
Cloud scheduling backend for [Lamia](https://github.com/lamia-lang/lamia). Deploy `.lm` scripts to run on a schedule in the cloud — fully automated. Currently supports GCP.
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install "lamia-lang[cloud]"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Prerequisites
|
|
67
|
+
|
|
68
|
+
- GCP project with billing enabled
|
|
69
|
+
- Application Default Credentials: `gcloud auth application-default login`
|
|
70
|
+
|
|
71
|
+
All required GCP APIs (including Service Usage) are enabled automatically on first deploy.
|
|
72
|
+
|
|
73
|
+
## Quick Start
|
|
74
|
+
|
|
75
|
+
1. Add a `cloud` section to your project's `config.yaml`:
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
cloud:
|
|
79
|
+
provider: gcp
|
|
80
|
+
project_id: my-gcp-project
|
|
81
|
+
location: us-central1 # optional, default: us-central1
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
2. Schedule your script with the `--remote` flag:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
lamia schedule add my_script.lm --every day --remote
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The `--remote` flag tells lamia to deploy and run the script in the cloud instead of locally.
|
|
91
|
+
|
|
92
|
+
## Managing Schedules
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
lamia schedule list # shows all jobs (local + cloud) with live status
|
|
96
|
+
lamia schedule add X --remote # deploy and schedule a new cloud job
|
|
97
|
+
lamia schedule remove <id> # tears down cloud resources and removes the job
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## How It Works
|
|
101
|
+
|
|
102
|
+
1. `lamia schedule add --remote` packages your project and deploys it as a Cloud Run service
|
|
103
|
+
2. Cloud Scheduler triggers it on your cron schedule
|
|
104
|
+
3. Logs are available in Cloud Logging
|
|
105
|
+
4. `lamia schedule list` fetches live execution status from the cloud
|
|
106
|
+
|
|
107
|
+
## LLM on Cloud — Vertex AI
|
|
108
|
+
|
|
109
|
+
Scripts that use LLM calls run through **Vertex AI** on cloud. This gives you:
|
|
110
|
+
|
|
111
|
+
- **No API keys** — authentication via IAM, no keys to store, rotate, or leak
|
|
112
|
+
- **Budget control** — Vertex AI quotas and billing alerts
|
|
113
|
+
- **Secure by default** — no API key transport or storage, traffic stays within GCP
|
|
114
|
+
|
|
115
|
+
### Supported Models
|
|
116
|
+
|
|
117
|
+
| Provider | Cloud routing |
|
|
118
|
+
|----------|--------------|
|
|
119
|
+
| **Anthropic** (Claude) | Runs natively on Vertex AI — same models, same quality |
|
|
120
|
+
| **Google** (Gemini) | Runs natively on Vertex AI |
|
|
121
|
+
| **OpenAI** (GPT, o-series) | Automatically mapped to Gemini by tier (strong/medium/light) with runtime selection of the best available current Gemini model |
|
|
122
|
+
|
|
123
|
+
Anthropic and Google models run as-is. OpenAI models are mapped because they're not available on Vertex AI — tier classification is stable while the selected Gemini model is discovered dynamically at runtime.
|
|
124
|
+
|
|
125
|
+
## Configuration Reference
|
|
126
|
+
|
|
127
|
+
| Field | Required | Default | Description |
|
|
128
|
+
|-------|----------|---------|-------------|
|
|
129
|
+
| `cloud.provider` | Yes | — | Cloud provider (currently `gcp`) |
|
|
130
|
+
| `cloud.project_id` | Yes | — | Your GCP project ID |
|
|
131
|
+
| `cloud.location` | No | `us-central1` | Region for Cloud Run deployment |
|
|
132
|
+
|
|
133
|
+
No environment variables are required.
|
|
134
|
+
|
|
135
|
+
## Troubleshooting
|
|
136
|
+
|
|
137
|
+
- If Vertex AI access is not enabled yet, lamia-cloud logs a project-specific URL and attempts to open it automatically in your browser:
|
|
138
|
+
`https://console.cloud.google.com/vertex-ai?project=<your-project-id>`
|
|
139
|
+
- After accepting terms, re-run the schedule/install command once.
|
|
140
|
+
|
|
141
|
+
## Development
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
git clone https://github.com/lamia-lang/lamia-cloud.git
|
|
145
|
+
cd lamia-cloud
|
|
146
|
+
pip install -e ".[dev]"
|
|
147
|
+
pytest
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Releasing
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
git tag v0.1.0
|
|
154
|
+
git push origin v0.1.0
|
|
155
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.gitignore
|
|
2
|
+
LICENSE
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
.github/workflows/publish.yml
|
|
6
|
+
.github/workflows/test.yml
|
|
7
|
+
lamia_cloud.egg-info/PKG-INFO
|
|
8
|
+
lamia_cloud.egg-info/SOURCES.txt
|
|
9
|
+
lamia_cloud.egg-info/dependency_links.txt
|
|
10
|
+
lamia_cloud.egg-info/entry_points.txt
|
|
11
|
+
lamia_cloud.egg-info/requires.txt
|
|
12
|
+
lamia_cloud.egg-info/top_level.txt
|
|
13
|
+
src/__init__.py
|
|
14
|
+
src/_version.py
|
|
15
|
+
src/interfaces.py
|
|
16
|
+
src/loader.py
|
|
17
|
+
src/types.py
|
|
18
|
+
src/gcp/__init__.py
|
|
19
|
+
src/gcp/deployer.py
|
|
20
|
+
src/gcp/scheduler.py
|
|
21
|
+
src/gcp/vertex.py
|
|
22
|
+
src/templates/Dockerfile
|
|
23
|
+
src/templates/main.py
|
|
24
|
+
tests/__init__.py
|
|
25
|
+
tests/test_deployer.py
|
|
26
|
+
tests/test_gcp.py
|
|
27
|
+
tests/test_llm_adapter.py
|
|
28
|
+
tests/test_loader.py
|
|
29
|
+
tests/test_quickstart.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
lamia-lang>=0.1.0
|
|
2
|
+
google-cloud-scheduler>=2.13.0
|
|
3
|
+
google-cloud-build>=3.20.0
|
|
4
|
+
google-cloud-run>=0.10.0
|
|
5
|
+
google-cloud-storage>=2.14.0
|
|
6
|
+
google-cloud-service-usage>=1.8.0
|
|
7
|
+
google-cloud-resource-manager>=1.3.0
|
|
8
|
+
pyyaml>=6.0.0
|
|
9
|
+
|
|
10
|
+
[dev]
|
|
11
|
+
pytest>=7.0.0
|
|
12
|
+
pytest-asyncio>=0.18.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
lamia_cloud
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=45", "wheel", "setuptools-scm>=8"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "lamia-cloud"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Cloud scheduling backend for Lamia — deploy and run .lm scripts on GCP."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {file = "LICENSE"}
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
keywords = ["lamia", "cloud", "scheduler", "gcp", "automation"]
|
|
13
|
+
authors = [
|
|
14
|
+
{name = "Sergey Sargsyan"}
|
|
15
|
+
]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
dependencies = [
|
|
28
|
+
"lamia-lang>=0.1.0",
|
|
29
|
+
"google-cloud-scheduler>=2.13.0",
|
|
30
|
+
"google-cloud-build>=3.20.0",
|
|
31
|
+
"google-cloud-run>=0.10.0",
|
|
32
|
+
"google-cloud-storage>=2.14.0",
|
|
33
|
+
"google-cloud-service-usage>=1.8.0",
|
|
34
|
+
"google-cloud-resource-manager>=1.3.0",
|
|
35
|
+
"pyyaml>=6.0.0",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
dev = [
|
|
40
|
+
"pytest>=7.0.0",
|
|
41
|
+
"pytest-asyncio>=0.18.0",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
Homepage = "https://github.com/lamia-lang/lamia-cloud"
|
|
46
|
+
Repository = "https://github.com/lamia-lang/lamia-cloud"
|
|
47
|
+
Issues = "https://github.com/lamia-lang/lamia-cloud/issues"
|
|
48
|
+
|
|
49
|
+
[project.entry-points."lamia.cloud_providers"]
|
|
50
|
+
default = "lamia_cloud:LamiaCloudProvider"
|
|
51
|
+
|
|
52
|
+
[tool.setuptools]
|
|
53
|
+
package-dir = {"lamia_cloud" = "src", "lamia_cloud.gcp" = "src/gcp"}
|
|
54
|
+
packages = ["lamia_cloud", "lamia_cloud.gcp"]
|
|
55
|
+
|
|
56
|
+
[tool.setuptools.package-data]
|
|
57
|
+
lamia_cloud = ["templates/*"]
|
|
58
|
+
|
|
59
|
+
[tool.setuptools_scm]
|
|
60
|
+
version_file = "src/_version.py"
|
|
61
|
+
|
|
62
|
+
[tool.pytest.ini_options]
|
|
63
|
+
testpaths = ["tests"]
|
|
64
|
+
python_files = ["test_*.py"]
|
|
65
|
+
python_classes = ["Test*"]
|
|
66
|
+
python_functions = ["test_*"]
|
|
67
|
+
addopts = "-v --tb=short"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""lamia-cloud — lamia cloud services package.
|
|
2
|
+
|
|
3
|
+
Public API:
|
|
4
|
+
get_cloud_llm() -> CloudLLM
|
|
5
|
+
get_scheduler(project_root) -> CloudScheduler
|
|
6
|
+
is_on_cloud() -> bool
|
|
7
|
+
Types: CloudLLMRequest, CloudLLMResponse, CloudScheduleJob, CloudJobStatus
|
|
8
|
+
"""
|
|
9
|
+
from lamia_cloud.interfaces import CloudLLM, CloudScheduler
|
|
10
|
+
from lamia_cloud.types import CloudLLMRequest, CloudLLMResponse, CloudScheduleJob, CloudJobStatus
|
|
11
|
+
from lamia_cloud.gcp import VertexLLM, is_on_gcp
|
|
12
|
+
from lamia_cloud.loader import get_scheduler
|
|
13
|
+
|
|
14
|
+
_llm_instance: CloudLLM = None
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def get_cloud_llm(region: str = "") -> CloudLLM:
|
|
18
|
+
"""Return the cloud LLM instance.
|
|
19
|
+
|
|
20
|
+
Only GCP is supported, so we return VertexLLM directly without
|
|
21
|
+
conditional provider checking.
|
|
22
|
+
"""
|
|
23
|
+
global _llm_instance
|
|
24
|
+
if _llm_instance is None:
|
|
25
|
+
_llm_instance = VertexLLM(region=region or _detect_region())
|
|
26
|
+
return _llm_instance
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _detect_region() -> str:
|
|
30
|
+
"""Auto-detect GCP region from Cloud Run metadata server."""
|
|
31
|
+
import urllib.request
|
|
32
|
+
try:
|
|
33
|
+
req = urllib.request.Request(
|
|
34
|
+
"http://metadata.google.internal/computeMetadata/v1/instance/region",
|
|
35
|
+
headers={"Metadata-Flavor": "Google"},
|
|
36
|
+
)
|
|
37
|
+
resp = urllib.request.urlopen(req, timeout=2)
|
|
38
|
+
full = resp.read().decode().strip()
|
|
39
|
+
return full.rsplit("/", 1)[-1]
|
|
40
|
+
except Exception:
|
|
41
|
+
return "us-central1"
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def is_on_cloud() -> bool:
|
|
45
|
+
"""Check if running in a cloud environment."""
|
|
46
|
+
return is_on_gcp()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
__all__ = [
|
|
50
|
+
"CloudLLM",
|
|
51
|
+
"CloudScheduler",
|
|
52
|
+
"CloudLLMRequest",
|
|
53
|
+
"CloudLLMResponse",
|
|
54
|
+
"CloudScheduleJob",
|
|
55
|
+
"CloudJobStatus",
|
|
56
|
+
"get_cloud_llm",
|
|
57
|
+
"get_scheduler",
|
|
58
|
+
"is_on_cloud",
|
|
59
|
+
]
|