unnotebook 0.1.0__py3-none-win_amd64.whl

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,131 @@
1
+ Metadata-Version: 2.4
2
+ Name: unnotebook
3
+ Version: 0.1.0
4
+ Classifier: Development Status :: 1 - Planning
5
+ Classifier: Programming Language :: Rust
6
+ License-File: LICENSE
7
+ Summary: Deterministic static analysis and refactoring for data-science code.
8
+ Author: William Martin
9
+ License-Expression: MIT
10
+ Requires-Python: >=3.11
11
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
12
+ Project-URL: Homepage, https://github.com/w-martin/unnotebook
13
+ Project-URL: Issue Tracker, https://github.com/w-martin/unnotebook/issues
14
+ Project-URL: Repository, https://github.com/w-martin/unnotebook
15
+
16
+ # unnotebook
17
+
18
+ [![CI](https://github.com/w-martin/unnotebook/actions/workflows/ci.yml/badge.svg)](https://github.com/w-martin/unnotebook/actions/workflows/ci.yml)
19
+ [![PyPI version](https://img.shields.io/pypi/v/unnotebook.svg)](https://pypi.org/project/unnotebook/)
20
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
21
+
22
+ > ⚠️ **Project status: early proof of concept (v0.1.0).** The recognisers cover a narrow set of notebook shapes, and
23
+ > anything outside them is refused rather than guessed at.
24
+
25
+ **Deterministic static analysis and refactoring for data-science code. `unnotebook` finds bugs in notebooks and
26
+ scripts, fixes the ones it can prove, and rewrites a training notebook as a tested, hexagonal Python project.**
27
+
28
+ - **No LLM, no execution.** Everything is derived from the syntax tree (via the [ruff](https://github.com/astral-sh/ruff)
29
+ parser crates). Your code is never run.
30
+ - **Proven fixes only.** A finding is auto-fixed only when the fix is known to be correct; everything else is reported.
31
+ - **Refuses instead of guessing.** If a stage of the pipeline is not recognised, `rewrite` stops and lists exactly what
32
+ is missing.
33
+ - **A single native binary.** Written in Rust; Python is only the language it analyses.
34
+
35
+ ## Installation
36
+
37
+ ```shell
38
+ uv tool install unnotebook
39
+ # or
40
+ pip install unnotebook
41
+ ```
42
+
43
+ The wheel carries only the native executable, so it works with any Python from 3.11. Static Linux executables
44
+ (x86_64 and aarch64, musl) with build-provenance attestations are attached to each
45
+ [GitHub release](https://github.com/w-martin/unnotebook/releases):
46
+
47
+ ```shell
48
+ gh attestation verify unnotebook-x86_64-unknown-linux-musl.tar.gz --repo w-martin/unnotebook
49
+ ```
50
+
51
+ ## Commands
52
+
53
+ ### `check`
54
+
55
+ Reports data-science smells in `.py` files and `.ipynb` notebooks, with notebook cell coordinates.
56
+
57
+ ```shell
58
+ unnotebook check analysis.ipynb
59
+ # analysis.ipynb:cell 3:2:1: API001 `.fillna(inplace=True)` on `df['Age']` updates a copy, so the original is never changed (a no-op under pandas >= 3 copy-on-write)
60
+ # analysis.ipynb:cell 3:3:1: API001 `.replace(inplace=True)` on `df['Sex']` updates a copy, so the original is never changed (a no-op under pandas >= 3 copy-on-write)
61
+ # Found 2 findings.
62
+ ```
63
+
64
+ | Code | Finding |
65
+ |------------|--------------------------------------------------------------------------|
66
+ | `API001` | Chained `inplace=True` call that silently updates a copy (auto-fixable) |
67
+ | `LEAK001` | Test data imputed or standardised with its own statistics, not train's |
68
+ | `LEAK002` | Encoder or dummies fitted separately on train and test |
69
+ | `EVAL001` | Model evaluated on its own training data |
70
+ | `CFG001` | Hard-coded absolute data path |
71
+ | `REPRO001` | No random seed set |
72
+
73
+ ### `fix`
74
+
75
+ Rewrites files to remove the findings that have a proven fix, in place or into `--output-dir`.
76
+
77
+ ```shell
78
+ unnotebook fix analysis.ipynb
79
+ # Fixed 2, 0 remaining.
80
+ ```
81
+
82
+ ### `rewrite`
83
+
84
+ Turns a notebook, a script or a repository into a modular project:
85
+
86
+ ```shell
87
+ unnotebook rewrite --output-dir titanic_pipeline titanic.ipynb
88
+ ```
89
+
90
+ The generated project has:
91
+
92
+ - hexagonal layers (`domain`, `application`, `infrastructure`) with dependencies pointing inward, and thin
93
+ `train`, `evaluate`, `predict` and `serve` entrypoints exposed as console scripts;
94
+ - a lazy composition root (`container.py`), so heavy optional libraries (Keras, MLflow, OpenTelemetry) are imported
95
+ only when used;
96
+ - preprocessing refitted on the training data only, with the leaks it corrected recorded in `plan.toml`;
97
+ - [typedframes](https://github.com/w-martin/typedframes) schemas for the raw inputs, configuration in TOML, structured
98
+ logging, a run manifest and a FastAPI inference service;
99
+ - a stage-wise golden-master test that keeps the notebook's own preprocessing verbatim and checks the new pipeline
100
+ against it on synthetic data.
101
+
102
+ Supported today: Keras `Sequential` models with `Dense` layers and scikit-learn classifiers built from literal
103
+ arguments, with median/mode imputation, `get_dummies` one-hot encoding, row-wise feature engineering, and column
104
+ selection. Given a repository, the one script that matches becomes the pipeline and the remaining scripts are carried
105
+ over verbatim.
106
+
107
+ ## Exit codes
108
+
109
+ | Code | Meaning |
110
+ |------|-------------------------------------------------------------------------------|
111
+ | `0` | Clean, or everything was fixed or rewritten |
112
+ | `1` | Findings remain, or `rewrite` could not place some statements |
113
+ | `2` | Error: unreadable input, syntax error, or `rewrite` refused the input |
114
+
115
+ ## Building from source
116
+
117
+ Requires a Rust toolchain and [uv](https://docs.astral.sh/uv/).
118
+
119
+ ```shell
120
+ git clone https://github.com/w-martin/unnotebook
121
+ cd unnotebook
122
+ uv sync
123
+ uv run unnotebook --help
124
+ ```
125
+
126
+ The development gate (format, lint, tests) is `uv run inv all`.
127
+
128
+ ## License
129
+
130
+ [MIT](LICENSE)
131
+
@@ -0,0 +1,6 @@
1
+ unnotebook-0.1.0.data/scripts/unnotebook.exe,sha256=Ht6QBT3ish4JHGRRazAiKha4QUKZIUsWGavkFEZjR8A,2404352
2
+ unnotebook-0.1.0.dist-info/METADATA,sha256=Pf3lkNLQQ8Q7BXXZkuNloC3rUaYciqhp9fF41OhAkTU,5915
3
+ unnotebook-0.1.0.dist-info/WHEEL,sha256=Uvw7WSmy7Kj2FBk8Va4L_dq4MDW8X5Ynby-pOX3ZNS0,94
4
+ unnotebook-0.1.0.dist-info/licenses/LICENSE,sha256=NWPpJ9Cp5Ne0NLtf--lrssGvt2E_KEcpdEncVbYuQ4s,1092
5
+ unnotebook-0.1.0.dist-info/sboms/unnotebook.cyclonedx.json,sha256=AB4hgcSUkwVo_pOQL9ksfuHUayyMMZQI5xAnDa1Yq0E,113016
6
+ unnotebook-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.16.0)
3
+ Root-Is-Purelib: false
4
+ Tag: py3-none-win_amd64
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 William Martin
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.