neocompute 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.
Files changed (81) hide show
  1. neocompute-0.1.0/.gitignore +8 -0
  2. neocompute-0.1.0/LICENSE +21 -0
  3. neocompute-0.1.0/PKG-INFO +221 -0
  4. neocompute-0.1.0/README.md +161 -0
  5. neocompute-0.1.0/docs/cli.md +179 -0
  6. neocompute-0.1.0/docs/dashboard.md +68 -0
  7. neocompute-0.1.0/docs/lib.md +348 -0
  8. neocompute-0.1.0/docs/providers.md +364 -0
  9. neocompute-0.1.0/examples/hello.py +20 -0
  10. neocompute-0.1.0/neocompute/__init__.py +103 -0
  11. neocompute-0.1.0/neocompute/__main__.py +3 -0
  12. neocompute-0.1.0/neocompute/_sync.py +45 -0
  13. neocompute-0.1.0/neocompute/admin.py +335 -0
  14. neocompute-0.1.0/neocompute/api/__init__.py +0 -0
  15. neocompute-0.1.0/neocompute/api/app.py +80 -0
  16. neocompute-0.1.0/neocompute/api/function.py +435 -0
  17. neocompute-0.1.0/neocompute/api/image.py +55 -0
  18. neocompute-0.1.0/neocompute/api/quotas.py +29 -0
  19. neocompute-0.1.0/neocompute/api/volume.py +196 -0
  20. neocompute-0.1.0/neocompute/checkpoint.py +151 -0
  21. neocompute-0.1.0/neocompute/cli.py +518 -0
  22. neocompute-0.1.0/neocompute/config.py +157 -0
  23. neocompute-0.1.0/neocompute/core/__init__.py +0 -0
  24. neocompute-0.1.0/neocompute/core/bundle.py +112 -0
  25. neocompute-0.1.0/neocompute/core/job.py +76 -0
  26. neocompute-0.1.0/neocompute/core/jobcontext.py +208 -0
  27. neocompute-0.1.0/neocompute/core/quota.py +160 -0
  28. neocompute-0.1.0/neocompute/core/resources.py +177 -0
  29. neocompute-0.1.0/neocompute/core/scheduler.py +314 -0
  30. neocompute-0.1.0/neocompute/core/state.py +320 -0
  31. neocompute-0.1.0/neocompute/core/volumes.py +206 -0
  32. neocompute-0.1.0/neocompute/core/workload.py +131 -0
  33. neocompute-0.1.0/neocompute/credentials.py +345 -0
  34. neocompute-0.1.0/neocompute/dashboard/__init__.py +218 -0
  35. neocompute-0.1.0/neocompute/dashboard/static/index.html +812 -0
  36. neocompute-0.1.0/neocompute/errors.py +73 -0
  37. neocompute-0.1.0/neocompute/providers/__init__.py +87 -0
  38. neocompute-0.1.0/neocompute/providers/_local_launcher.py +66 -0
  39. neocompute-0.1.0/neocompute/providers/base.py +140 -0
  40. neocompute-0.1.0/neocompute/providers/colab.py +661 -0
  41. neocompute-0.1.0/neocompute/providers/gcp.py +600 -0
  42. neocompute-0.1.0/neocompute/providers/huggingface.py +291 -0
  43. neocompute-0.1.0/neocompute/providers/kaggle.py +289 -0
  44. neocompute-0.1.0/neocompute/providers/lightning.py +308 -0
  45. neocompute-0.1.0/neocompute/providers/local.py +514 -0
  46. neocompute-0.1.0/neocompute/providers/modal.py +369 -0
  47. neocompute-0.1.0/neocompute/providers/thunder.py +423 -0
  48. neocompute-0.1.0/neocompute/py.typed +0 -0
  49. neocompute-0.1.0/neocompute/runtime/__init__.py +1 -0
  50. neocompute-0.1.0/neocompute/runtime/bootstrap.py +114 -0
  51. neocompute-0.1.0/neocompute/runtime/context.py +155 -0
  52. neocompute-0.1.0/neocompute/runtime/modal_entry.py +52 -0
  53. neocompute-0.1.0/neocompute/runtime/paths.py +34 -0
  54. neocompute-0.1.0/neocompute/runtime/serialization.py +108 -0
  55. neocompute-0.1.0/neocompute/runtime/volumes.py +516 -0
  56. neocompute-0.1.0/neocompute/runtime/worker.py +257 -0
  57. neocompute-0.1.0/neocompute/storage/__init__.py +44 -0
  58. neocompute-0.1.0/neocompute/storage/artifacts.py +40 -0
  59. neocompute-0.1.0/neocompute/storage/base.py +100 -0
  60. neocompute-0.1.0/neocompute/storage/gcs.py +37 -0
  61. neocompute-0.1.0/neocompute/storage/huggingface.py +53 -0
  62. neocompute-0.1.0/neocompute/storage/local.py +20 -0
  63. neocompute-0.1.0/neocompute/storage/s3.py +42 -0
  64. neocompute-0.1.0/pyproject.toml +72 -0
  65. neocompute-0.1.0/tests/conftest.py +29 -0
  66. neocompute-0.1.0/tests/integration/__init__.py +0 -0
  67. neocompute-0.1.0/tests/integration/test_live.py +118 -0
  68. neocompute-0.1.0/tests/test_cli_dashboard.py +199 -0
  69. neocompute-0.1.0/tests/test_colab.py +343 -0
  70. neocompute-0.1.0/tests/test_function.py +265 -0
  71. neocompute-0.1.0/tests/test_gcp.py +364 -0
  72. neocompute-0.1.0/tests/test_local_provider.py +156 -0
  73. neocompute-0.1.0/tests/test_login.py +248 -0
  74. neocompute-0.1.0/tests/test_providers_more.py +371 -0
  75. neocompute-0.1.0/tests/test_providers_remote.py +429 -0
  76. neocompute-0.1.0/tests/test_remote_runtime.py +159 -0
  77. neocompute-0.1.0/tests/test_resources.py +62 -0
  78. neocompute-0.1.0/tests/test_runtime.py +106 -0
  79. neocompute-0.1.0/tests/test_scheduling.py +210 -0
  80. neocompute-0.1.0/tests/test_storage.py +71 -0
  81. neocompute-0.1.0/tests/test_volumes_failover.py +460 -0
@@ -0,0 +1,8 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .pytest_cache/
8
+ .secret
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MannanB
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,221 @@
1
+ Metadata-Version: 2.5
2
+ Name: neocompute
3
+ Version: 0.1.0
4
+ Summary: Run decorated Python functions on any compute provider, preferring free quotas.
5
+ Project-URL: Homepage, https://github.com/MannanB/NeoCompute
6
+ Project-URL: Documentation, https://github.com/MannanB/NeoCompute/tree/main/docs
7
+ Project-URL: Issues, https://github.com/MannanB/NeoCompute/issues
8
+ Author: MannanB
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: compute,free-tier,gpu,kaggle,modal,scheduling,serverless
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: System :: Distributed Computing
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.11
24
+ Requires-Dist: cloudpickle>=3.0
25
+ Requires-Dist: fsspec>=2024.6
26
+ Requires-Dist: pydantic>=2.6
27
+ Requires-Dist: rich>=13
28
+ Requires-Dist: typer>=0.12
29
+ Provides-Extra: all
30
+ Requires-Dist: gcsfs>=2024.6; extra == 'all'
31
+ Requires-Dist: google-cloud-batch>=0.22; extra == 'all'
32
+ Requires-Dist: google-cloud-billing>=1.21; extra == 'all'
33
+ Requires-Dist: google-cloud-compute>=1.59; extra == 'all'
34
+ Requires-Dist: google-cloud-logging>=3.17; extra == 'all'
35
+ Requires-Dist: huggingface-hub>=1.3; extra == 'all'
36
+ Requires-Dist: kaggle>=2.0; extra == 'all'
37
+ Requires-Dist: lightning-sdk>=2026.12; extra == 'all'
38
+ Requires-Dist: modal>=1.5; extra == 'all'
39
+ Requires-Dist: s3fs>=2024.6; extra == 'all'
40
+ Provides-Extra: dev
41
+ Requires-Dist: build>=1.2; extra == 'dev'
42
+ Requires-Dist: pytest>=8; extra == 'dev'
43
+ Provides-Extra: gcp
44
+ Requires-Dist: gcsfs>=2024.6; extra == 'gcp'
45
+ Requires-Dist: google-cloud-batch>=0.22; extra == 'gcp'
46
+ Requires-Dist: google-cloud-billing>=1.21; extra == 'gcp'
47
+ Requires-Dist: google-cloud-compute>=1.59; extra == 'gcp'
48
+ Requires-Dist: google-cloud-logging>=3.17; extra == 'gcp'
49
+ Provides-Extra: huggingface
50
+ Requires-Dist: huggingface-hub>=1.3; extra == 'huggingface'
51
+ Provides-Extra: kaggle
52
+ Requires-Dist: kaggle>=2.0; extra == 'kaggle'
53
+ Provides-Extra: lightning
54
+ Requires-Dist: lightning-sdk>=2026.12; extra == 'lightning'
55
+ Provides-Extra: modal
56
+ Requires-Dist: modal>=1.5; extra == 'modal'
57
+ Provides-Extra: s3
58
+ Requires-Dist: s3fs>=2024.6; extra == 's3'
59
+ Description-Content-Type: text/markdown
60
+
61
+ <div align="center">
62
+
63
+ # neocompute
64
+
65
+ **Run Python functions on any GPU provider through one API, using free compute first.**
66
+
67
+ ![Python](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-blue)
68
+ ![Platform](https://img.shields.io/badge/platform-linux%20%7C%20macOS%20%7C%20windows-lightgrey)
69
+ ![Status](https://img.shields.io/badge/status-alpha-orange)
70
+ ![License](https://img.shields.io/badge/license-MIT-green)
71
+
72
+ [Quickstart](#quickstart) · [Providers](#providers) · [Python library](docs/lib.md) · [CLI](docs/cli.md) · [Dashboard](docs/dashboard.md) · [Provider guide](docs/providers.md)
73
+
74
+ </div>
75
+
76
+ ---
77
+
78
+ neocompute is a local-first Python library with a Modal-style API. Decorate a function, call `.remote()`, and it runs on Kaggle, Modal, Hugging Face Jobs, Lightning AI, Google Cloud, Colab, Thunder Compute or your own machine. The scheduler picks the cheapest provider that fits, drawing on free allowances and credits before anything that costs money. **It never spends money unless you turn that on.**
79
+
80
+ ```python
81
+ import neocompute as nc
82
+
83
+ app = nc.App("research")
84
+
85
+ @app.function(gpu="T4", timeout=1800)
86
+ def train(lr: float) -> float:
87
+ import torch
88
+ ...
89
+ return loss
90
+
91
+ print(train.remote(3e-4)) # runs on the best free GPU you have access to
92
+ ```
93
+
94
+ ## Why neocompute
95
+
96
+ - **Free first.** Offers are ranked free → free allowance → free credit → paid. With `free_only` (the default), paid offers and offers whose price is unknown are never used, and a job runs only if the allowance covers its **entire** timeout.
97
+ - **One API, many providers.** The same function runs locally, on a Kaggle kernel, a Modal container or a Cloud Batch VM. Each provider states what it can't do, and the scheduler routes around it instead of quietly doing something different.
98
+ - **Failover.** If a machine dies or a job vanishes, the call is resubmitted to the next best offer. Your code resumes from its last `nc.checkpoint`. Errors in your own code are never retried.
99
+ - **Volumes that follow the job.** Datasets and models are built where the job runs (from Hugging Face, a URL, a local folder or a function). Writable volumes are shared through storage you own (`s3://`, `gs://` or `hf://buckets/`).
100
+ - **Your machine is the control plane.** Job history lives in local SQLite. There's no server to run and no account to create: a CLI and a local dashboard show every job, attempt, quota and volume.
101
+
102
+ ## Quickstart
103
+
104
+ **1. Install**
105
+
106
+ ```bash
107
+ pip install neocompute # core + local provider, CLI and dashboard
108
+ pip install 'neocompute[kaggle,modal]' # add the providers you use (or [all])
109
+ ```
110
+
111
+ **2. Log in to a provider or two**
112
+
113
+ ```bash
114
+ ncpt login # see every provider and whether you're logged in
115
+ ncpt login kaggle # paste your API token when asked
116
+ modal token new # Modal, Google Cloud and Colab use their own sign-in
117
+ ```
118
+
119
+ **3. Let neocompute choose**
120
+
121
+ ```bash
122
+ ncpt config init # writes ~/.neocompute/config.toml
123
+ ```
124
+
125
+ ```toml
126
+ # ~/.neocompute/config.toml
127
+ provider = "auto"
128
+ auto_providers = ["local", "kaggle", "modal"]
129
+ free_only = true
130
+ ```
131
+
132
+ **4. Run something**
133
+
134
+ ```python
135
+ import neocompute as nc
136
+
137
+ app = nc.App("hello")
138
+ image = nc.Image.python().pip_install("numpy")
139
+
140
+ @app.function(image=image, gpu=1, timeout=900)
141
+ def matmul(n: int) -> float:
142
+ import numpy as np
143
+ a = np.random.rand(n, n)
144
+ return float((a @ a).sum())
145
+
146
+ if __name__ == "__main__":
147
+ print(matmul.remote(2048)) # run and wait
148
+ call = matmul.spawn(4096) # submit, come back later
149
+ print(call.get())
150
+ print(matmul.map([256, 512, 1024])) # in parallel, results in order
151
+ ```
152
+
153
+ **5. Watch it**
154
+
155
+ ```bash
156
+ ncpt plan --gpu 1 --timeout 900 # where it would run, and why not elsewhere
157
+ ncpt jobs # recent jobs
158
+ ncpt logs -f job-… # follow output
159
+ ncpt dashboard # everything in the browser
160
+ ```
161
+
162
+ The CLI is `ncpt` (`python -m neocompute` works too).
163
+
164
+ ## Providers
165
+
166
+ | Provider | Free compute | GPUs | Cancel | Volumes kept between jobs | Writable volumes and checkpoints | Login |
167
+ | --- | --- | --- | --- | --- | --- | --- |
168
+ | `local` | your machine | whatever it has | ✅ | ✅ | ✅ | none |
169
+ | `kaggle` | CPU; ~30 GPU-h/week | 2× T4 | ❌ | ❌ rebuilt each job | ❌ | `ncpt login kaggle` |
170
+ | `modal` | $30/month credit | T4 to B200 | ✅ | ✅ Modal Volume | ✅ | `modal token new` |
171
+ | `huggingface` | plan credits (if set) | HF Jobs flavors | ✅ | ✅ your HF bucket | ✅ | `ncpt login huggingface` |
172
+ | `lightning` | monthly credit | T4, L4, L40S, A100, H100 | ✅ | ❌ rebuilt each job | needs a home | `ncpt login lightning` |
173
+ | `gcp` | ~$300 trial credit | T4, L4, A100 (paid account) | ✅ | ✅ if the home is `gs://` | needs a home | `gcloud auth application-default login` |
174
+ | `colab` | none: your compute units | T4, L4, G4, A100, H100 | ✅ | ❌ rebuilt each job | needs a home | `colab usage` (browser sign-in) |
175
+ | `thunder` | none: paid hourly | T4, A100, H100 | ✅ | ❌ rebuilt each job | needs a home | `ncpt login thunder` |
176
+
177
+ `remote`, `spawn`, `map`, failover, logs and `nc.plan` work everywhere. A *home* is storage you own (`Config.home`) that carries writable volumes, checkpoints and job files. Lightning, GCP, Colab and Thunder need one to run at all. Limits, options, pricing rules and login details for each provider are in [docs/providers.md](docs/providers.md).
178
+
179
+ ## How it decides where to run
180
+
181
+ 1. Each provider lists **offers**: hardware, price per hour, and the allowance it draws from.
182
+ 2. Offers that can't meet the request (GPU type and count, VRAM, CPU, memory, timeout, required capabilities) are dropped.
183
+ 3. The rest are ranked by **cost tier**, then by the smallest hardware that fits, then by whether the provider already holds the job's data, then by price and your provider order.
184
+ 4. With `free_only`, the paid tier is excluded and **unknown prices count as paid**. An allowance must cover the job's full timeout, and running jobs hold their share in reserve.
185
+
186
+ `ncpt plan` and `nc.plan(...).explain()` print the ranking and the reason each rejected offer was turned down.
187
+
188
+ ## Documentation
189
+
190
+ | | |
191
+ | --- | --- |
192
+ | [Python library](docs/lib.md) | `App`, functions, `Image`, `Volume`, checkpoints, failover, configuration, errors |
193
+ | [Providers](docs/providers.md) | each provider in depth: capabilities, costs, limits, options and how to log in |
194
+ | [CLI](docs/cli.md) | every `ncpt` command |
195
+ | [Dashboard](docs/dashboard.md) | the local web dashboard |
196
+
197
+ ## Project status
198
+
199
+ Alpha. The local provider is fully tested. The remote adapters are written against each provider's current SDK or API and tested with fakes that run the real generated job scripts, but most have not yet run against live accounts. Opt-in integration tests run them for real (see [Development](#development)). APIs may change before 1.0.
200
+
201
+ ## Development
202
+
203
+ ```bash
204
+ git clone https://github.com/MannanB/NeoCompute && cd NeoCompute
205
+ uv venv && uv pip install -e '.[dev]'
206
+ .venv/bin/python -m pytest # unit tests; never touch real accounts
207
+ ```
208
+
209
+ Live tests use your own accounts and keep `free_only` on. A provider without free room is skipped, never billed:
210
+
211
+ ```bash
212
+ NEOCOMPUTE_INTEGRATION=1 NEOCOMPUTE_INTEGRATION_PROVIDERS=local,kaggle,modal \
213
+ NEOCOMPUTE_INTEGRATION_STORAGE=s3://bucket/prefix \
214
+ .venv/bin/python -m pytest tests/integration -v
215
+ ```
216
+
217
+ New providers subclass `neocompute.providers.base.Provider`; see [docs/providers.md](docs/providers.md#writing-a-provider).
218
+
219
+ ## License
220
+
221
+ [MIT](LICENSE)
@@ -0,0 +1,161 @@
1
+ <div align="center">
2
+
3
+ # neocompute
4
+
5
+ **Run Python functions on any GPU provider through one API, using free compute first.**
6
+
7
+ ![Python](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-blue)
8
+ ![Platform](https://img.shields.io/badge/platform-linux%20%7C%20macOS%20%7C%20windows-lightgrey)
9
+ ![Status](https://img.shields.io/badge/status-alpha-orange)
10
+ ![License](https://img.shields.io/badge/license-MIT-green)
11
+
12
+ [Quickstart](#quickstart) · [Providers](#providers) · [Python library](docs/lib.md) · [CLI](docs/cli.md) · [Dashboard](docs/dashboard.md) · [Provider guide](docs/providers.md)
13
+
14
+ </div>
15
+
16
+ ---
17
+
18
+ neocompute is a local-first Python library with a Modal-style API. Decorate a function, call `.remote()`, and it runs on Kaggle, Modal, Hugging Face Jobs, Lightning AI, Google Cloud, Colab, Thunder Compute or your own machine. The scheduler picks the cheapest provider that fits, drawing on free allowances and credits before anything that costs money. **It never spends money unless you turn that on.**
19
+
20
+ ```python
21
+ import neocompute as nc
22
+
23
+ app = nc.App("research")
24
+
25
+ @app.function(gpu="T4", timeout=1800)
26
+ def train(lr: float) -> float:
27
+ import torch
28
+ ...
29
+ return loss
30
+
31
+ print(train.remote(3e-4)) # runs on the best free GPU you have access to
32
+ ```
33
+
34
+ ## Why neocompute
35
+
36
+ - **Free first.** Offers are ranked free → free allowance → free credit → paid. With `free_only` (the default), paid offers and offers whose price is unknown are never used, and a job runs only if the allowance covers its **entire** timeout.
37
+ - **One API, many providers.** The same function runs locally, on a Kaggle kernel, a Modal container or a Cloud Batch VM. Each provider states what it can't do, and the scheduler routes around it instead of quietly doing something different.
38
+ - **Failover.** If a machine dies or a job vanishes, the call is resubmitted to the next best offer. Your code resumes from its last `nc.checkpoint`. Errors in your own code are never retried.
39
+ - **Volumes that follow the job.** Datasets and models are built where the job runs (from Hugging Face, a URL, a local folder or a function). Writable volumes are shared through storage you own (`s3://`, `gs://` or `hf://buckets/`).
40
+ - **Your machine is the control plane.** Job history lives in local SQLite. There's no server to run and no account to create: a CLI and a local dashboard show every job, attempt, quota and volume.
41
+
42
+ ## Quickstart
43
+
44
+ **1. Install**
45
+
46
+ ```bash
47
+ pip install neocompute # core + local provider, CLI and dashboard
48
+ pip install 'neocompute[kaggle,modal]' # add the providers you use (or [all])
49
+ ```
50
+
51
+ **2. Log in to a provider or two**
52
+
53
+ ```bash
54
+ ncpt login # see every provider and whether you're logged in
55
+ ncpt login kaggle # paste your API token when asked
56
+ modal token new # Modal, Google Cloud and Colab use their own sign-in
57
+ ```
58
+
59
+ **3. Let neocompute choose**
60
+
61
+ ```bash
62
+ ncpt config init # writes ~/.neocompute/config.toml
63
+ ```
64
+
65
+ ```toml
66
+ # ~/.neocompute/config.toml
67
+ provider = "auto"
68
+ auto_providers = ["local", "kaggle", "modal"]
69
+ free_only = true
70
+ ```
71
+
72
+ **4. Run something**
73
+
74
+ ```python
75
+ import neocompute as nc
76
+
77
+ app = nc.App("hello")
78
+ image = nc.Image.python().pip_install("numpy")
79
+
80
+ @app.function(image=image, gpu=1, timeout=900)
81
+ def matmul(n: int) -> float:
82
+ import numpy as np
83
+ a = np.random.rand(n, n)
84
+ return float((a @ a).sum())
85
+
86
+ if __name__ == "__main__":
87
+ print(matmul.remote(2048)) # run and wait
88
+ call = matmul.spawn(4096) # submit, come back later
89
+ print(call.get())
90
+ print(matmul.map([256, 512, 1024])) # in parallel, results in order
91
+ ```
92
+
93
+ **5. Watch it**
94
+
95
+ ```bash
96
+ ncpt plan --gpu 1 --timeout 900 # where it would run, and why not elsewhere
97
+ ncpt jobs # recent jobs
98
+ ncpt logs -f job-… # follow output
99
+ ncpt dashboard # everything in the browser
100
+ ```
101
+
102
+ The CLI is `ncpt` (`python -m neocompute` works too).
103
+
104
+ ## Providers
105
+
106
+ | Provider | Free compute | GPUs | Cancel | Volumes kept between jobs | Writable volumes and checkpoints | Login |
107
+ | --- | --- | --- | --- | --- | --- | --- |
108
+ | `local` | your machine | whatever it has | ✅ | ✅ | ✅ | none |
109
+ | `kaggle` | CPU; ~30 GPU-h/week | 2× T4 | ❌ | ❌ rebuilt each job | ❌ | `ncpt login kaggle` |
110
+ | `modal` | $30/month credit | T4 to B200 | ✅ | ✅ Modal Volume | ✅ | `modal token new` |
111
+ | `huggingface` | plan credits (if set) | HF Jobs flavors | ✅ | ✅ your HF bucket | ✅ | `ncpt login huggingface` |
112
+ | `lightning` | monthly credit | T4, L4, L40S, A100, H100 | ✅ | ❌ rebuilt each job | needs a home | `ncpt login lightning` |
113
+ | `gcp` | ~$300 trial credit | T4, L4, A100 (paid account) | ✅ | ✅ if the home is `gs://` | needs a home | `gcloud auth application-default login` |
114
+ | `colab` | none: your compute units | T4, L4, G4, A100, H100 | ✅ | ❌ rebuilt each job | needs a home | `colab usage` (browser sign-in) |
115
+ | `thunder` | none: paid hourly | T4, A100, H100 | ✅ | ❌ rebuilt each job | needs a home | `ncpt login thunder` |
116
+
117
+ `remote`, `spawn`, `map`, failover, logs and `nc.plan` work everywhere. A *home* is storage you own (`Config.home`) that carries writable volumes, checkpoints and job files. Lightning, GCP, Colab and Thunder need one to run at all. Limits, options, pricing rules and login details for each provider are in [docs/providers.md](docs/providers.md).
118
+
119
+ ## How it decides where to run
120
+
121
+ 1. Each provider lists **offers**: hardware, price per hour, and the allowance it draws from.
122
+ 2. Offers that can't meet the request (GPU type and count, VRAM, CPU, memory, timeout, required capabilities) are dropped.
123
+ 3. The rest are ranked by **cost tier**, then by the smallest hardware that fits, then by whether the provider already holds the job's data, then by price and your provider order.
124
+ 4. With `free_only`, the paid tier is excluded and **unknown prices count as paid**. An allowance must cover the job's full timeout, and running jobs hold their share in reserve.
125
+
126
+ `ncpt plan` and `nc.plan(...).explain()` print the ranking and the reason each rejected offer was turned down.
127
+
128
+ ## Documentation
129
+
130
+ | | |
131
+ | --- | --- |
132
+ | [Python library](docs/lib.md) | `App`, functions, `Image`, `Volume`, checkpoints, failover, configuration, errors |
133
+ | [Providers](docs/providers.md) | each provider in depth: capabilities, costs, limits, options and how to log in |
134
+ | [CLI](docs/cli.md) | every `ncpt` command |
135
+ | [Dashboard](docs/dashboard.md) | the local web dashboard |
136
+
137
+ ## Project status
138
+
139
+ Alpha. The local provider is fully tested. The remote adapters are written against each provider's current SDK or API and tested with fakes that run the real generated job scripts, but most have not yet run against live accounts. Opt-in integration tests run them for real (see [Development](#development)). APIs may change before 1.0.
140
+
141
+ ## Development
142
+
143
+ ```bash
144
+ git clone https://github.com/MannanB/NeoCompute && cd NeoCompute
145
+ uv venv && uv pip install -e '.[dev]'
146
+ .venv/bin/python -m pytest # unit tests; never touch real accounts
147
+ ```
148
+
149
+ Live tests use your own accounts and keep `free_only` on. A provider without free room is skipped, never billed:
150
+
151
+ ```bash
152
+ NEOCOMPUTE_INTEGRATION=1 NEOCOMPUTE_INTEGRATION_PROVIDERS=local,kaggle,modal \
153
+ NEOCOMPUTE_INTEGRATION_STORAGE=s3://bucket/prefix \
154
+ .venv/bin/python -m pytest tests/integration -v
155
+ ```
156
+
157
+ New providers subclass `neocompute.providers.base.Provider`; see [docs/providers.md](docs/providers.md#writing-a-provider).
158
+
159
+ ## License
160
+
161
+ [MIT](LICENSE)
@@ -0,0 +1,179 @@
1
+ # Command line
2
+
3
+ Installing neocompute adds the `ncpt` command. `python -m neocompute` does the same.
4
+
5
+ ```text
6
+ ncpt [--state-dir PATH] [--provider NAME] COMMAND [ARGS]
7
+ ```
8
+
9
+ | Global option | |
10
+ | --- | --- |
11
+ | `--state-dir PATH` | state directory for this command (default `~/.neocompute`) |
12
+ | `--provider`, `-p NAME` | default provider for this command |
13
+
14
+ `ID` below is a job id (`job-…`) or a call id (`call-…`). A call id means the call's latest attempt. Most commands that list things accept `--json`.
15
+
16
+ ## Contents
17
+
18
+ - [Configuration](#configuration): `config init`, `config show`, `config path`
19
+ - [Logging in](#logging-in): `login`
20
+ - [Jobs](#jobs): `jobs`, `status`, `logs`, `result`, `cancel`, `cleanup`
21
+ - [Providers and quotas](#providers-and-quotas): `providers`, `quotas`, `plan`
22
+ - [Volumes](#volumes): `volumes list`, `ls`, `upload`, `download`, `rm`, `delete`
23
+ - [Dashboard](#dashboard): `dashboard`
24
+ - [Other](#other): `version`
25
+
26
+ ## Configuration
27
+
28
+ The CLI and the dashboard run in their own process, so they never see `nc.configure(...)` calls in your code. They read the config file instead, and so does your code, so shared settings belong there.
29
+
30
+ ```bash
31
+ ncpt config init [--force] # write a commented template
32
+ ncpt config show # the effective configuration as JSON, credentials masked
33
+ ncpt config path # where the file is read from
34
+ ```
35
+
36
+ The file is `~/.neocompute/config.toml`, or `$NEOCOMPUTE_CONFIG`. Precedence, lowest first:
37
+
38
+ 1. defaults
39
+ 2. the config file
40
+ 3. `NEOCOMPUTE_PROVIDER`, `NEOCOMPUTE_FREE_ONLY`, `NEOCOMPUTE_STATE_DIR`, `NEOCOMPUTE_HOME`
41
+ 4. `nc.configure(...)` in Python, or `--provider` / `--state-dir` on the command line
42
+
43
+ ```toml
44
+ provider = "auto"
45
+ auto_providers = ["local", "kaggle", "modal"]
46
+ free_only = true
47
+ home = "hf://buckets/me/neocompute" # or gs://..., s3://...
48
+ max_attempts = 3
49
+
50
+ [providers.kaggle]
51
+ gpu_hours_per_week = 30
52
+
53
+ [providers.modal]
54
+ monthly_credits_usd = 30
55
+ ```
56
+
57
+ The keys are those of `nc.Config` ([library docs](lib.md#configuration)). Per-provider options are listed in [providers.md](providers.md).
58
+
59
+ ## Logging in
60
+
61
+ ```bash
62
+ ncpt login # every provider: logged in or not, and how to log in
63
+ ncpt login PROVIDER [--force] # save credentials for one provider
64
+ ```
65
+
66
+ `ncpt login kaggle` (or `huggingface`, `lightning`, `thunder`) tells you where to get the token, then asks you to paste it. Input is hidden. If credentials already exist it asks before replacing them; `--force` skips the question. After saving, it warns you if the provider still isn't usable, for example because its SDK isn't installed.
67
+
68
+ For `modal`, `gcp` and `colab`, `ncpt login` only prints the command to run: those providers sign in with their own tools through a browser.
69
+
70
+ ```text
71
+ $ ncpt login
72
+ PROVIDER LOGGED IN HOW
73
+ local not needed -
74
+ huggingface huggingface_hub token ncpt login huggingface
75
+ kaggle no ncpt login kaggle
76
+ lightning no ncpt login lightning
77
+ thunder no ncpt login thunder
78
+ modal ~/.modal.toml modal token new
79
+ gcp no gcloud auth application-default login
80
+ colab no colab usage
81
+ ```
82
+
83
+ What each provider asks for and where it's saved: [providers.md](providers.md#logging-in).
84
+
85
+ ## Jobs
86
+
87
+ ### `ncpt jobs`
88
+
89
+ Lists recent jobs, newest first. It asks providers about unfinished jobs before printing.
90
+
91
+ | Option | |
92
+ | --- | --- |
93
+ | `--state S` | only jobs in this state: `pending`, `running`, `succeeded`, `failed`, `cancelled` |
94
+ | `--provider P` | only jobs on this provider |
95
+ | `--function F` | only this function, as `app.function` |
96
+ | `-n`, `--limit N` | how many (default 25) |
97
+ | `--no-refresh` | don't ask providers first |
98
+ | `--json` | machine-readable output |
99
+
100
+ ### `ncpt status ID [--json]`
101
+
102
+ Shows one job, refreshed from its provider: state, provider, offer, timings, failure kind and message. It also lists every attempt of its call, so you can see where a failover went.
103
+
104
+ ### `ncpt logs ID [-f]`
105
+
106
+ Prints a job's output. `-f`/`--follow` keeps printing until the job ends.
107
+
108
+ ### `ncpt result ID [--timeout S]`
109
+
110
+ Waits for a call to finish and prints its return value. Failover still happens if an attempt hits an infrastructure failure. If the function raised, it prints the exception and exits with status 1; if `--timeout` runs out, it exits with status 2.
111
+
112
+ ### `ncpt cancel ID`
113
+
114
+ Cancels a job. Kaggle has no cancel API, so for Kaggle jobs this prints a link to stop it by hand.
115
+
116
+ ### `ncpt cleanup [ID] [--older-than DAYS] [--forget] [-y]`
117
+
118
+ Releases provider resources held by finished jobs: job files, remote bundles, Kaggle kernels, Thunder instances and Colab runtimes.
119
+
120
+ | Option | |
121
+ | --- | --- |
122
+ | `ID` | clean only this job or call |
123
+ | `--older-than DAYS` | finished jobs older than this (default 7) |
124
+ | `--forget` | also remove them from the job history |
125
+ | `-y`, `--yes` | don't ask for confirmation |
126
+
127
+ Run it after jobs that ended while no client was watching. A Thunder instance or Colab runtime keeps billing until it's deleted.
128
+
129
+ ## Providers and quotas
130
+
131
+ ### `ncpt providers [--offers] [--json]`
132
+
133
+ Shows each provider, whether it's usable on this machine and, if not, why (not installed, no credentials, no home, ...). It also shows whether each one supports GPUs, volumes and cancel. `--offers` lists each provider's hardware and price per hour; this calls provider APIs.
134
+
135
+ ### `ncpt quotas [--json]`
136
+
137
+ Shows free allowances (Kaggle GPU hours, Modal credit, GCP trial credit, Colab units, ...): the limit, what's used, what running jobs hold in reserve, what's left, and when it resets or expires. Each row says whether the numbers come from the provider or from local tracking.
138
+
139
+ ### `ncpt plan [--gpu G] [--cpu C] [--memory GB] [--timeout S] [--provider P] [--json]`
140
+
141
+ Shows where a job with these requirements would run, without submitting anything: the eligible offers ranked best first, then every rejected offer with its reason.
142
+
143
+ ```bash
144
+ ncpt plan --gpu T4 --timeout 1800
145
+ ncpt plan --gpu A100:2 --memory 64
146
+ ncpt plan --gpu 1 --provider modal
147
+ ```
148
+
149
+ `--gpu` accepts a count (`1`), a type (`T4`) or both (`A100:2`). `--timeout` matters because an allowance must cover the whole timeout.
150
+
151
+ ## Volumes
152
+
153
+ These commands manage **writable** volumes: the copy in your home, or this machine's copy if you have no home. See [volumes in the library docs](lib.md#volumes).
154
+
155
+ ```bash
156
+ ncpt volumes list [--json] # name, files, size, last change
157
+ ncpt volumes ls NAME [PATH] # files, optionally under PATH
158
+ ncpt volumes upload NAME SRC [PATH] # add a file or directory at PATH (replaces same-named files)
159
+ ncpt volumes download NAME DEST [PATH] # copy the volume, or PATH in it, into DEST
160
+ ncpt volumes rm NAME PATH... # delete files
161
+ ncpt volumes delete NAME [-y] # delete the whole volume and its history
162
+ ```
163
+
164
+ ## Dashboard
165
+
166
+ ```bash
167
+ ncpt dashboard [--port 8765] [--no-open] [--host 127.0.0.1]
168
+ ```
169
+
170
+ Starts the local web dashboard and opens it in your browser. `--port 0` picks a free port. See [dashboard.md](dashboard.md), and read its security notes before changing `--host`.
171
+
172
+ ## Other
173
+
174
+ ```bash
175
+ ncpt version # the installed version
176
+ ncpt --help # every command; `ncpt COMMAND --help` for one
177
+ ```
178
+
179
+ Errors from neocompute print as `error: …` and exit with status 1.
@@ -0,0 +1,68 @@
1
+ # Dashboard
2
+
3
+ A local web page showing your jobs, attempts, free allowances, providers and volumes.
4
+
5
+ ```bash
6
+ ncpt dashboard # starts the server and opens your browser
7
+ ncpt dashboard --no-open # just print the URL
8
+ ncpt dashboard --port 0 # pick a free port (default 8765)
9
+ ```
10
+
11
+ It reads the same state directory and config file as the CLI, so it shows jobs started from any Python process on this machine. Stop it with Ctrl-C. Your jobs keep running without it.
12
+
13
+ ## What's on it
14
+
15
+ **Overview tiles**
16
+ - jobs in the last 30 days
17
+ - jobs running now
18
+ - success rate
19
+ - compute used, at list price (before free credit is applied)
20
+
21
+ **Activity**
22
+ - jobs per day for the last 14 days, split by outcome
23
+ - a table view of the same data
24
+
25
+ **Free allowances**
26
+ - one meter per quota (Kaggle GPU hours, Modal credit, GCP trial credit, Colab units, ...)
27
+ - each meter shows what's used, what running jobs hold in reserve, and what's left, with the reset or expiry time
28
+
29
+ **Jobs**
30
+ - the job list, filterable by state, provider and free text
31
+ - click a job to see:
32
+ - its details and failure kind
33
+ - every failover attempt of its call
34
+ - the remote traceback, if your function raised
35
+ - live output
36
+ - a **Cancel** button
37
+
38
+ **Providers**
39
+ - readiness (or why a provider isn't usable)
40
+ - capabilities
41
+ - offers with prices (expand to see all)
42
+
43
+ **Volumes**
44
+ - writable volumes with their file counts and sizes
45
+
46
+ ## Refreshing
47
+
48
+ | What | When |
49
+ | --- | --- |
50
+ | jobs and job output | every 3 seconds |
51
+ | provider offers and quotas | every minute, or when you press **Refresh** |
52
+
53
+ Offers and quotas can call provider APIs, so they're fetched only for providers in `auto_providers`, or for the default provider.
54
+
55
+ ## Links and theme
56
+
57
+ - Adding `&job=<job id>` to the URL (after the token) opens that job's details directly.
58
+ - The page follows your system's light or dark theme. The moon button switches it.
59
+
60
+ ## Security
61
+
62
+ The dashboard can cancel jobs, so it's locked to you:
63
+
64
+ - The server listens on `127.0.0.1` only.
65
+ - Every API request must carry a random token. The token is part of the URL the command prints and opens. It sits after `#`, so it never reaches server logs or `Referer` headers.
66
+ - Requests whose `Host` header isn't the server itself are refused. This blocks DNS-rebinding attacks, so other web pages open in your browser can't read or cancel your jobs.
67
+
68
+ Don't pass `--host 0.0.0.0` unless you trust every machine that can reach yours: anyone with the URL can see and cancel your jobs.