kedge 0.0.1__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.
- kedge-0.0.1/.gitignore +21 -0
- kedge-0.0.1/CONVENTIONS.md +127 -0
- kedge-0.0.1/LICENSE +202 -0
- kedge-0.0.1/PKG-INFO +114 -0
- kedge-0.0.1/README.md +67 -0
- kedge-0.0.1/pyproject.toml +155 -0
- kedge-0.0.1/src/kedge/__init__.py +51 -0
- kedge-0.0.1/src/kedge/agent/__init__.py +110 -0
- kedge-0.0.1/src/kedge/agent/audit.py +218 -0
- kedge-0.0.1/src/kedge/agent/context.py +830 -0
- kedge-0.0.1/src/kedge/agent/loop.py +700 -0
- kedge-0.0.1/src/kedge/agent/prompts/__init__.py +85 -0
- kedge-0.0.1/src/kedge/agent/prompts/excel.md +63 -0
- kedge-0.0.1/src/kedge/agent/prompts/marimo.md +46 -0
- kedge-0.0.1/src/kedge/agent/prompts/polars.md +43 -0
- kedge-0.0.1/src/kedge/agent/prompts/role.md +44 -0
- kedge-0.0.1/src/kedge/agent/prompts/tools.md +67 -0
- kedge-0.0.1/src/kedge/agent/prompts/vocabulary.md +38 -0
- kedge-0.0.1/src/kedge/agent/tools.py +1673 -0
- kedge-0.0.1/src/kedge/agent/validate.py +964 -0
- kedge-0.0.1/src/kedge/analysis/__init__.py +54 -0
- kedge-0.0.1/src/kedge/analysis/analyse.py +456 -0
- kedge-0.0.1/src/kedge/analysis/classify.py +362 -0
- kedge-0.0.1/src/kedge/analysis/connections.py +432 -0
- kedge-0.0.1/src/kedge/analysis/docs.py +638 -0
- kedge-0.0.1/src/kedge/analysis/findings.py +817 -0
- kedge-0.0.1/src/kedge/analysis/formulas.py +646 -0
- kedge-0.0.1/src/kedge/analysis/graph.py +349 -0
- kedge-0.0.1/src/kedge/analysis/model.py +557 -0
- kedge-0.0.1/src/kedge/analysis/powerquery.py +471 -0
- kedge-0.0.1/src/kedge/analysis/profile.py +683 -0
- kedge-0.0.1/src/kedge/analysis/redact.py +147 -0
- kedge-0.0.1/src/kedge/analysis/regions.py +679 -0
- kedge-0.0.1/src/kedge/analysis/values.py +492 -0
- kedge-0.0.1/src/kedge/analysis/workbook.py +787 -0
- kedge-0.0.1/src/kedge/cli.py +753 -0
- kedge-0.0.1/src/kedge/config.py +466 -0
- kedge-0.0.1/src/kedge/contracts/__init__.py +70 -0
- kedge-0.0.1/src/kedge/contracts/infer.py +413 -0
- kedge-0.0.1/src/kedge/contracts/model.py +396 -0
- kedge-0.0.1/src/kedge/contracts/validate.py +525 -0
- kedge-0.0.1/src/kedge/errors.py +87 -0
- kedge-0.0.1/src/kedge/ingest/__init__.py +113 -0
- kedge-0.0.1/src/kedge/ingest/drift.py +1030 -0
- kedge-0.0.1/src/kedge/ingest/model.py +425 -0
- kedge-0.0.1/src/kedge/ingest/receive.py +436 -0
- kedge-0.0.1/src/kedge/ingest/store.py +396 -0
- kedge-0.0.1/src/kedge/ingest/watch.py +349 -0
- kedge-0.0.1/src/kedge/knowledge/__init__.py +47 -0
- kedge-0.0.1/src/kedge/knowledge/loader.py +337 -0
- kedge-0.0.1/src/kedge/knowledge/search.py +124 -0
- kedge-0.0.1/src/kedge/knowledge/utils_catalogue.py +191 -0
- kedge-0.0.1/src/kedge/lifecycle.py +945 -0
- kedge-0.0.1/src/kedge/marimo_http.py +426 -0
- kedge-0.0.1/src/kedge/notebook/__init__.py +103 -0
- kedge-0.0.1/src/kedge/notebook/codegen.py +855 -0
- kedge-0.0.1/src/kedge/notebook/discovery.py +160 -0
- kedge-0.0.1/src/kedge/notebook/driver.py +1574 -0
- kedge-0.0.1/src/kedge/notebook/filedriver.py +773 -0
- kedge-0.0.1/src/kedge/notebook/kernel.py +403 -0
- kedge-0.0.1/src/kedge/notebook/model.py +360 -0
- kedge-0.0.1/src/kedge/notebook/scaffold.py +653 -0
- kedge-0.0.1/src/kedge/observability.py +72 -0
- kedge-0.0.1/src/kedge/plan/__init__.py +250 -0
- kedge-0.0.1/src/kedge/plan/model.py +743 -0
- kedge-0.0.1/src/kedge/plan/prompts/propose_repair.md +7 -0
- kedge-0.0.1/src/kedge/plan/prompts/propose_system.md +97 -0
- kedge-0.0.1/src/kedge/plan/prompts/propose_user.md +42 -0
- kedge-0.0.1/src/kedge/plan/prompts/propose_vocabulary.md +56 -0
- kedge-0.0.1/src/kedge/plan/propose.py +786 -0
- kedge-0.0.1/src/kedge/plan/review.py +837 -0
- kedge-0.0.1/src/kedge/plan/store.py +266 -0
- kedge-0.0.1/src/kedge/plan/triage.py +597 -0
- kedge-0.0.1/src/kedge/py.typed +0 -0
- kedge-0.0.1/src/kedge/reconcile/__init__.py +113 -0
- kedge-0.0.1/src/kedge/reconcile/baseline.py +421 -0
- kedge-0.0.1/src/kedge/reconcile/cell.py +344 -0
- kedge-0.0.1/src/kedge/reconcile/compare.py +1115 -0
- kedge-0.0.1/src/kedge/reconcile/diagnose.py +636 -0
- kedge-0.0.1/src/kedge/reconcile/model.py +746 -0
- kedge-0.0.1/src/kedge/registry.py +704 -0
- kedge-0.0.1/src/kedge/report.py +373 -0
- kedge-0.0.1/src/kedge/server/__init__.py +109 -0
- kedge-0.0.1/src/kedge/server/agent_seam.py +358 -0
- kedge-0.0.1/src/kedge/server/app.py +367 -0
- kedge-0.0.1/src/kedge/server/events.py +536 -0
- kedge-0.0.1/src/kedge/server/hub.py +879 -0
- kedge-0.0.1/src/kedge/server/routes.py +734 -0
- kedge-0.0.1/src/kedge/server/sessions.py +404 -0
- kedge-0.0.1/src/kedge/server/static/app.js +1107 -0
- kedge-0.0.1/src/kedge/server/static/hub.css +422 -0
- kedge-0.0.1/src/kedge/server/static/hub.html +121 -0
- kedge-0.0.1/src/kedge/server/static/hub.js +656 -0
- kedge-0.0.1/src/kedge/server/static/index.html +147 -0
- kedge-0.0.1/src/kedge/server/static/styles.css +906 -0
- kedge-0.0.1/src/kedge/workspace.py +563 -0
- kedge-0.0.1/src/kedge/xl/__init__.py +104 -0
- kedge-0.0.1/src/kedge/xl/dates.py +181 -0
- kedge-0.0.1/src/kedge/xl/errors.py +141 -0
- kedge-0.0.1/src/kedge/xl/namespace.py +136 -0
- kedge-0.0.1/src/kedge/xl/nulls.py +243 -0
- kedge-0.0.1/src/kedge/xl/rounding.py +209 -0
- kedge-0.0.1/tests/conftest.py +20 -0
- kedge-0.0.1/tests/contract/conftest.py +273 -0
- kedge-0.0.1/tests/contract/test_driver_live.py +765 -0
- kedge-0.0.1/tests/contract/test_filedriver_live.py +369 -0
- kedge-0.0.1/tests/corpus/test_reconcile_corpus.py +407 -0
- kedge-0.0.1/tests/fixtures/README.md +402 -0
- kedge-0.0.1/tests/fixtures/clean_pipeline.xlsx +0 -0
- kedge-0.0.1/tests/fixtures/cross_sheet_chain.xlsx +0 -0
- kedge-0.0.1/tests/fixtures/documented.xlsx +0 -0
- kedge-0.0.1/tests/fixtures/documented_procedure.docx +0 -0
- kedge-0.0.1/tests/fixtures/generate.py +2110 -0
- kedge-0.0.1/tests/fixtures/hostile.xlsx +0 -0
- kedge-0.0.1/tests/fixtures/legacy_sql.xlsx +0 -0
- kedge-0.0.1/tests/fixtures/manifest.py +539 -0
- kedge-0.0.1/tests/fixtures/mostly_manual.xlsx +0 -0
- kedge-0.0.1/tests/fixtures/no_cached_values.xlsx +0 -0
- kedge-0.0.1/tests/fixtures/powerquery.xlsx +0 -0
- kedge-0.0.1/tests/fixtures/procedure_legacy.doc +2 -0
- kedge-0.0.1/tests/unit/conftest.py +224 -0
- kedge-0.0.1/tests/unit/test_agent_audit.py +196 -0
- kedge-0.0.1/tests/unit/test_agent_context.py +332 -0
- kedge-0.0.1/tests/unit/test_agent_loop.py +467 -0
- kedge-0.0.1/tests/unit/test_agent_prompts.py +102 -0
- kedge-0.0.1/tests/unit/test_agent_tools.py +590 -0
- kedge-0.0.1/tests/unit/test_agent_validate.py +418 -0
- kedge-0.0.1/tests/unit/test_cli.py +479 -0
- kedge-0.0.1/tests/unit/test_config.py +316 -0
- kedge-0.0.1/tests/unit/test_connections.py +240 -0
- kedge-0.0.1/tests/unit/test_docs.py +276 -0
- kedge-0.0.1/tests/unit/test_driver_codegen.py +626 -0
- kedge-0.0.1/tests/unit/test_filedriver.py +962 -0
- kedge-0.0.1/tests/unit/test_fixtures_generate.py +606 -0
- kedge-0.0.1/tests/unit/test_hub_routes.py +481 -0
- kedge-0.0.1/tests/unit/test_lifecycle.py +558 -0
- kedge-0.0.1/tests/unit/test_plan_model.py +316 -0
- kedge-0.0.1/tests/unit/test_powerquery.py +305 -0
- kedge-0.0.1/tests/unit/test_reconcile_baseline.py +274 -0
- kedge-0.0.1/tests/unit/test_reconcile_cell.py +232 -0
- kedge-0.0.1/tests/unit/test_reconcile_compare.py +506 -0
- kedge-0.0.1/tests/unit/test_reconcile_diagnose.py +329 -0
- kedge-0.0.1/tests/unit/test_reconcile_model.py +335 -0
- kedge-0.0.1/tests/unit/test_registry.py +316 -0
- kedge-0.0.1/tests/unit/test_server_events.py +273 -0
- kedge-0.0.1/tests/unit/test_server_routes.py +752 -0
- kedge-0.0.1/tests/unit/test_sessions.py +189 -0
- kedge-0.0.1/tests/unit/test_triage.py +236 -0
- kedge-0.0.1/tests/unit/test_utils_and_knowledge.py +173 -0
- kedge-0.0.1/tests/unit/test_workspace.py +296 -0
- kedge-0.0.1/tests/unit/test_xl_dates.py +237 -0
- kedge-0.0.1/tests/unit/test_xl_namespace.py +157 -0
- kedge-0.0.1/tests/unit/test_xl_nulls.py +450 -0
- kedge-0.0.1/tests/unit/test_xl_rounding.py +299 -0
- kedge-0.0.1/utils/__init__.py +33 -0
- kedge-0.0.1/utils/frames.py +137 -0
- kedge-0.0.1/utils/money.py +107 -0
kedge-0.0.1/.gitignore
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
.venv/
|
|
4
|
+
venv/
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
.pytest_cache/
|
|
9
|
+
.ruff_cache/
|
|
10
|
+
.coverage
|
|
11
|
+
htmlcov/
|
|
12
|
+
.idea/
|
|
13
|
+
.vscode/
|
|
14
|
+
|
|
15
|
+
# kedge runtime artifacts
|
|
16
|
+
.kedge/
|
|
17
|
+
# the per-workbook project directory kedge generates beside a workbook
|
|
18
|
+
*.kedge/
|
|
19
|
+
handins/
|
|
20
|
+
*.marker.json
|
|
21
|
+
scratch/
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# kedge — conventions for contributors (human and agent)
|
|
2
|
+
|
|
3
|
+
Read `PLAN.md` for *what* to build. This file is *how*. It is binding: reviewers reject on it.
|
|
4
|
+
|
|
5
|
+
## Non-negotiables
|
|
6
|
+
|
|
7
|
+
1. **polars, never pandas.** No `import pandas` anywhere in `src/`, tests, fixtures, or generated
|
|
8
|
+
code. The validation gate enforces this for generated code; you are expected to hold the line
|
|
9
|
+
in hand-written code without being told.
|
|
10
|
+
2. **`marimo._code_mode` is imported in exactly one place**: `src/kedge/notebook/driver.py`.
|
|
11
|
+
Nothing else in the repo may reference it, import it, or emit code that mentions it.
|
|
12
|
+
Grep `_code_mode` — if it appears outside `driver.py` and its tests, that is a bug (PLAN §6.1).
|
|
13
|
+
3. **Excel semantics go through `kedge.xl`.** Never open-code half-away-from-zero rounding or
|
|
14
|
+
null-as-zero arithmetic. If `kedge.xl` lacks what you need, add it there with tests.
|
|
15
|
+
4. **Every extractor degrades gracefully.** An analyser sub-extractor returns an "absent" or
|
|
16
|
+
"unparseable" result and keeps going. It never raises past its own boundary. A malformed
|
|
17
|
+
workbook produces a `Finding`, not a traceback (PLAN §M1).
|
|
18
|
+
5. **Never auto-discover a marimo server.** kedge owns its own process, targeted by explicit
|
|
19
|
+
url + session id. Reading the registry is permitted *only* to identify a stale
|
|
20
|
+
kedge-owned process via our own marker file (PLAN §2.9).
|
|
21
|
+
|
|
22
|
+
## Python style
|
|
23
|
+
|
|
24
|
+
These follow the author's sibling projects (`mooring`, `curfew`, `regcite`, `rwa_calculator`).
|
|
25
|
+
Where this file and a sibling repo disagree, this file wins — but the default is to match them.
|
|
26
|
+
|
|
27
|
+
- Python 3.12+. `X | None`, never `Optional[X]`. `list[str]`, never `List[str]`.
|
|
28
|
+
The sibling repos contain literally zero uses of `Optional`.
|
|
29
|
+
- `from __future__ import annotations` at the top of every module.
|
|
30
|
+
- Type-annotate every public function signature. Internal helpers: annotate where non-obvious.
|
|
31
|
+
- **Type checker is `ty` (Astral), not mypy.** `uv run ty check src/`.
|
|
32
|
+
- Prefer `pathlib.Path` over `os.path` (ruff `PTH` enforces this).
|
|
33
|
+
- Prefer functions over classes when a function will do.
|
|
34
|
+
- Prefer early returns to reduce nesting. No dead code — delete it, don't comment it out.
|
|
35
|
+
- **British spelling** in comments, docstrings and user-facing output: "behaviour",
|
|
36
|
+
"normalise", "minimised", "initialise". **No emoji anywhere** — code, commits, docs, output.
|
|
37
|
+
- Docstrings: public functions get them, private helpers usually don't. Labelled-section
|
|
38
|
+
dialect where a function has real parameters — a prose line, blank, then `Args:` /
|
|
39
|
+
`Returns:` / `References:`. Class docstrings carry a runnable `Example:`.
|
|
40
|
+
- Private helpers prefixed `_`. Modules export via explicit `__all__` where the surface matters.
|
|
41
|
+
`src/kedge/__init__.py` re-exports the public API and its docstring names what is public
|
|
42
|
+
versus internal.
|
|
43
|
+
|
|
44
|
+
## Logging
|
|
45
|
+
|
|
46
|
+
A maintained contract in the sibling repos, inherited wholesale:
|
|
47
|
+
|
|
48
|
+
- Module-level `logger = logging.getLogger(__name__)` after imports.
|
|
49
|
+
- **Lazy `%`-formatting**: `logger.info("loaded %d regions", n)` — never an f-string inside a
|
|
50
|
+
log call. Enforced by ruff `G`.
|
|
51
|
+
- **No `print()` in library code** — ruff `T20`. Permitted only in `cli.py`, `tests/`, and
|
|
52
|
+
`scripts/`. `rich` is for CLI output and report rendering only.
|
|
53
|
+
- **No `logging.basicConfig()`.** Handler setup happens once, at the entry point, idempotent,
|
|
54
|
+
attached only to the `kedge` namespace logger.
|
|
55
|
+
- INFO for stage entry/exit, DEBUG for branch decisions, WARNING for fallbacks, ERROR only for
|
|
56
|
+
genuinely unexpected exceptions.
|
|
57
|
+
|
|
58
|
+
## Models
|
|
59
|
+
|
|
60
|
+
- The house default is **`@dataclass(frozen=True, slots=True)`**. Use it for internal
|
|
61
|
+
structures that never cross a boundary.
|
|
62
|
+
- **pydantic v2 only where it earns its place**: config validation (good error messages naming
|
|
63
|
+
the file and key), and schemas serialised to or from the LLM, where the JSON Schema export
|
|
64
|
+
and the retry-on-mismatch behaviour are the whole point. Do not reach for it by reflex.
|
|
65
|
+
- `src/kedge/analysis/model.py` is **the contract**. Changing it is a cross-cutting change —
|
|
66
|
+
say so loudly rather than editing it quietly.
|
|
67
|
+
|
|
68
|
+
## The `.xl` namespace is a façade
|
|
69
|
+
|
|
70
|
+
`rwa_calculator` registered `col.irb.*`, then retired it and now **bans**
|
|
71
|
+
`@pl.api.register_*_namespace` outright — it accumulated dead methods and forced six `ty`
|
|
72
|
+
rules off project-wide. kedge still wants `col("x").xl.round(2)` because §2.6 makes
|
|
73
|
+
greppability the point, so the shape is a compromise:
|
|
74
|
+
|
|
75
|
+
- Real logic lives in plain typed module functions — `round_half_away(expr, digits) -> pl.Expr`
|
|
76
|
+
— importable, testable, composable via `.pipe(fn, ...)`.
|
|
77
|
+
- `xl/namespace.py` registers `.xl` and every method is a one-line delegation. The class holds
|
|
78
|
+
only `self._expr`. No logic, no state, no config capture.
|
|
79
|
+
- Deleting `namespace.py` must therefore be a clean removal, never a rewrite.
|
|
80
|
+
|
|
81
|
+
## Errors
|
|
82
|
+
|
|
83
|
+
- Define exceptions in the module that raises them; inherit from `kedge.errors.KedgeError`.
|
|
84
|
+
- Error messages state what was being attempted, what was found, and what the user can do.
|
|
85
|
+
`"could not decode DataMashup in customXml/item3.xml: not a zip archive"` — not `"parse error"`.
|
|
86
|
+
- Never swallow an exception without either logging it or turning it into a `Finding`.
|
|
87
|
+
|
|
88
|
+
## Tests
|
|
89
|
+
|
|
90
|
+
- `tests/unit/` — pure, fast, no I/O beyond fixtures. The default.
|
|
91
|
+
- `tests/corpus/` — runs the analyser over `tests/fixtures/*.xlsx`. Marked `@pytest.mark.corpus`.
|
|
92
|
+
- `tests/contract/` — needs a live marimo kernel. Marked `@pytest.mark.contract`. These must be
|
|
93
|
+
skippable and must clean up their subprocess even on failure.
|
|
94
|
+
- LLM-dependent tests marked `@pytest.mark.llm` and skipped unless a model endpoint is configured.
|
|
95
|
+
- Test names describe the behaviour: `test_round_half_away_from_zero_matches_excel`, not
|
|
96
|
+
`test_round_2`.
|
|
97
|
+
- **`kedge.xl` is tested against a table of known Excel outputs**, values transcribed from
|
|
98
|
+
Excel's actual behaviour. That table is the tripwire for a polars version bump.
|
|
99
|
+
|
|
100
|
+
## Layout
|
|
101
|
+
|
|
102
|
+
- `src/` layout. Import as `from kedge.analysis.model import WorkbookAnalysis`.
|
|
103
|
+
- One module, one job. If a module exceeds ~400 lines, it is probably two modules.
|
|
104
|
+
- `src/kedge/errors.py` holds the exception hierarchy.
|
|
105
|
+
- No module-level mutable global state. Anything process-wide hangs off `Workspace` (PLAN §2.9).
|
|
106
|
+
|
|
107
|
+
## Config & secrets
|
|
108
|
+
|
|
109
|
+
- Layered: `~/.kedge/config.toml` overridden by `./kedge.toml`. Loaded once into a pydantic
|
|
110
|
+
settings object owned by `Workspace`.
|
|
111
|
+
- **API keys live in the OS keyring**, never in config files, never in env vars committed
|
|
112
|
+
anywhere, never in a log line. Config stores `api_key_ref` — a keyring entry name.
|
|
113
|
+
- The server binds `127.0.0.1` only. No CORS config, no accounts, no cookies.
|
|
114
|
+
|
|
115
|
+
## Commands
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
uv run pytest # unit + corpus
|
|
119
|
+
uv run pytest -m contract # live-kernel tests (slow, spawns marimo)
|
|
120
|
+
uv run ruff check --fix .
|
|
121
|
+
uv run ruff format .
|
|
122
|
+
uv run kedge --help
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Before you hand work back: `uv run ruff check .` and `uv run ruff format --check .` clean, and
|
|
126
|
+
`uv run pytest` green. If something is genuinely blocked, say so explicitly — do not leave a
|
|
127
|
+
failing test unmentioned or a `pass` stub presented as finished.
|
kedge-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 OpenAfterHours
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
kedge-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kedge
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Turn manual Excel processes into reviewable, reproducible marimo notebooks.
|
|
5
|
+
Project-URL: Homepage, https://github.com/OpenAfterHours/kedge
|
|
6
|
+
Project-URL: Repository, https://github.com/OpenAfterHours/kedge
|
|
7
|
+
Project-URL: Issues, https://github.com/OpenAfterHours/kedge/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/OpenAfterHours/kedge/releases
|
|
9
|
+
Author: OpenAfterHours
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: excel,marimo,notebook,polars,reproducibility
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Environment :: Web Environment
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Office/Business :: Financial :: Spreadsheet
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.12
|
|
26
|
+
Requires-Dist: fastapi>=0.115
|
|
27
|
+
Requires-Dist: fastexcel>=0.12
|
|
28
|
+
Requires-Dist: httpx>=0.27
|
|
29
|
+
Requires-Dist: jinja2>=3.1
|
|
30
|
+
Requires-Dist: keyring>=25.4
|
|
31
|
+
Requires-Dist: marimo==0.23.15
|
|
32
|
+
Requires-Dist: openai>=1.60
|
|
33
|
+
Requires-Dist: openpyxl==3.1.5
|
|
34
|
+
Requires-Dist: polars==1.43.0
|
|
35
|
+
Requires-Dist: pydantic-settings>=2.5
|
|
36
|
+
Requires-Dist: pydantic>=2.9
|
|
37
|
+
Requires-Dist: python-docx>=1.1
|
|
38
|
+
Requires-Dist: python-multipart>=0.0.9
|
|
39
|
+
Requires-Dist: pyyaml>=6.0
|
|
40
|
+
Requires-Dist: rich>=13.9
|
|
41
|
+
Requires-Dist: tiktoken>=0.8
|
|
42
|
+
Requires-Dist: tomli-w>=1.0
|
|
43
|
+
Requires-Dist: typer>=0.15
|
|
44
|
+
Requires-Dist: uvicorn[standard]>=0.32
|
|
45
|
+
Requires-Dist: watchdog>=5.0
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
# kedge
|
|
49
|
+
|
|
50
|
+
[](https://github.com/OpenAfterHours/kedge/actions/workflows/ci.yml)
|
|
51
|
+
[](https://pypi.org/project/kedge/)
|
|
52
|
+
[](https://pypi.org/project/kedge/)
|
|
53
|
+
[](LICENSE)
|
|
54
|
+
|
|
55
|
+
Turn manual Excel processes into reviewable, reproducible [marimo](https://marimo.io) notebooks,
|
|
56
|
+
with an AI copilot that operates the notebook through a controlled tool surface.
|
|
57
|
+
|
|
58
|
+
> **Status:** under active construction. See `PLAN.md` for the full brief.
|
|
59
|
+
|
|
60
|
+
## What it does
|
|
61
|
+
|
|
62
|
+
1. **Analyses** a workbook offline — formula regions, dependency graph, SQL connections,
|
|
63
|
+
Power Query M, cached values, and a findings list (circular refs, volatile functions,
|
|
64
|
+
`IFERROR` swallowing, inconsistent formulas within a region).
|
|
65
|
+
2. **Plans** the conversion — an AI-proposed, user-approved `ProcessPlan` describing stages,
|
|
66
|
+
open questions, and what it intends to drop.
|
|
67
|
+
3. **Scaffolds** a marimo notebook from the approved plan.
|
|
68
|
+
4. **Reconciles** the generated Python against the values Excel last cached, so the
|
|
69
|
+
translation checks itself against evidence rather than declaring itself finished.
|
|
70
|
+
|
|
71
|
+
## Quick start
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
uv tool install kedge
|
|
75
|
+
kedge hub # a browser landing page: every workbook kedge has seen
|
|
76
|
+
kedge open process.xlsx # straight to one, if you already know which
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`kedge hub` starts the server with nothing open and puts a browser on the list. Add a workbook by
|
|
80
|
+
browsing the filesystem, pasting a path, or dropping one on the page; each row shows whether the
|
|
81
|
+
file is still there, whether a notebook and an approved plan exist, how many findings the analysis
|
|
82
|
+
turned up and how much of the workbook the plan believes it can convert. Opening one runs the same
|
|
83
|
+
sequence `kedge open` runs — clean up, analyse, plan, scaffold, spawn marimo, bootstrap the session
|
|
84
|
+
— with the progress streamed into the page, and lands you in the chat-plus-notebook view. Where a
|
|
85
|
+
marimo kedge started is still running, the hub offers to reattach rather than starting a second.
|
|
86
|
+
|
|
87
|
+
Or, offline and standalone — the analyser is useful on its own:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
kedge inspect process.xlsx --out analysis.json --report report.html
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Design notes
|
|
94
|
+
|
|
95
|
+
- Generated code is **polars**, never pandas — enforced in the validation gate.
|
|
96
|
+
- Excel's semantics do not match polars' (rounding mode, empty-vs-null, divide-by-zero).
|
|
97
|
+
`kedge.xl` is a registered polars namespace that makes each compatibility choice
|
|
98
|
+
explicit and greppable: `col("amount").xl.round(2)`.
|
|
99
|
+
- Single-user, local, loopback-bound. No accounts, no server deployment.
|
|
100
|
+
|
|
101
|
+
## Contributing
|
|
102
|
+
|
|
103
|
+
`CONVENTIONS.md` is binding — read it before opening a pull request. `CLAUDE.md` is the shortest
|
|
104
|
+
useful orientation to the codebase, and `RELEASING.md` covers how a version tag becomes a release.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
uv sync
|
|
108
|
+
uv run pytest # unit + corpus
|
|
109
|
+
uv run pytest -m contract # live-kernel tests; spawns a real marimo
|
|
110
|
+
uv run ruff check . && uv run ruff format --check .
|
|
111
|
+
uv run python scripts/guardrails.py
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Apache-2.0.
|
kedge-0.0.1/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# kedge
|
|
2
|
+
|
|
3
|
+
[](https://github.com/OpenAfterHours/kedge/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pypi.org/project/kedge/)
|
|
5
|
+
[](https://pypi.org/project/kedge/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
Turn manual Excel processes into reviewable, reproducible [marimo](https://marimo.io) notebooks,
|
|
9
|
+
with an AI copilot that operates the notebook through a controlled tool surface.
|
|
10
|
+
|
|
11
|
+
> **Status:** under active construction. See `PLAN.md` for the full brief.
|
|
12
|
+
|
|
13
|
+
## What it does
|
|
14
|
+
|
|
15
|
+
1. **Analyses** a workbook offline — formula regions, dependency graph, SQL connections,
|
|
16
|
+
Power Query M, cached values, and a findings list (circular refs, volatile functions,
|
|
17
|
+
`IFERROR` swallowing, inconsistent formulas within a region).
|
|
18
|
+
2. **Plans** the conversion — an AI-proposed, user-approved `ProcessPlan` describing stages,
|
|
19
|
+
open questions, and what it intends to drop.
|
|
20
|
+
3. **Scaffolds** a marimo notebook from the approved plan.
|
|
21
|
+
4. **Reconciles** the generated Python against the values Excel last cached, so the
|
|
22
|
+
translation checks itself against evidence rather than declaring itself finished.
|
|
23
|
+
|
|
24
|
+
## Quick start
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
uv tool install kedge
|
|
28
|
+
kedge hub # a browser landing page: every workbook kedge has seen
|
|
29
|
+
kedge open process.xlsx # straight to one, if you already know which
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`kedge hub` starts the server with nothing open and puts a browser on the list. Add a workbook by
|
|
33
|
+
browsing the filesystem, pasting a path, or dropping one on the page; each row shows whether the
|
|
34
|
+
file is still there, whether a notebook and an approved plan exist, how many findings the analysis
|
|
35
|
+
turned up and how much of the workbook the plan believes it can convert. Opening one runs the same
|
|
36
|
+
sequence `kedge open` runs — clean up, analyse, plan, scaffold, spawn marimo, bootstrap the session
|
|
37
|
+
— with the progress streamed into the page, and lands you in the chat-plus-notebook view. Where a
|
|
38
|
+
marimo kedge started is still running, the hub offers to reattach rather than starting a second.
|
|
39
|
+
|
|
40
|
+
Or, offline and standalone — the analyser is useful on its own:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
kedge inspect process.xlsx --out analysis.json --report report.html
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Design notes
|
|
47
|
+
|
|
48
|
+
- Generated code is **polars**, never pandas — enforced in the validation gate.
|
|
49
|
+
- Excel's semantics do not match polars' (rounding mode, empty-vs-null, divide-by-zero).
|
|
50
|
+
`kedge.xl` is a registered polars namespace that makes each compatibility choice
|
|
51
|
+
explicit and greppable: `col("amount").xl.round(2)`.
|
|
52
|
+
- Single-user, local, loopback-bound. No accounts, no server deployment.
|
|
53
|
+
|
|
54
|
+
## Contributing
|
|
55
|
+
|
|
56
|
+
`CONVENTIONS.md` is binding — read it before opening a pull request. `CLAUDE.md` is the shortest
|
|
57
|
+
useful orientation to the codebase, and `RELEASING.md` covers how a version tag becomes a release.
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
uv sync
|
|
61
|
+
uv run pytest # unit + corpus
|
|
62
|
+
uv run pytest -m contract # live-kernel tests; spawns a real marimo
|
|
63
|
+
uv run ruff check . && uv run ruff format --check .
|
|
64
|
+
uv run python scripts/guardrails.py
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Apache-2.0.
|