arc-kernel 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.
@@ -0,0 +1,10 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vignesh Ramsh
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,111 @@
1
+ Metadata-Version: 2.4
2
+ Name: arc-kernel
3
+ Version: 0.1.0
4
+ Summary: ARC kernel — capability-based Python platform
5
+ Project-URL: Homepage, https://github.com/vignesh-ramsh/arc
6
+ Project-URL: Repository, https://github.com/vignesh-ramsh/arc
7
+ Author: Vignesh Ramsh
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: arc,capability,cli,framework,kernel
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
19
+ Requires-Python: >=3.12
20
+ Requires-Dist: cryptography>=42.0
21
+ Requires-Dist: msgspec>=0.18
22
+ Requires-Dist: rich>=13.0
23
+ Requires-Dist: tomlkit>=0.12
24
+ Requires-Dist: typer>=0.12
25
+ Description-Content-Type: text/markdown
26
+
27
+ # kernel
28
+
29
+ The ARC kernel — repo/project name is `kernel`; the Python package it
30
+ provides is `arc` (flat layout, no `src/`). This is what every project's
31
+ `arc.<capability>` namespace is ultimately built on.
32
+
33
+ ```
34
+ arc/ # this repo
35
+ ├── pyproject.toml # name = "arc-kernel" (distribution — "arc" was taken
36
+ │ on PyPI), packages = ["arc"]
37
+ ├── README.md
38
+ ├── LICENSE
39
+ ├── .gitignore
40
+ └── arc/ # the actual package — `import arc`
41
+ ├── __init__.py
42
+ ├── cli.py # the `arc` command: init, install, build, settings, plugin
43
+ ├── registry.py
44
+ ├── settings.py
45
+ └── secrets.py
46
+ ```
47
+
48
+ ## Two-tier install model (mirrors frappe-bench / bench)
49
+
50
+ 1. **Bootstrap globally, once** — either `pip install arc-kernel` (or
51
+ `pipx install arc-kernel` / `uv tool install arc-kernel`, both preferred
52
+ over a bare `pip install` for a CLI tool) from PyPI, or
53
+ `uv tool install --editable .` from a local clone of this repo if you're
54
+ working on the kernel itself. Either way you get the `arc` command
55
+ anywhere on your machine.
56
+ 2. **Per project** — `arc init` clones THIS repo into `<project>/arc/` and wires
57
+ up a uv workspace. From then on, use `<project>/.venv/bin/arc` for project
58
+ commands — that copy is pinned to the exact commit this project was built
59
+ against, independent of the global bootstrap CLI's version.
60
+
61
+ Note: inside a scaffolded project you'll see `project/arc/arc/` — the outer
62
+ `arc/` is this project's kernel *slot* (a workspace member, named the way
63
+ `apps/frappe` names its slot in a bench); the inner `arc/` is the actual
64
+ Python package. Two different things, same name for a real reason — not
65
+ duplication.
66
+
67
+ ## Commands
68
+
69
+ ```bash
70
+ arc init [project_name] --kernel-repo <git-url-or-path> [--kernel-branch main] [--env dev]
71
+ arc install <git-url> [--branch BRANCH] [--name NAME]
72
+ arc build [-p/--plugin NAME] [--no-lock]
73
+ arc settings get <key> [--reveal]
74
+ arc settings set <key> <value> [--secret]
75
+ arc settings delete <key>
76
+ arc plugin list
77
+ arc plugin enable <name>
78
+ arc plugin disable <name>
79
+ ```
80
+
81
+ `ARC_KERNEL_REPO` env var can be set once so `--kernel-repo` doesn't need to
82
+ be typed on every `arc init`.
83
+
84
+ ## Plugin manifest format
85
+
86
+ Every plugin repo has, at its root:
87
+
88
+ ```toml
89
+ # plugin.toml — ARC-specific metadata only
90
+ [plugin]
91
+ name = "psqldb"
92
+ version = "0.1.0"
93
+ capability = "psqldb" # exported as arc.<capability> at boot
94
+ requires = []
95
+ optional_requires = ["redix"]
96
+ ```
97
+
98
+ ```toml
99
+ # pyproject.toml — standard Python packaging; real dependencies live HERE
100
+ [project]
101
+ name = "psqldb"
102
+ dependencies = ["asyncpg>=0.29"]
103
+
104
+ [build-system]
105
+ requires = ["hatchling"]
106
+ build-backend = "hatchling.build"
107
+ ```
108
+
109
+ Following this same kernel's convention, plugin packages should also use a
110
+ flat layout (`psqldb/psqldb/__init__.py` inside the plugin's own repo, not
111
+ `psqldb/src/psqldb/`) — same reasoning, same fix, applied consistently.
@@ -0,0 +1,85 @@
1
+ # kernel
2
+
3
+ The ARC kernel — repo/project name is `kernel`; the Python package it
4
+ provides is `arc` (flat layout, no `src/`). This is what every project's
5
+ `arc.<capability>` namespace is ultimately built on.
6
+
7
+ ```
8
+ arc/ # this repo
9
+ ├── pyproject.toml # name = "arc-kernel" (distribution — "arc" was taken
10
+ │ on PyPI), packages = ["arc"]
11
+ ├── README.md
12
+ ├── LICENSE
13
+ ├── .gitignore
14
+ └── arc/ # the actual package — `import arc`
15
+ ├── __init__.py
16
+ ├── cli.py # the `arc` command: init, install, build, settings, plugin
17
+ ├── registry.py
18
+ ├── settings.py
19
+ └── secrets.py
20
+ ```
21
+
22
+ ## Two-tier install model (mirrors frappe-bench / bench)
23
+
24
+ 1. **Bootstrap globally, once** — either `pip install arc-kernel` (or
25
+ `pipx install arc-kernel` / `uv tool install arc-kernel`, both preferred
26
+ over a bare `pip install` for a CLI tool) from PyPI, or
27
+ `uv tool install --editable .` from a local clone of this repo if you're
28
+ working on the kernel itself. Either way you get the `arc` command
29
+ anywhere on your machine.
30
+ 2. **Per project** — `arc init` clones THIS repo into `<project>/arc/` and wires
31
+ up a uv workspace. From then on, use `<project>/.venv/bin/arc` for project
32
+ commands — that copy is pinned to the exact commit this project was built
33
+ against, independent of the global bootstrap CLI's version.
34
+
35
+ Note: inside a scaffolded project you'll see `project/arc/arc/` — the outer
36
+ `arc/` is this project's kernel *slot* (a workspace member, named the way
37
+ `apps/frappe` names its slot in a bench); the inner `arc/` is the actual
38
+ Python package. Two different things, same name for a real reason — not
39
+ duplication.
40
+
41
+ ## Commands
42
+
43
+ ```bash
44
+ arc init [project_name] --kernel-repo <git-url-or-path> [--kernel-branch main] [--env dev]
45
+ arc install <git-url> [--branch BRANCH] [--name NAME]
46
+ arc build [-p/--plugin NAME] [--no-lock]
47
+ arc settings get <key> [--reveal]
48
+ arc settings set <key> <value> [--secret]
49
+ arc settings delete <key>
50
+ arc plugin list
51
+ arc plugin enable <name>
52
+ arc plugin disable <name>
53
+ ```
54
+
55
+ `ARC_KERNEL_REPO` env var can be set once so `--kernel-repo` doesn't need to
56
+ be typed on every `arc init`.
57
+
58
+ ## Plugin manifest format
59
+
60
+ Every plugin repo has, at its root:
61
+
62
+ ```toml
63
+ # plugin.toml — ARC-specific metadata only
64
+ [plugin]
65
+ name = "psqldb"
66
+ version = "0.1.0"
67
+ capability = "psqldb" # exported as arc.<capability> at boot
68
+ requires = []
69
+ optional_requires = ["redix"]
70
+ ```
71
+
72
+ ```toml
73
+ # pyproject.toml — standard Python packaging; real dependencies live HERE
74
+ [project]
75
+ name = "psqldb"
76
+ dependencies = ["asyncpg>=0.29"]
77
+
78
+ [build-system]
79
+ requires = ["hatchling"]
80
+ build-backend = "hatchling.build"
81
+ ```
82
+
83
+ Following this same kernel's convention, plugin packages should also use a
84
+ flat layout (`psqldb/psqldb/__init__.py` inside the plugin's own repo, not
85
+ `psqldb/src/psqldb/`) — same reasoning, same fix, applied consistently.
@@ -0,0 +1,65 @@
1
+ """
2
+ ARC kernel — capability-based Python platform.
3
+
4
+ `import arc` is the only import application code ever needs (Architecture
5
+ §3.2). After `arc.boot()`, every enabled plugin's capability is reachable as
6
+ `arc.<capability>` via module-level `__getattr__` (PEP 562) — never
7
+ `import arc.psqldb`.
8
+
9
+ import arc
10
+
11
+ arc.boot()
12
+ user = await arc.psqldb.fetch_one(...)
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ from typing import Any
18
+
19
+ from . import codec, health # noqa: F401 - attaches arc.codec / arc.health as real submodules
20
+ from .kernel import ( # noqa: F401
21
+ ArcAdvisory,
22
+ Capability,
23
+ ExportError,
24
+ Kernel,
25
+ KernelError,
26
+ )
27
+ from .resolver import BootPlan, PluginSpec, ResolutionError # noqa: F401
28
+ from .runtime import BootError, boot, find_project_root, shutdown # noqa: F401
29
+
30
+ __version__ = "0.1.0"
31
+
32
+
33
+ def __getattr__(name: str) -> Any:
34
+ """PEP 562: resolve arc.<capability> against the booted kernel (§3.2).
35
+
36
+ Only consulted for names not found in the module dict — which is exactly
37
+ why capability names may never collide with the kernel's own namespace
38
+ (enforced at resolution and export time; see arc.kernel).
39
+ """
40
+ from . import _state
41
+
42
+ kernel = _state.get_kernel()
43
+ if kernel is not None and kernel.has(name):
44
+ return kernel.get(name)
45
+ if kernel is None:
46
+ raise AttributeError(
47
+ f"module 'arc' has no attribute {name!r}. If {name!r} is a plugin "
48
+ f"capability, call arc.boot() first — capabilities are only "
49
+ f"attached to `arc` after boot."
50
+ )
51
+ raise AttributeError(
52
+ f"module 'arc' has no attribute {name!r}, and no enabled plugin "
53
+ f"exports a capability with that name "
54
+ f"(booted capabilities: {sorted(kernel.capabilities()) or 'none'})."
55
+ )
56
+
57
+
58
+ def __dir__() -> list[str]:
59
+ from . import _state
60
+
61
+ names = set(globals())
62
+ kernel = _state.get_kernel()
63
+ if kernel is not None:
64
+ names.update(kernel.capabilities())
65
+ return sorted(names)
@@ -0,0 +1,31 @@
1
+ """
2
+ arc._state
3
+ -----------------
4
+ Process-wide runtime state: the single active Kernel for this process.
5
+
6
+ Deliberately tiny and dependency-free. It exists so that `arc/__init__.py`
7
+ (PEP 562 attribute lookup), `arc.runtime` (boot/shutdown) and `arc.settings`
8
+ (module-level runtime API) can all reach the active kernel without importing
9
+ each other in a circle.
10
+
11
+ Access goes through get_kernel()/set_kernel() — never `from ... import`
12
+ the variable itself, which would snapshot a stale binding.
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import typing
18
+
19
+ if typing.TYPE_CHECKING:
20
+ from .kernel import Kernel
21
+
22
+ _active_kernel: "Kernel | None" = None
23
+
24
+
25
+ def get_kernel() -> "Kernel | None":
26
+ return _active_kernel
27
+
28
+
29
+ def set_kernel(kernel: "Kernel | None") -> None:
30
+ global _active_kernel
31
+ _active_kernel = kernel