renkin 0.30.0 → 0.32.0

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.
package/README.md CHANGED
@@ -21,13 +21,19 @@
21
21
 
22
22
  ---
23
23
 
24
+ **Keep your planner. Audit every route.** Audit retrosynthesis routes from AiZynthFinder, Syntheseus, or RENKIN — locally, reproducibly, and without sending molecular structures anywhere.
25
+
26
+ [**Audit a route in your browser →**](https://kent-tokyo.github.io/renkin/playground/) · [**Python quick start ↓**](#audit-a-route) · [**Route planning engine ↓**](#quick-start)
27
+
28
+ ---
29
+
24
30
  ## What is RENKIN?
25
31
 
26
- RENKIN is an open-source **retrosynthesis engine** for **computer-aided synthesis planning (CASP)** that automatically discovers optimal chemical reaction routes from a target molecule back to cheap, commercially available starting materials.
32
+ RENKIN Bridge is a tool-neutral **route auditor**: it checks structural integrity, stock coverage, and declared-reaction forward-replay for routes from **AiZynthFinder**, **Syntheseus**, or RENKIN's own planner the identical `pass`/`fail`/`partial` pipeline regardless of which tool produced the route, entirely local and reproducible (every audit records a verifiable [`audit_manifest`](https://kent-tokyo.github.io/renkin/guides/audit-reproducibility-contract/)), structures never leaving your machine unless you explicitly ask.
27
33
 
28
- Built entirely in Rust with the [`chematic`](https://docs.rs/chematic/) cheminformatics crate zero C/C++ dependencies, `#![forbid(unsafe_code)]` throughout. One codebase compiles to a native CLI, a Rust library, Python wheels (PyO3), and a WebAssembly module that runs entirely client-side in the browser.
34
+ RENKIN is also, in its own right, an open-source **retrosynthesis engine** for **computer-aided synthesis planning (CASP)** that automatically discovers chemical reaction routes from a target molecule back to cheap, commercially available starting materials.
29
35
 
30
- Use RENKIN as an independent audit layer for retrosynthesis routes generated by RENKIN or AiZynthFinder see [RENKIN Bridge / `audit-route`](#key-features) below.
36
+ Built entirely in Rust with the [`chematic`](https://docs.rs/chematic/) cheminformatics crate zero C/C++ dependencies, `#![forbid(unsafe_code)]` throughout. One codebase compiles to a native CLI, a Rust library, Python wheels (PyO3), and a WebAssembly module that runs entirely client-side in the browser.
31
37
 
32
38
  ---
33
39
 
@@ -39,6 +45,10 @@ cargo add renkin # Rust
39
45
  npm install renkin # JavaScript (browser / bundler -- see docs/api/wasm.md)
40
46
  ```
41
47
 
48
+ Auditing Syntheseus routes needs one more, optional package:
49
+ `pip install renkin[syntheseus]` (verified against Syntheseus `0.7.2` and
50
+ `0.8.0` — see the [compatibility spike](https://github.com/kent-tokyo/renkin/blob/master/docs/design/syntheseus-0.8-compatibility-spike.md)).
51
+
42
52
  ---
43
53
 
44
54
  ## Live Playground
@@ -47,8 +57,44 @@ npm install renkin # JavaScript (browser / bundler -- see docs/api/wasm
47
57
 
48
58
  ---
49
59
 
60
+ ## Audit a Route
61
+
62
+ Bring a route from wherever you already plan them — every path below runs through the identical audit pipeline: the same `pass`/`fail`/`partial` verdict regardless of source tool, or whether you ran it from the CLI, Python, or a browser tab.
63
+
64
+ **AiZynthFinder**
65
+
66
+ ```python
67
+ import json
68
+ import renkin
69
+
70
+ report = json.loads(
71
+ renkin.audit_route(open("trees.json").read(), format="aizynthfinder")
72
+ )
73
+ print(report["summary"])
74
+ ```
75
+
76
+ **Syntheseus** (`pip install renkin[syntheseus]`)
77
+
78
+ ```python
79
+ import json
80
+ import renkin
81
+ from renkin.syntheseus_exporter import dumps_syntheseus_route_v1
82
+
83
+ route_json = dumps_syntheseus_route_v1(my_synthesis_graph)
84
+ report = json.loads(renkin.audit_route(route_json, format="syntheseus"))
85
+ print(report["summary"])
86
+ ```
87
+
88
+ **In your browser** — no installation, no upload, no server: [**Try the Playground →**](https://kent-tokyo.github.io/renkin/playground/)
89
+
90
+ Full walkthroughs with real output, end to end: [AiZynthFinder](https://kent-tokyo.github.io/renkin/guides/aizynthfinder-audit-demo/) · [Syntheseus](https://kent-tokyo.github.io/renkin/guides/syntheseus-audit-demo/).
91
+
92
+ ---
93
+
50
94
  ## Quick Start
51
95
 
96
+ *Planning a route from scratch, not auditing one you already have — see [Audit a Route](#audit-a-route) above for that.*
97
+
52
98
  ```python
53
99
  import json
54
100
  import renkin
@@ -114,8 +160,9 @@ that fix and are invalidated. RENKIN does not predict yields, calibrated
114
160
  experimental success probabilities, or side reactions, and does not search
115
161
  the literature automatically (`success_probability` is a template-frequency
116
162
  search-ranking score, not a calibrated prediction — see
117
- [Benchmark](https://kent-tokyo.github.io/renkin/benchmark/) for the current
118
- corrected numbers, full methodology, and known limitations).
163
+ [Benchmark](https://kent-tokyo.github.io/renkin/benchmark/) for the corrected
164
+ historical baseline, full methodology, and known limitations — that page is a
165
+ frozen, single-commit measurement, not a live number).
119
166
 
120
167
  ---
121
168
 
@@ -346,7 +393,7 @@ for the full acceptance criteria and licensing split.
346
393
  | **Ring-context safety guard** | `--ring-context-policy conservative --ring-context-sidecar <path>` — opt-in match-level filter that rejects an extracted template's ring-opening/closing disconnection when its historical training data never observed that bond as ring-forming/-breaking; default `disabled` (unchanged legacy behavior) — see [Issue #72](https://github.com/kent-tokyo/renkin/issues/72) |
347
394
  | **LightGBM candidate reranker** | `--reranker-model`/`--reranker-freq-table` (CLI) or `reranker_model_path`/`reranker_freq_table_path` (Python) — opt-in, ordering-only re-ranking via a frozen LightGBM model; never changes which candidates are generated, only their order, and reproduces legacy ordering byte-for-byte when off. Paired 100-target route-search gate: `route_to_configured_stock` 16→20 (+4/-0). `python3 scripts/fetch_reranker_model.py` fetches the frozen model (SHA-256-verified, not bundled in any package — see [Roadmap](#roadmap)) |
348
395
  | **Coverage mode** (opt-in) | `--search-mode coverage --coverage-templates <path>` (CLI) or `search_mode="coverage"`, `coverage_templates_path=...` (Python) — if the default template set finds no route, automatically escalates to a larger, separately loaded template set, cooperatively cancellable via `--coverage-timeout-secs`. Standard-mode output is byte-for-byte unchanged when not used. `python3 scripts/fetch_coverage_templates.py` fetches the frozen 2,000-template Stage-2 set (SHA-256-verified, not bundled in any package, same reasoning as the reranker model — see [Roadmap](#roadmap)) |
349
- | **RENKIN Bridge / `audit-route`** | `renkin audit-route route.json [--format auto\|renkin\|aizynthfinder\|syntheseus] [--stock stock.smi] [--output human\|json]` — tool-neutral route audit: structural integrity, stock, and declared-reaction forward-replay validation, each reported independently as `pass`/`fail`/`not_evaluable`, rolled up into a route-level `pass`/`fail`/`partial` verdict. Reads RENKIN-native route JSON (v0.25.0), real AiZynthFinder route JSON — single-target and gzip-compressed batch output, verified against AiZynthFinder v4.4.1 specifically, not claimed for every version (v0.26.0) — and Syntheseus routes via the optional `renkin.syntheseus_exporter`'s `syntheseus-route-v1` interchange schema, since Syntheseus itself has no native route export (v0.30.0); `--format auto` detects the input shape and hard-errors rather than guessing on anything ambiguous. [AiZynthFinder walkthrough →](https://kent-tokyo.github.io/renkin/guides/aizynthfinder-audit-demo/) · [Syntheseus walkthrough →](https://kent-tokyo.github.io/renkin/guides/syntheseus-audit-demo/) |
396
+ | **RENKIN Bridge / `audit-route`** | `renkin audit-route route.json [--format auto\|renkin\|aizynthfinder\|syntheseus] [--stock stock.smi] [--output human\|json]` — tool-neutral route audit: structural integrity, stock, and declared-reaction forward-replay validation, each reported independently as `pass`/`fail`/`not_evaluable`, rolled up into a route-level `pass`/`fail`/`partial` verdict. Reads RENKIN-native route JSON (v0.25.0), real AiZynthFinder route JSON — single-target and gzip-compressed batch output, verified against AiZynthFinder 4.3.2, 4.4.0, and 4.4.1 specifically, not claimed for every version (v0.26.0, version matrix widened v0.32.0) — and Syntheseus routes via the optional `renkin.syntheseus_exporter`'s `syntheseus-route-v1` interchange schema, since Syntheseus itself has no native route export (v0.30.0); `--format auto` detects the input shape and hard-errors rather than guessing on anything ambiguous. [AiZynthFinder walkthrough →](https://kent-tokyo.github.io/renkin/guides/aizynthfinder-audit-demo/) · [Syntheseus walkthrough →](https://kent-tokyo.github.io/renkin/guides/syntheseus-audit-demo/) |
350
397
  | **Route scoring** | `confidence`, `step_confidence`, `success_probability` (Retro-prob style), `convergency`, `atom_economy`, `route_cost` (`Σ BB cost + steps×0.5`, or actual prices via `--bb-prices`/`--stock`) per step/route — see caveat below the table |
351
398
  | **Step metadata provenance** | Each step reports `metadata_source`/`metadata_scope` so it's machine-readable whether `conditions`/`reaction_family` came from a rule-author default vs. something more grounded; absent (not fabricated) for extracted templates |
352
399
  | **Pareto multi-objective search** | `--format pareto` returns a Pareto front across `route_cost`/`success_probability`/`steps`; objectives configurable via `--objectives` |
@@ -504,7 +551,7 @@ The JSON output includes `avg_nodes_expanded`, `avg_confidence`, `avg_convergenc
504
551
  | `plan_with_constraints` | Constraint-DSL planning (element filters, step limits, confidence thresholds) |
505
552
  | `estimate_diversity` | Route diversity and coverage metrics |
506
553
 
507
- The server auto-detects `data/building_blocks.smi` and `data/templates_extracted_5000.smi` in the working directory. Falls back to the embedded `DEFAULT_BUILDING_BLOCKS` / `default_rules()` defaults if not found (152 unique building blocks per `ChemEnv::bb_count()`, 28 handcrafted rules — verified 2026-07-22; a "509-BB / 20-rule" figure was previously documented here without verification).
554
+ The server auto-detects `data/building_blocks.smi` and `data/templates_extracted_5000.smi` in the working directory. Falls back to the embedded `DEFAULT_BUILDING_BLOCKS` / `default_rules()` defaults if not found (152 unique building blocks per `ChemEnv::bb_count()`, 27 handcrafted rules — verified 2026-08-22, after `aryl_amine_retro`'s removal (issue #77) dropped the count from 28; a "509-BB / 20-rule" figure was previously documented here without verification).
508
555
 
509
556
  ```bash
510
557
  cargo build --release
@@ -651,7 +698,7 @@ see "Earlier milestones" below for older shipped work.
651
698
  Percentage figures below are historical milestones at the time each was
652
699
  shipped, not current performance — several predate the validator-accuracy
653
700
  fix noted in [Current Limitations](#current-limitations) and are invalidated;
654
- see [Benchmark](#benchmark) for the current corrected numbers.
701
+ see [Benchmark](#benchmark) for the corrected historical baseline.
655
702
 
656
703
  - [x] Reranker made actually usable: Python exposure + batteries-included model distribution ([#101](https://github.com/kent-tokyo/renkin/issues/101), v0.23.0) — see "Recently shipped" above for the current-cycle summary; full detail in [`CHANGELOG.md`](CHANGELOG.md)
657
704
  - [x] Stable `template_id` (`rule:<name>` / `smirks-sha256:<hex>`) + `--template-metadata` evidence sidecar + `renkin template ids` ([#41](https://github.com/kent-tokyo/renkin/issues/41) phase 1)
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "kent-tokyo <kent-tokyo@users.noreply.github.com>"
6
6
  ],
7
7
  "description": "Ultra-fast retrosynthesis engine for computer-aided synthesis planning (CASP) — pure Rust, WASM-ready, Python bindings via PyO3",
8
- "version": "0.30.0",
8
+ "version": "0.32.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
package/renkin_bg.wasm CHANGED
Binary file