fromscratch-pystack 0.5.0__tar.gz → 0.6.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.
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/CLAUDE.md +1 -1
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/PKG-INFO +90 -29
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/README.md +87 -27
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/docs/index.md +67 -3
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/pyproject.toml +2 -1
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/_version.py +2 -2
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/environment.py +3 -1
- fromscratch_pystack-0.6.0/src/pystack/plugins/cpu_plugin.py +180 -0
- fromscratch_pystack-0.6.0/tests/test_cpu_plugin.py +203 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_dependency_pins.py +1 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/uv.lock +21 -5
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/.github/workflows/ci.yml +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/.github/workflows/docs.yml +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/.github/workflows/release.yml +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/.gitignore +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/.pre-commit-config.yaml +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/CONTRIBUTING.md +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/LICENSE +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/conftest.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/docs/property-testing.md +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/docs/superpowers/plans/2026-10-17-pebble-api-and-plugin-state.md +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/docs/superpowers/plans/2026-10-17-pin-sibling-deps.md +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/docs/superpowers/plans/2026-10-17-series-home-and-standards.md +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/docs/superpowers/plans/2026-10-18-property-based-tests.md +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/docs/superpowers/specs/2026-10-17-pebble-api-and-plugin-state-design.md +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/docs/superpowers/specs/2026-10-17-pin-sibling-deps-design.md +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/docs/superpowers/specs/2026-10-17-series-home-and-standards-design.md +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/docs/superpowers/specs/2026-10-18-property-based-tests-design.md +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/examples/gradebook.pbl +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/examples/hello.pbl +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/mkdocs.yml +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/overrides/main.html +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/__init__.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/adapters/__init__.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/adapters/db_storage.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/adapters/os_pebble.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/adapters/pebble_db.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/cli.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/__init__.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/_dbcrash_child.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/_schedagents.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/_schedalerts.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/_schedweb.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/_shared.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/_webdemo.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/base.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/coldb_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/crypto_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/docdb_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/git_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/graphdb_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/kv_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/llm_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/mq_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/net_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/pydb_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/registry.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/sched_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/search_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/tsdb_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/vecdb_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/plugins/web_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/py.typed +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/web/__init__.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/web/app.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/web/static/app.js +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/web/static/style.css +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/src/pystack/web/templates/index.html +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/__init__.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/strategies.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_cli_without_flask.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_dbcrash.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_edge_cases.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_integration_plugins.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_llm_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_model.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_nosql_plugins.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_os_integration.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_pebble_db.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_pebble_front_door.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_plugin_lifecycle.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_plugin_persistence.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_plugins.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_properties.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_sched_plugin.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_schedagents.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_schedalerts.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_schedweb.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_web.py +0 -0
- {fromscratch_pystack-0.5.0 → fromscratch_pystack-0.6.0}/tests/test_webdemo_sockets.py +0 -0
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
- Package manager: uv
|
|
34
34
|
- Run `uv sync --all-extras` after modifying dependencies
|
|
35
35
|
- `uv.lock` is committed; CI and pre-commit audit it with pip-audit through `uvx`, so pip-audit is not a project dependency
|
|
36
|
-
- Sibling projects, where used, are
|
|
36
|
+
- Sibling projects, where used, are their PyPI releases (`fromscratch-<name>>=X.Y.Z`); never use `path` or git sources
|
|
37
37
|
|
|
38
38
|
## Releasing
|
|
39
39
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: fromscratch-pystack
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: Every project in the from-scratch-in-Python series joined into one working platform
|
|
5
5
|
Project-URL: Homepage, https://github.com/robcox2910/pystack
|
|
6
6
|
Project-URL: Repository, https://github.com/robcox2910/pystack
|
|
@@ -18,8 +18,9 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
18
18
|
Classifier: Topic :: Education
|
|
19
19
|
Classifier: Typing :: Typed
|
|
20
20
|
Requires-Python: >=3.14
|
|
21
|
-
Requires-Dist: fromscratch-pebble>=0.
|
|
21
|
+
Requires-Dist: fromscratch-pebble>=0.4.1
|
|
22
22
|
Requires-Dist: fromscratch-pycoldb>=0.4.0
|
|
23
|
+
Requires-Dist: fromscratch-pycpu>=0.1.0
|
|
23
24
|
Requires-Dist: fromscratch-pycrypt>=0.2.0
|
|
24
25
|
Requires-Dist: fromscratch-pydb>=0.5.0
|
|
25
26
|
Requires-Dist: fromscratch-pydocdb>=0.3.0
|
|
@@ -53,7 +54,7 @@ Description-Content-Type: text/markdown
|
|
|
53
54
|
|
|
54
55
|
The full stack, from scratch.
|
|
55
56
|
|
|
56
|
-
PyStack connects **
|
|
57
|
+
PyStack connects **EIGHTEEN** educational projects into one integrated
|
|
57
58
|
platform. Think of it like a school:
|
|
58
59
|
|
|
59
60
|
| Project | Role | School Analogy |
|
|
@@ -74,6 +75,7 @@ platform. Think of it like a school:
|
|
|
74
75
|
| **PyVecDB** | Vector database | The "find similar" recommendation board |
|
|
75
76
|
| **PyColDB** | Column-family store | The flexible report cards |
|
|
76
77
|
| **PyLLM** | Language model | The imagination — the brain that dreams up new text |
|
|
78
|
+
| **PyCPU** | A computer built from NAND gates | The clockwork robot in the science lab — every cog on show |
|
|
77
79
|
| **PyStack** | Integration layer | The hallways connecting everything |
|
|
78
80
|
|
|
79
81
|
PyStack is the hallways. Without hallways, you can't get from the
|
|
@@ -83,7 +85,7 @@ and send messages -- all in one program.
|
|
|
83
85
|
|
|
84
86
|
## What Can You Do?
|
|
85
87
|
|
|
86
|
-
PyStack adds **
|
|
88
|
+
PyStack adds **15 Pebble modules** so your programs can use every
|
|
87
89
|
project. Just `import` the one you need.
|
|
88
90
|
|
|
89
91
|
### Database -- `import "db"`
|
|
@@ -305,11 +307,59 @@ let a = value * (25 + 14)
|
|
|
305
307
|
print(step())
|
|
306
308
|
```
|
|
307
309
|
|
|
310
|
+
### Computer from NAND gates -- `import "cpu"`
|
|
311
|
+
|
|
312
|
+
A NAND gate is the tiniest switch there is: it answers "no" only when both of
|
|
313
|
+
its inputs say "yes". [PyCPU](https://robcox2910.github.io/pycpu/) stacks
|
|
314
|
+
thousands of them, like LEGO bricks, into adders, memory and a whole
|
|
315
|
+
processor. Handing it a Pebble program is like handing a recipe to a cook who
|
|
316
|
+
only reads number codes: PyCPU translates the recipe into those codes, and the
|
|
317
|
+
gate-built computer carries them out one instruction at a time.
|
|
318
|
+
|
|
319
|
+
```
|
|
320
|
+
import "cpu"
|
|
321
|
+
|
|
322
|
+
let program = "let a = 6\nlet b = 7\nprint(a * b)"
|
|
323
|
+
print(cpu_run(program))
|
|
324
|
+
print(cpu_steps(program))
|
|
325
|
+
|
|
326
|
+
print(cpu_run("print(1)\nlet x = 0\nprint(10 // x)"))
|
|
327
|
+
print(cpu_run("print([1, 2])"))
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
prints:
|
|
331
|
+
|
|
332
|
+
```
|
|
333
|
+
42
|
|
334
|
+
|
|
335
|
+
393
|
|
336
|
+
1
|
|
337
|
+
Division by zero at line 3
|
|
338
|
+
error: lists are not supported on PyCPU yet at line 1, column 7
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
`cpu_run` gives back what the program printed (here `42` and its newline, so
|
|
342
|
+
`print` adds a blank line). `cpu_steps` counts the instructions the computer
|
|
343
|
+
carried out. If the program goes wrong, you get what it printed so far and a
|
|
344
|
+
sentence saying what happened; if it uses something PyCPU can't do yet, like a
|
|
345
|
+
list, you get an `error:` message instead.
|
|
346
|
+
|
|
347
|
+
To watch the gates themselves, type `cockpit` in `pystack os`. It opens PyCPU's
|
|
348
|
+
Cockpit in the background and tells you where to look:
|
|
349
|
+
|
|
350
|
+
```
|
|
351
|
+
pystack-os> cockpit
|
|
352
|
+
The Cockpit is open at http://127.0.0.1:8765
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
Building the full-size computer takes a few seconds. The Cockpit closes when
|
|
356
|
+
PyStack stops.
|
|
357
|
+
|
|
308
358
|
## All Commands
|
|
309
359
|
|
|
310
360
|
| Command | What It Does |
|
|
311
361
|
|---------|-------------|
|
|
312
|
-
| `pystack pebble <file.pbl>` | Run a Pebble program with all
|
|
362
|
+
| `pystack pebble <file.pbl>` | Run a Pebble program with all 15 modules available |
|
|
313
363
|
| `pystack sql` | Interactive SQL REPL |
|
|
314
364
|
| `pystack os` | PyOS shell with Pebble, SQL, and plugin commands |
|
|
315
365
|
| `pystack web` | Browser-based UI at http://localhost:8080 |
|
|
@@ -353,11 +403,12 @@ When you run `pystack os`, these commands are available at the
|
|
|
353
403
|
| `vec <insert\|search\|cosine> ...` | Vector database operations | PyVecDB |
|
|
354
404
|
| `col <set\|get> <family> <row> <col> [value]` | Column-family operations | PyColDB |
|
|
355
405
|
| `dream <prompt>` | Dream up new Pokemon names | PyLLM |
|
|
406
|
+
| `cockpit` | Open PyCPU's Cockpit in the background and print its address | PyCPU |
|
|
356
407
|
|
|
357
408
|
## Quick Start
|
|
358
409
|
|
|
359
410
|
```bash
|
|
360
|
-
# Install dependencies (released versions of all
|
|
411
|
+
# Install dependencies (released versions of all 18 sibling projects)
|
|
361
412
|
uv sync --all-extras
|
|
362
413
|
|
|
363
414
|
# Run an example program
|
|
@@ -384,7 +435,7 @@ into a sibling can't affect PyStack until the sibling publishes a release and
|
|
|
384
435
|
PyStack chooses to upgrade.
|
|
385
436
|
|
|
386
437
|
To try an unreleased change from a sibling checkout next to this one, install
|
|
387
|
-
it over the
|
|
438
|
+
it over the released version:
|
|
388
439
|
|
|
389
440
|
```bash
|
|
390
441
|
uv pip install -e ../pebble-lang
|
|
@@ -392,7 +443,7 @@ uv run --no-sync pytest
|
|
|
392
443
|
```
|
|
393
444
|
|
|
394
445
|
Use `uv run --no-sync` while you do this: a plain `uv run` (like `uv sync`)
|
|
395
|
-
puts the
|
|
446
|
+
puts the released version back, which is how you undo the override.
|
|
396
447
|
|
|
397
448
|
To upgrade a sibling, raise its minimum version in `pyproject.toml`, run
|
|
398
449
|
`uv lock --upgrade-package fromscratch-<name>`, and open a pull request so CI
|
|
@@ -401,7 +452,8 @@ checks the pair together.
|
|
|
401
452
|
## Releasing
|
|
402
453
|
|
|
403
454
|
1. Merge the change to `main`.
|
|
404
|
-
2.
|
|
455
|
+
2. Release it: `gh release create vX.Y.Z --target main --generate-notes`
|
|
456
|
+
(or push a `vX.Y.Z` tag); the release workflow publishes it to PyPI.
|
|
405
457
|
A change to the public API bumps the minor version (`v0.1.0` → `v0.2.0`);
|
|
406
458
|
anything else bumps the patch (`v0.1.0` → `v0.1.1`).
|
|
407
459
|
|
|
@@ -450,6 +502,7 @@ include:
|
|
|
450
502
|
| PyDBPlugin | (none) | `dbcrash` |
|
|
451
503
|
| PySchedulerPlugin | (none) | `sched`, `schedagents`, `schedalerts`, `schedweb` |
|
|
452
504
|
| LLMPlugin | `llm` | `dream` |
|
|
505
|
+
| CPUPlugin | `cpu` | `cockpit` |
|
|
453
506
|
|
|
454
507
|
The `db` module comes from the Pebble-DB adapter instead of a plugin,
|
|
455
508
|
because it needs this environment's database.
|
|
@@ -477,32 +530,40 @@ registered manually in the `PyStackEnvironment`.
|
|
|
477
530
|
|
|
478
531
|
This project is one of a series that builds real systems "from scratch in Python" to teach how they work. See the [series home](https://robcox2910.github.io/) for the full story.
|
|
479
532
|
|
|
480
|
-
| Project | What it teaches | Repository | Docs |
|
|
481
|
-
| --- | --- | --- | --- |
|
|
482
|
-
| PyOS | Operating systems | [py-os](https://github.com/robcox2910/py-os) | [Docs](https://robcox2910.github.io/py-os/) |
|
|
483
|
-
| Pebble | Compilers and programming languages | [pebble-lang](https://github.com/robcox2910/pebble-lang) | [Docs](https://robcox2910.github.io/pebble-lang/) |
|
|
484
|
-
| PyDB | Relational databases | [pydb](https://github.com/robcox2910/pydb) | [Docs](https://robcox2910.github.io/pydb/) |
|
|
485
|
-
| PyKV | Key-value stores | [pykv](https://github.com/robcox2910/pykv) | [Docs](https://robcox2910.github.io/pykv/) |
|
|
486
|
-
| PyDocDB | Document databases | [pydoc-db](https://github.com/robcox2910/pydoc-db) | [Docs](https://robcox2910.github.io/pydoc-db/) |
|
|
487
|
-
| PyGraphDB | Graph databases | [pygraphdb](https://github.com/robcox2910/pygraphdb) | [Docs](https://robcox2910.github.io/pygraphdb/) |
|
|
488
|
-
| PyTSDB | Time-series databases | [pytsdb](https://github.com/robcox2910/pytsdb) | [Docs](https://robcox2910.github.io/pytsdb/) |
|
|
489
|
-
| PyVecDB | Vector databases | [pyvecdb](https://github.com/robcox2910/pyvecdb) | [Docs](https://robcox2910.github.io/pyvecdb/) |
|
|
490
|
-
| PyColDB | Column-family databases | [pycoldb](https://github.com/robcox2910/pycoldb) | [Docs](https://robcox2910.github.io/pycoldb/) |
|
|
491
|
-
| PyCrypt | Cryptography | [pycrypt](https://github.com/robcox2910/pycrypt) | [Docs](https://robcox2910.github.io/pycrypt/) |
|
|
492
|
-
| PyNet | Computer networking | [pynet](https://github.com/robcox2910/pynet) | [Docs](https://robcox2910.github.io/pynet/) |
|
|
493
|
-
| PyWeb | HTTP web servers | [pyweb](https://github.com/robcox2910/pyweb) | [Docs](https://robcox2910.github.io/pyweb/) |
|
|
494
|
-
| PyGit | Version control | [pygit](https://github.com/robcox2910/pygit) | [Docs](https://robcox2910.github.io/pygit/) |
|
|
495
|
-
| PySearch | Search engines | [pysearch](https://github.com/robcox2910/pysearch) | [Docs](https://robcox2910.github.io/pysearch/) |
|
|
496
|
-
| PyMQ | Message queues | [pymq](https://github.com/robcox2910/pymq) | [Docs](https://robcox2910.github.io/pymq/) |
|
|
497
|
-
| PyLLM | Language models (the brain) | [pyllm](https://github.com/robcox2910/pyllm) | [Docs](https://robcox2910.github.io/pyllm/) |
|
|
498
|
-
| PyScheduler | Job scheduling | [pyscheduler](https://github.com/robcox2910/pyscheduler) | [Docs](https://robcox2910.github.io/pyscheduler/) |
|
|
499
|
-
| **PyStack** | **Full-stack integration** | [pystack](https://github.com/robcox2910/pystack) | [Docs](https://robcox2910.github.io/pystack/) |
|
|
533
|
+
| Project | What it teaches | Repository | Docs | PyPI |
|
|
534
|
+
| --- | --- | --- | --- | --- |
|
|
535
|
+
| PyOS | Operating systems | [py-os](https://github.com/robcox2910/py-os) | [Docs](https://robcox2910.github.io/py-os/) | [fromscratch-pyos](https://pypi.org/project/fromscratch-pyos/) |
|
|
536
|
+
| Pebble | Compilers and programming languages | [pebble-lang](https://github.com/robcox2910/pebble-lang) | [Docs](https://robcox2910.github.io/pebble-lang/) | [fromscratch-pebble](https://pypi.org/project/fromscratch-pebble/) |
|
|
537
|
+
| PyDB | Relational databases | [pydb](https://github.com/robcox2910/pydb) | [Docs](https://robcox2910.github.io/pydb/) | [fromscratch-pydb](https://pypi.org/project/fromscratch-pydb/) |
|
|
538
|
+
| PyKV | Key-value stores | [pykv](https://github.com/robcox2910/pykv) | [Docs](https://robcox2910.github.io/pykv/) | [fromscratch-pykv](https://pypi.org/project/fromscratch-pykv/) |
|
|
539
|
+
| PyDocDB | Document databases | [pydoc-db](https://github.com/robcox2910/pydoc-db) | [Docs](https://robcox2910.github.io/pydoc-db/) | [fromscratch-pydocdb](https://pypi.org/project/fromscratch-pydocdb/) |
|
|
540
|
+
| PyGraphDB | Graph databases | [pygraphdb](https://github.com/robcox2910/pygraphdb) | [Docs](https://robcox2910.github.io/pygraphdb/) | [fromscratch-pygraphdb](https://pypi.org/project/fromscratch-pygraphdb/) |
|
|
541
|
+
| PyTSDB | Time-series databases | [pytsdb](https://github.com/robcox2910/pytsdb) | [Docs](https://robcox2910.github.io/pytsdb/) | [fromscratch-pytsdb](https://pypi.org/project/fromscratch-pytsdb/) |
|
|
542
|
+
| PyVecDB | Vector databases | [pyvecdb](https://github.com/robcox2910/pyvecdb) | [Docs](https://robcox2910.github.io/pyvecdb/) | [fromscratch-pyvecdb](https://pypi.org/project/fromscratch-pyvecdb/) |
|
|
543
|
+
| PyColDB | Column-family databases | [pycoldb](https://github.com/robcox2910/pycoldb) | [Docs](https://robcox2910.github.io/pycoldb/) | [fromscratch-pycoldb](https://pypi.org/project/fromscratch-pycoldb/) |
|
|
544
|
+
| PyCrypt | Cryptography | [pycrypt](https://github.com/robcox2910/pycrypt) | [Docs](https://robcox2910.github.io/pycrypt/) | [fromscratch-pycrypt](https://pypi.org/project/fromscratch-pycrypt/) |
|
|
545
|
+
| PyNet | Computer networking | [pynet](https://github.com/robcox2910/pynet) | [Docs](https://robcox2910.github.io/pynet/) | [fromscratch-pynet](https://pypi.org/project/fromscratch-pynet/) |
|
|
546
|
+
| PyWeb | HTTP web servers | [pyweb](https://github.com/robcox2910/pyweb) | [Docs](https://robcox2910.github.io/pyweb/) | [fromscratch-pyweb](https://pypi.org/project/fromscratch-pyweb/) |
|
|
547
|
+
| PyGit | Version control | [pygit](https://github.com/robcox2910/pygit) | [Docs](https://robcox2910.github.io/pygit/) | [fromscratch-pygit](https://pypi.org/project/fromscratch-pygit/) |
|
|
548
|
+
| PySearch | Search engines | [pysearch](https://github.com/robcox2910/pysearch) | [Docs](https://robcox2910.github.io/pysearch/) | [fromscratch-pysearch](https://pypi.org/project/fromscratch-pysearch/) |
|
|
549
|
+
| PyMQ | Message queues | [pymq](https://github.com/robcox2910/pymq) | [Docs](https://robcox2910.github.io/pymq/) | [fromscratch-pymq](https://pypi.org/project/fromscratch-pymq/) |
|
|
550
|
+
| PyLLM | Language models (the brain) | [pyllm](https://github.com/robcox2910/pyllm) | [Docs](https://robcox2910.github.io/pyllm/) | [fromscratch-pyllm](https://pypi.org/project/fromscratch-pyllm/) |
|
|
551
|
+
| PyScheduler | Job scheduling | [pyscheduler](https://github.com/robcox2910/pyscheduler) | [Docs](https://robcox2910.github.io/pyscheduler/) | [fromscratch-pyscheduler](https://pypi.org/project/fromscratch-pyscheduler/) |
|
|
552
|
+
| **PyStack** | **Full-stack integration** | [pystack](https://github.com/robcox2910/pystack) | [Docs](https://robcox2910.github.io/pystack/) | [fromscratch-pystack](https://pypi.org/project/fromscratch-pystack/) |
|
|
500
553
|
<!-- series:end -->
|
|
501
554
|
|
|
502
555
|
<!-- docs:start -->
|
|
503
556
|
## Documentation
|
|
504
557
|
|
|
505
558
|
Full docs (with kid-friendly explanations of every idea): https://robcox2910.github.io/pystack/
|
|
559
|
+
|
|
560
|
+
## Install
|
|
561
|
+
|
|
562
|
+
[](https://pypi.org/project/fromscratch-pystack/)
|
|
563
|
+
|
|
564
|
+
```bash
|
|
565
|
+
pip install fromscratch-pystack
|
|
566
|
+
```
|
|
506
567
|
<!-- docs:end -->
|
|
507
568
|
|
|
508
569
|
## License
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The full stack, from scratch.
|
|
4
4
|
|
|
5
|
-
PyStack connects **
|
|
5
|
+
PyStack connects **EIGHTEEN** educational projects into one integrated
|
|
6
6
|
platform. Think of it like a school:
|
|
7
7
|
|
|
8
8
|
| Project | Role | School Analogy |
|
|
@@ -23,6 +23,7 @@ platform. Think of it like a school:
|
|
|
23
23
|
| **PyVecDB** | Vector database | The "find similar" recommendation board |
|
|
24
24
|
| **PyColDB** | Column-family store | The flexible report cards |
|
|
25
25
|
| **PyLLM** | Language model | The imagination — the brain that dreams up new text |
|
|
26
|
+
| **PyCPU** | A computer built from NAND gates | The clockwork robot in the science lab — every cog on show |
|
|
26
27
|
| **PyStack** | Integration layer | The hallways connecting everything |
|
|
27
28
|
|
|
28
29
|
PyStack is the hallways. Without hallways, you can't get from the
|
|
@@ -32,7 +33,7 @@ and send messages -- all in one program.
|
|
|
32
33
|
|
|
33
34
|
## What Can You Do?
|
|
34
35
|
|
|
35
|
-
PyStack adds **
|
|
36
|
+
PyStack adds **15 Pebble modules** so your programs can use every
|
|
36
37
|
project. Just `import` the one you need.
|
|
37
38
|
|
|
38
39
|
### Database -- `import "db"`
|
|
@@ -254,11 +255,59 @@ let a = value * (25 + 14)
|
|
|
254
255
|
print(step())
|
|
255
256
|
```
|
|
256
257
|
|
|
258
|
+
### Computer from NAND gates -- `import "cpu"`
|
|
259
|
+
|
|
260
|
+
A NAND gate is the tiniest switch there is: it answers "no" only when both of
|
|
261
|
+
its inputs say "yes". [PyCPU](https://robcox2910.github.io/pycpu/) stacks
|
|
262
|
+
thousands of them, like LEGO bricks, into adders, memory and a whole
|
|
263
|
+
processor. Handing it a Pebble program is like handing a recipe to a cook who
|
|
264
|
+
only reads number codes: PyCPU translates the recipe into those codes, and the
|
|
265
|
+
gate-built computer carries them out one instruction at a time.
|
|
266
|
+
|
|
267
|
+
```
|
|
268
|
+
import "cpu"
|
|
269
|
+
|
|
270
|
+
let program = "let a = 6\nlet b = 7\nprint(a * b)"
|
|
271
|
+
print(cpu_run(program))
|
|
272
|
+
print(cpu_steps(program))
|
|
273
|
+
|
|
274
|
+
print(cpu_run("print(1)\nlet x = 0\nprint(10 // x)"))
|
|
275
|
+
print(cpu_run("print([1, 2])"))
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
prints:
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
42
|
|
282
|
+
|
|
283
|
+
393
|
|
284
|
+
1
|
|
285
|
+
Division by zero at line 3
|
|
286
|
+
error: lists are not supported on PyCPU yet at line 1, column 7
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
`cpu_run` gives back what the program printed (here `42` and its newline, so
|
|
290
|
+
`print` adds a blank line). `cpu_steps` counts the instructions the computer
|
|
291
|
+
carried out. If the program goes wrong, you get what it printed so far and a
|
|
292
|
+
sentence saying what happened; if it uses something PyCPU can't do yet, like a
|
|
293
|
+
list, you get an `error:` message instead.
|
|
294
|
+
|
|
295
|
+
To watch the gates themselves, type `cockpit` in `pystack os`. It opens PyCPU's
|
|
296
|
+
Cockpit in the background and tells you where to look:
|
|
297
|
+
|
|
298
|
+
```
|
|
299
|
+
pystack-os> cockpit
|
|
300
|
+
The Cockpit is open at http://127.0.0.1:8765
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Building the full-size computer takes a few seconds. The Cockpit closes when
|
|
304
|
+
PyStack stops.
|
|
305
|
+
|
|
257
306
|
## All Commands
|
|
258
307
|
|
|
259
308
|
| Command | What It Does |
|
|
260
309
|
|---------|-------------|
|
|
261
|
-
| `pystack pebble <file.pbl>` | Run a Pebble program with all
|
|
310
|
+
| `pystack pebble <file.pbl>` | Run a Pebble program with all 15 modules available |
|
|
262
311
|
| `pystack sql` | Interactive SQL REPL |
|
|
263
312
|
| `pystack os` | PyOS shell with Pebble, SQL, and plugin commands |
|
|
264
313
|
| `pystack web` | Browser-based UI at http://localhost:8080 |
|
|
@@ -302,11 +351,12 @@ When you run `pystack os`, these commands are available at the
|
|
|
302
351
|
| `vec <insert\|search\|cosine> ...` | Vector database operations | PyVecDB |
|
|
303
352
|
| `col <set\|get> <family> <row> <col> [value]` | Column-family operations | PyColDB |
|
|
304
353
|
| `dream <prompt>` | Dream up new Pokemon names | PyLLM |
|
|
354
|
+
| `cockpit` | Open PyCPU's Cockpit in the background and print its address | PyCPU |
|
|
305
355
|
|
|
306
356
|
## Quick Start
|
|
307
357
|
|
|
308
358
|
```bash
|
|
309
|
-
# Install dependencies (released versions of all
|
|
359
|
+
# Install dependencies (released versions of all 18 sibling projects)
|
|
310
360
|
uv sync --all-extras
|
|
311
361
|
|
|
312
362
|
# Run an example program
|
|
@@ -333,7 +383,7 @@ into a sibling can't affect PyStack until the sibling publishes a release and
|
|
|
333
383
|
PyStack chooses to upgrade.
|
|
334
384
|
|
|
335
385
|
To try an unreleased change from a sibling checkout next to this one, install
|
|
336
|
-
it over the
|
|
386
|
+
it over the released version:
|
|
337
387
|
|
|
338
388
|
```bash
|
|
339
389
|
uv pip install -e ../pebble-lang
|
|
@@ -341,7 +391,7 @@ uv run --no-sync pytest
|
|
|
341
391
|
```
|
|
342
392
|
|
|
343
393
|
Use `uv run --no-sync` while you do this: a plain `uv run` (like `uv sync`)
|
|
344
|
-
puts the
|
|
394
|
+
puts the released version back, which is how you undo the override.
|
|
345
395
|
|
|
346
396
|
To upgrade a sibling, raise its minimum version in `pyproject.toml`, run
|
|
347
397
|
`uv lock --upgrade-package fromscratch-<name>`, and open a pull request so CI
|
|
@@ -350,7 +400,8 @@ checks the pair together.
|
|
|
350
400
|
## Releasing
|
|
351
401
|
|
|
352
402
|
1. Merge the change to `main`.
|
|
353
|
-
2.
|
|
403
|
+
2. Release it: `gh release create vX.Y.Z --target main --generate-notes`
|
|
404
|
+
(or push a `vX.Y.Z` tag); the release workflow publishes it to PyPI.
|
|
354
405
|
A change to the public API bumps the minor version (`v0.1.0` → `v0.2.0`);
|
|
355
406
|
anything else bumps the patch (`v0.1.0` → `v0.1.1`).
|
|
356
407
|
|
|
@@ -399,6 +450,7 @@ include:
|
|
|
399
450
|
| PyDBPlugin | (none) | `dbcrash` |
|
|
400
451
|
| PySchedulerPlugin | (none) | `sched`, `schedagents`, `schedalerts`, `schedweb` |
|
|
401
452
|
| LLMPlugin | `llm` | `dream` |
|
|
453
|
+
| CPUPlugin | `cpu` | `cockpit` |
|
|
402
454
|
|
|
403
455
|
The `db` module comes from the Pebble-DB adapter instead of a plugin,
|
|
404
456
|
because it needs this environment's database.
|
|
@@ -426,32 +478,40 @@ registered manually in the `PyStackEnvironment`.
|
|
|
426
478
|
|
|
427
479
|
This project is one of a series that builds real systems "from scratch in Python" to teach how they work. See the [series home](https://robcox2910.github.io/) for the full story.
|
|
428
480
|
|
|
429
|
-
| Project | What it teaches | Repository | Docs |
|
|
430
|
-
| --- | --- | --- | --- |
|
|
431
|
-
| PyOS | Operating systems | [py-os](https://github.com/robcox2910/py-os) | [Docs](https://robcox2910.github.io/py-os/) |
|
|
432
|
-
| Pebble | Compilers and programming languages | [pebble-lang](https://github.com/robcox2910/pebble-lang) | [Docs](https://robcox2910.github.io/pebble-lang/) |
|
|
433
|
-
| PyDB | Relational databases | [pydb](https://github.com/robcox2910/pydb) | [Docs](https://robcox2910.github.io/pydb/) |
|
|
434
|
-
| PyKV | Key-value stores | [pykv](https://github.com/robcox2910/pykv) | [Docs](https://robcox2910.github.io/pykv/) |
|
|
435
|
-
| PyDocDB | Document databases | [pydoc-db](https://github.com/robcox2910/pydoc-db) | [Docs](https://robcox2910.github.io/pydoc-db/) |
|
|
436
|
-
| PyGraphDB | Graph databases | [pygraphdb](https://github.com/robcox2910/pygraphdb) | [Docs](https://robcox2910.github.io/pygraphdb/) |
|
|
437
|
-
| PyTSDB | Time-series databases | [pytsdb](https://github.com/robcox2910/pytsdb) | [Docs](https://robcox2910.github.io/pytsdb/) |
|
|
438
|
-
| PyVecDB | Vector databases | [pyvecdb](https://github.com/robcox2910/pyvecdb) | [Docs](https://robcox2910.github.io/pyvecdb/) |
|
|
439
|
-
| PyColDB | Column-family databases | [pycoldb](https://github.com/robcox2910/pycoldb) | [Docs](https://robcox2910.github.io/pycoldb/) |
|
|
440
|
-
| PyCrypt | Cryptography | [pycrypt](https://github.com/robcox2910/pycrypt) | [Docs](https://robcox2910.github.io/pycrypt/) |
|
|
441
|
-
| PyNet | Computer networking | [pynet](https://github.com/robcox2910/pynet) | [Docs](https://robcox2910.github.io/pynet/) |
|
|
442
|
-
| PyWeb | HTTP web servers | [pyweb](https://github.com/robcox2910/pyweb) | [Docs](https://robcox2910.github.io/pyweb/) |
|
|
443
|
-
| PyGit | Version control | [pygit](https://github.com/robcox2910/pygit) | [Docs](https://robcox2910.github.io/pygit/) |
|
|
444
|
-
| PySearch | Search engines | [pysearch](https://github.com/robcox2910/pysearch) | [Docs](https://robcox2910.github.io/pysearch/) |
|
|
445
|
-
| PyMQ | Message queues | [pymq](https://github.com/robcox2910/pymq) | [Docs](https://robcox2910.github.io/pymq/) |
|
|
446
|
-
| PyLLM | Language models (the brain) | [pyllm](https://github.com/robcox2910/pyllm) | [Docs](https://robcox2910.github.io/pyllm/) |
|
|
447
|
-
| PyScheduler | Job scheduling | [pyscheduler](https://github.com/robcox2910/pyscheduler) | [Docs](https://robcox2910.github.io/pyscheduler/) |
|
|
448
|
-
| **PyStack** | **Full-stack integration** | [pystack](https://github.com/robcox2910/pystack) | [Docs](https://robcox2910.github.io/pystack/) |
|
|
481
|
+
| Project | What it teaches | Repository | Docs | PyPI |
|
|
482
|
+
| --- | --- | --- | --- | --- |
|
|
483
|
+
| PyOS | Operating systems | [py-os](https://github.com/robcox2910/py-os) | [Docs](https://robcox2910.github.io/py-os/) | [fromscratch-pyos](https://pypi.org/project/fromscratch-pyos/) |
|
|
484
|
+
| Pebble | Compilers and programming languages | [pebble-lang](https://github.com/robcox2910/pebble-lang) | [Docs](https://robcox2910.github.io/pebble-lang/) | [fromscratch-pebble](https://pypi.org/project/fromscratch-pebble/) |
|
|
485
|
+
| PyDB | Relational databases | [pydb](https://github.com/robcox2910/pydb) | [Docs](https://robcox2910.github.io/pydb/) | [fromscratch-pydb](https://pypi.org/project/fromscratch-pydb/) |
|
|
486
|
+
| PyKV | Key-value stores | [pykv](https://github.com/robcox2910/pykv) | [Docs](https://robcox2910.github.io/pykv/) | [fromscratch-pykv](https://pypi.org/project/fromscratch-pykv/) |
|
|
487
|
+
| PyDocDB | Document databases | [pydoc-db](https://github.com/robcox2910/pydoc-db) | [Docs](https://robcox2910.github.io/pydoc-db/) | [fromscratch-pydocdb](https://pypi.org/project/fromscratch-pydocdb/) |
|
|
488
|
+
| PyGraphDB | Graph databases | [pygraphdb](https://github.com/robcox2910/pygraphdb) | [Docs](https://robcox2910.github.io/pygraphdb/) | [fromscratch-pygraphdb](https://pypi.org/project/fromscratch-pygraphdb/) |
|
|
489
|
+
| PyTSDB | Time-series databases | [pytsdb](https://github.com/robcox2910/pytsdb) | [Docs](https://robcox2910.github.io/pytsdb/) | [fromscratch-pytsdb](https://pypi.org/project/fromscratch-pytsdb/) |
|
|
490
|
+
| PyVecDB | Vector databases | [pyvecdb](https://github.com/robcox2910/pyvecdb) | [Docs](https://robcox2910.github.io/pyvecdb/) | [fromscratch-pyvecdb](https://pypi.org/project/fromscratch-pyvecdb/) |
|
|
491
|
+
| PyColDB | Column-family databases | [pycoldb](https://github.com/robcox2910/pycoldb) | [Docs](https://robcox2910.github.io/pycoldb/) | [fromscratch-pycoldb](https://pypi.org/project/fromscratch-pycoldb/) |
|
|
492
|
+
| PyCrypt | Cryptography | [pycrypt](https://github.com/robcox2910/pycrypt) | [Docs](https://robcox2910.github.io/pycrypt/) | [fromscratch-pycrypt](https://pypi.org/project/fromscratch-pycrypt/) |
|
|
493
|
+
| PyNet | Computer networking | [pynet](https://github.com/robcox2910/pynet) | [Docs](https://robcox2910.github.io/pynet/) | [fromscratch-pynet](https://pypi.org/project/fromscratch-pynet/) |
|
|
494
|
+
| PyWeb | HTTP web servers | [pyweb](https://github.com/robcox2910/pyweb) | [Docs](https://robcox2910.github.io/pyweb/) | [fromscratch-pyweb](https://pypi.org/project/fromscratch-pyweb/) |
|
|
495
|
+
| PyGit | Version control | [pygit](https://github.com/robcox2910/pygit) | [Docs](https://robcox2910.github.io/pygit/) | [fromscratch-pygit](https://pypi.org/project/fromscratch-pygit/) |
|
|
496
|
+
| PySearch | Search engines | [pysearch](https://github.com/robcox2910/pysearch) | [Docs](https://robcox2910.github.io/pysearch/) | [fromscratch-pysearch](https://pypi.org/project/fromscratch-pysearch/) |
|
|
497
|
+
| PyMQ | Message queues | [pymq](https://github.com/robcox2910/pymq) | [Docs](https://robcox2910.github.io/pymq/) | [fromscratch-pymq](https://pypi.org/project/fromscratch-pymq/) |
|
|
498
|
+
| PyLLM | Language models (the brain) | [pyllm](https://github.com/robcox2910/pyllm) | [Docs](https://robcox2910.github.io/pyllm/) | [fromscratch-pyllm](https://pypi.org/project/fromscratch-pyllm/) |
|
|
499
|
+
| PyScheduler | Job scheduling | [pyscheduler](https://github.com/robcox2910/pyscheduler) | [Docs](https://robcox2910.github.io/pyscheduler/) | [fromscratch-pyscheduler](https://pypi.org/project/fromscratch-pyscheduler/) |
|
|
500
|
+
| **PyStack** | **Full-stack integration** | [pystack](https://github.com/robcox2910/pystack) | [Docs](https://robcox2910.github.io/pystack/) | [fromscratch-pystack](https://pypi.org/project/fromscratch-pystack/) |
|
|
449
501
|
<!-- series:end -->
|
|
450
502
|
|
|
451
503
|
<!-- docs:start -->
|
|
452
504
|
## Documentation
|
|
453
505
|
|
|
454
506
|
Full docs (with kid-friendly explanations of every idea): https://robcox2910.github.io/pystack/
|
|
507
|
+
|
|
508
|
+
## Install
|
|
509
|
+
|
|
510
|
+
[](https://pypi.org/project/fromscratch-pystack/)
|
|
511
|
+
|
|
512
|
+
```bash
|
|
513
|
+
pip install fromscratch-pystack
|
|
514
|
+
```
|
|
455
515
|
<!-- docs:end -->
|
|
456
516
|
|
|
457
517
|
## License
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
title: "Build your own full software stack in Python"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# PyStack: Build your own full software stack in Python
|
|
2
6
|
|
|
3
7
|
## The Full Stack, From Scratch
|
|
4
8
|
|
|
@@ -150,10 +154,61 @@ The first two come from the core adapters. The rest come from plugins.
|
|
|
150
154
|
| `schedagents` | Hand PyScheduler jobs to two helper agents on other desks: one job is pinned to `build-01`, one asks for a helper tagged `gpu`, and the output says who ran each | PySchedulerPlugin |
|
|
151
155
|
| `schedalerts` | Make a PyScheduler job fail and follow its alert: stored first, routed to a log notifier, delivered once | PySchedulerPlugin |
|
|
152
156
|
| `schedweb [--seconds N]` | Open PyScheduler's web UI over a dozen demo jobs and three days of runs (log in as admin / demo); stops on Ctrl-C or after N seconds | PySchedulerPlugin |
|
|
157
|
+
| `cockpit` | Open PyCPU's Cockpit, a web page for watching a NAND-gate computer work, in the background and print its address; it closes when PyStack stops | CPUPlugin |
|
|
153
158
|
|
|
154
159
|
Plus all the standard PyOS commands like `ls`, `cat`, `mkdir`, `help`,
|
|
155
160
|
and more.
|
|
156
161
|
|
|
162
|
+
## Run Pebble on a Computer Made of NAND Gates
|
|
163
|
+
|
|
164
|
+
A NAND gate is the tiniest switch there is: it answers "no" only when both of
|
|
165
|
+
its inputs say "yes". [PyCPU](https://robcox2910.github.io/pycpu/) stacks
|
|
166
|
+
thousands of them, like LEGO bricks, into adders, memory and a whole
|
|
167
|
+
processor. Handing it a Pebble program is like handing a recipe to a cook who
|
|
168
|
+
only reads number codes: PyCPU translates the recipe into those codes, and the
|
|
169
|
+
gate-built computer carries them out one instruction at a time.
|
|
170
|
+
|
|
171
|
+
| Function | What It Gives Back |
|
|
172
|
+
|----------|--------------------|
|
|
173
|
+
| `cpu_run(source)` | What the program printed; if it went wrong, what it printed so far and a sentence saying what happened |
|
|
174
|
+
| `cpu_steps(source)` | How many instructions the computer carried out |
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
import "cpu"
|
|
178
|
+
|
|
179
|
+
let program = "let a = 6\nlet b = 7\nprint(a * b)"
|
|
180
|
+
print(cpu_run(program))
|
|
181
|
+
print(cpu_steps(program))
|
|
182
|
+
|
|
183
|
+
print(cpu_run("print(1)\nlet x = 0\nprint(10 // x)"))
|
|
184
|
+
print(cpu_run("print([1, 2])"))
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
prints:
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
42
|
|
191
|
+
|
|
192
|
+
393
|
|
193
|
+
1
|
|
194
|
+
Division by zero at line 3
|
|
195
|
+
error: lists are not supported on PyCPU yet at line 1, column 7
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The blank line is there because `cpu_run` hands back `42` with its own
|
|
199
|
+
newline, and `print` adds another. Lists are something PyCPU can't run yet, so
|
|
200
|
+
that program comes back as an `error:` message.
|
|
201
|
+
|
|
202
|
+
To watch the gates themselves, type `cockpit` in `pystack os`:
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
pystack-os> cockpit
|
|
206
|
+
The Cockpit is open at http://127.0.0.1:8765
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Open the address in your browser. Building the full-size computer takes a few
|
|
210
|
+
seconds, and the Cockpit closes when PyStack stops.
|
|
211
|
+
|
|
157
212
|
## How It Works
|
|
158
213
|
|
|
159
214
|
PyStack uses **adapters** and **plugins** to connect projects together.
|
|
@@ -194,6 +249,7 @@ core three (PyOS, Pebble, PyDB):
|
|
|
194
249
|
| MQPlugin | `import "mq"` | `mq-put`, `mq-get`, `mqnet` | PyMQ |
|
|
195
250
|
| PyDBPlugin | (none) | `dbcrash` | PyDB |
|
|
196
251
|
| PySchedulerPlugin | (none) | `sched`, `schedagents`, `schedalerts`, `schedweb` | PyScheduler |
|
|
252
|
+
| CPUPlugin | `import "cpu"` | `cockpit` | PyCPU |
|
|
197
253
|
|
|
198
254
|
The `db` module is handled separately by the Pebble-DB adapter because
|
|
199
255
|
it needs a live database instance.
|
|
@@ -209,14 +265,22 @@ Plugins can also be discovered automatically via Python entry points
|
|
|
209
265
|
(the `pystack.plugins` group), so other packages can extend PyStack
|
|
210
266
|
without modifying its code.
|
|
211
267
|
|
|
212
|
-
##
|
|
268
|
+
## Install
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
pip install fromscratch-pystack
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
That pulls in all 18 other projects too. To read the code or run the tests, clone it from [GitHub](https://github.com/robcox2910/pystack).
|
|
275
|
+
|
|
276
|
+
## Develop from source
|
|
213
277
|
|
|
214
278
|
```bash
|
|
215
279
|
# Clone the repository
|
|
216
280
|
git clone https://github.com/robcox2910/pystack.git
|
|
217
281
|
cd pystack
|
|
218
282
|
|
|
219
|
-
# Install all dependencies (all
|
|
283
|
+
# Install all dependencies (all 19 projects wired together)
|
|
220
284
|
uv sync --all-extras
|
|
221
285
|
|
|
222
286
|
# Run an example
|
|
@@ -20,7 +20,7 @@ classifiers = [
|
|
|
20
20
|
keywords = ["education", "full-stack", "operating-system", "compiler", "database"]
|
|
21
21
|
dependencies = [
|
|
22
22
|
"fromscratch-pyos>=0.3.0",
|
|
23
|
-
"fromscratch-pebble>=0.
|
|
23
|
+
"fromscratch-pebble>=0.4.1",
|
|
24
24
|
"fromscratch-pydb>=0.5.0",
|
|
25
25
|
"fromscratch-pyweb>=0.4.0",
|
|
26
26
|
"fromscratch-pygit>=0.3.0",
|
|
@@ -36,6 +36,7 @@ dependencies = [
|
|
|
36
36
|
"fromscratch-pycoldb>=0.4.0",
|
|
37
37
|
"fromscratch-pyllm>=0.5.0",
|
|
38
38
|
"fromscratch-pyscheduler>=0.5.0",
|
|
39
|
+
"fromscratch-pycpu>=0.1.0",
|
|
39
40
|
]
|
|
40
41
|
|
|
41
42
|
[project.urls]
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.
|
|
22
|
-
__version_tuple__ = version_tuple = (0,
|
|
21
|
+
__version__ = version = '0.6.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 6, 0)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -25,6 +25,7 @@ from pystack.adapters.os_pebble import (
|
|
|
25
25
|
from pystack.adapters.pebble_db import make_db_module
|
|
26
26
|
from pystack.plugins.base import Plugin
|
|
27
27
|
from pystack.plugins.coldb_plugin import ColDBPlugin
|
|
28
|
+
from pystack.plugins.cpu_plugin import CPUPlugin
|
|
28
29
|
from pystack.plugins.crypto_plugin import CryptoPlugin
|
|
29
30
|
from pystack.plugins.docdb_plugin import DocDBPlugin
|
|
30
31
|
from pystack.plugins.git_plugin import GitPlugin
|
|
@@ -103,7 +104,7 @@ class PyStackEnvironment:
|
|
|
103
104
|
"""Register all built-in integration plugins with the registry.
|
|
104
105
|
|
|
105
106
|
Add the crypto, web, git, net, search, mq, kv, docdb, graphdb,
|
|
106
|
-
tsdb, vecdb, coldb, llm, and
|
|
107
|
+
tsdb, vecdb, coldb, llm, sched, and cpu plugins so the registry can wire their
|
|
107
108
|
Pebble modules, shell commands, and boot hooks during activation.
|
|
108
109
|
"""
|
|
109
110
|
plugins: list[Plugin] = [
|
|
@@ -122,6 +123,7 @@ class PyStackEnvironment:
|
|
|
122
123
|
VecDBPlugin(),
|
|
123
124
|
ColDBPlugin(),
|
|
124
125
|
LLMPlugin(),
|
|
126
|
+
CPUPlugin(),
|
|
125
127
|
]
|
|
126
128
|
for plugin in plugins:
|
|
127
129
|
self._plugin_registry.register(plugin)
|