pymolt 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.
Files changed (107) hide show
  1. pymolt-0.1.0/.gitignore +91 -0
  2. pymolt-0.1.0/LICENSE +176 -0
  3. pymolt-0.1.0/PKG-INFO +273 -0
  4. pymolt-0.1.0/README.md +232 -0
  5. pymolt-0.1.0/pymolt/__init__.py +1 -0
  6. pymolt-0.1.0/pymolt/adapters/__init__.py +1 -0
  7. pymolt-0.1.0/pymolt/adapters/github_forks.py +235 -0
  8. pymolt-0.1.0/pymolt/adapters/pypi_metadata.py +38 -0
  9. pymolt-0.1.0/pymolt/adapters/subprocess_runner.py +25 -0
  10. pymolt-0.1.0/pymolt/assess/__init__.py +29 -0
  11. pymolt-0.1.0/pymolt/assess/service.py +614 -0
  12. pymolt-0.1.0/pymolt/codemods/__init__.py +15 -0
  13. pymolt-0.1.0/pymolt/codemods/apply.py +1014 -0
  14. pymolt-0.1.0/pymolt/codemods/client.py +258 -0
  15. pymolt-0.1.0/pymolt/codemods/models.py +164 -0
  16. pymolt-0.1.0/pymolt/codemods/rules.py +745 -0
  17. pymolt-0.1.0/pymolt/codemods/service.py +453 -0
  18. pymolt-0.1.0/pymolt/config.py +221 -0
  19. pymolt-0.1.0/pymolt/core/__init__.py +19 -0
  20. pymolt-0.1.0/pymolt/core/enums.py +78 -0
  21. pymolt-0.1.0/pymolt/core/generated.py +27 -0
  22. pymolt-0.1.0/pymolt/core/graph.py +38 -0
  23. pymolt-0.1.0/pymolt/core/layers.py +15 -0
  24. pymolt-0.1.0/pymolt/core/legacy_stdlib.py +81 -0
  25. pymolt-0.1.0/pymolt/core/serialize.py +26 -0
  26. pymolt-0.1.0/pymolt/discovery/__init__.py +8 -0
  27. pymolt-0.1.0/pymolt/discovery/discover.py +255 -0
  28. pymolt-0.1.0/pymolt/discovery/dockerfile.py +244 -0
  29. pymolt-0.1.0/pymolt/discovery/models.py +138 -0
  30. pymolt-0.1.0/pymolt/discovery/tox_nox.py +142 -0
  31. pymolt-0.1.0/pymolt/doctor.py +193 -0
  32. pymolt-0.1.0/pymolt/ingestion/__init__.py +1 -0
  33. pymolt-0.1.0/pymolt/ingestion/conda_ingest.py +466 -0
  34. pymolt-0.1.0/pymolt/ingestion/config.py +107 -0
  35. pymolt-0.1.0/pymolt/ingestion/data/conda_pypi_map.json +29 -0
  36. pymolt-0.1.0/pymolt/ingestion/detect.py +630 -0
  37. pymolt-0.1.0/pymolt/ingestion/fallback_compiler.py +454 -0
  38. pymolt-0.1.0/pymolt/ingestion/lock_parsers.py +262 -0
  39. pymolt-0.1.0/pymolt/ingestion/name_mapping.py +172 -0
  40. pymolt-0.1.0/pymolt/ingestion/orchestrator.py +154 -0
  41. pymolt-0.1.0/pymolt/ingestion/resolve_cache.py +84 -0
  42. pymolt-0.1.0/pymolt/ingestion/uv_runner.py +282 -0
  43. pymolt-0.1.0/pymolt/interfaces/__init__.py +1 -0
  44. pymolt-0.1.0/pymolt/interfaces/cli/__init__.py +1 -0
  45. pymolt-0.1.0/pymolt/interfaces/cli/__main__.py +9 -0
  46. pymolt-0.1.0/pymolt/interfaces/cli/commands.py +2867 -0
  47. pymolt-0.1.0/pymolt/interfaces/cli/output.py +135 -0
  48. pymolt-0.1.0/pymolt/interfaces/cli/verify_cmd.py +657 -0
  49. pymolt-0.1.0/pymolt/interfaces/mcp_server.py +1263 -0
  50. pymolt-0.1.0/pymolt/inventory/__init__.py +1 -0
  51. pymolt-0.1.0/pymolt/inventory/code_scan.py +10 -0
  52. pymolt-0.1.0/pymolt/inventory/edges.py +319 -0
  53. pymolt-0.1.0/pymolt/inventory/intersect.py +10 -0
  54. pymolt-0.1.0/pymolt/migration_plan.py +733 -0
  55. pymolt-0.1.0/pymolt/migration_state.py +83 -0
  56. pymolt-0.1.0/pymolt/py.typed +0 -0
  57. pymolt-0.1.0/pymolt/risk/__init__.py +6 -0
  58. pymolt-0.1.0/pymolt/risk/assess.py +214 -0
  59. pymolt-0.1.0/pymolt/risk/cache.py +44 -0
  60. pymolt-0.1.0/pymolt/risk/models.py +39 -0
  61. pymolt-0.1.0/pymolt/risk/osv.py +59 -0
  62. pymolt-0.1.0/pymolt/scan/__init__.py +11 -0
  63. pymolt-0.1.0/pymolt/scan/report.py +33 -0
  64. pymolt-0.1.0/pymolt/setup/__init__.py +31 -0
  65. pymolt-0.1.0/pymolt/setup/baseline_hint.py +83 -0
  66. pymolt-0.1.0/pymolt/setup/pythons.py +118 -0
  67. pymolt-0.1.0/pymolt/setup/service.py +380 -0
  68. pymolt-0.1.0/pymolt/setup/target_hint.py +196 -0
  69. pymolt-0.1.0/pymolt/status.py +426 -0
  70. pymolt-0.1.0/pymolt/strategic/__init__.py +5 -0
  71. pymolt-0.1.0/pymolt/strategic/forknet/__init__.py +1 -0
  72. pymolt-0.1.0/pymolt/strategic/forknet/cache.py +45 -0
  73. pymolt-0.1.0/pymolt/strategic/forknet/models.py +111 -0
  74. pymolt-0.1.0/pymolt/strategic/forknet/service.py +143 -0
  75. pymolt-0.1.0/pymolt/strategic/succession/__init__.py +3 -0
  76. pymolt-0.1.0/pymolt/strategic/succession/client.py +72 -0
  77. pymolt-0.1.0/pymolt/strategic/succession/detect.py +23 -0
  78. pymolt-0.1.0/pymolt/strategic/succession/models.py +61 -0
  79. pymolt-0.1.0/pymolt/strategic/succession/service.py +59 -0
  80. pymolt-0.1.0/pymolt/strategic/succession/transplant.py +91 -0
  81. pymolt-0.1.0/pymolt/verify/__init__.py +63 -0
  82. pymolt-0.1.0/pymolt/verify/_backend.py +408 -0
  83. pymolt-0.1.0/pymolt/verify/_install_hook.py +68 -0
  84. pymolt-0.1.0/pymolt/verify/_normalize.py +106 -0
  85. pymolt-0.1.0/pymolt/verify/_sinks.py +273 -0
  86. pymolt-0.1.0/pymolt/verify/_wrap.py +417 -0
  87. pymolt-0.1.0/pymolt/verify/boundary_tracer.py +219 -0
  88. pymolt-0.1.0/pymolt/verify/cascade.py +173 -0
  89. pymolt-0.1.0/pymolt/verify/comparators.py +88 -0
  90. pymolt-0.1.0/pymolt/verify/contact_map.py +421 -0
  91. pymolt-0.1.0/pymolt/verify/contract.py +150 -0
  92. pymolt-0.1.0/pymolt/verify/coverage.py +119 -0
  93. pymolt-0.1.0/pymolt/verify/diff.py +102 -0
  94. pymolt-0.1.0/pymolt/verify/export_watcher.py +73 -0
  95. pymolt-0.1.0/pymolt/verify/gaps.py +232 -0
  96. pymolt-0.1.0/pymolt/verify/golden_master.py +57 -0
  97. pymolt-0.1.0/pymolt/verify/models.py +285 -0
  98. pymolt-0.1.0/pymolt/verify/policy.py +328 -0
  99. pymolt-0.1.0/pymolt/verify/probe.py +156 -0
  100. pymolt-0.1.0/pymolt/verify/reinvoke.py +133 -0
  101. pymolt-0.1.0/pymolt/verify/report.py +417 -0
  102. pymolt-0.1.0/pymolt/verify/sandbox.py +142 -0
  103. pymolt-0.1.0/pymolt/verify/service.py +1516 -0
  104. pymolt-0.1.0/pymolt/verify/shadow.py +259 -0
  105. pymolt-0.1.0/pymolt/verify/sitecustomize.py +27 -0
  106. pymolt-0.1.0/pymolt/verify/unified.py +180 -0
  107. pymolt-0.1.0/pyproject.toml +123 -0
@@ -0,0 +1,91 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # Unit test / coverage reports
30
+ htmlcov/
31
+ .tox/
32
+ .nox/
33
+ .coverage
34
+ .coverage.*
35
+ .cache
36
+ nosetests.xml
37
+ coverage.xml
38
+ *.cover
39
+ *.py,cover
40
+ .hypothesis/
41
+ .pytest_cache/
42
+
43
+ # Environments
44
+ .env
45
+ .venv
46
+ env/
47
+ venv/
48
+ ENV/
49
+ env.bak/
50
+ venv.bak/
51
+
52
+ # IDE
53
+ .idea/
54
+ .vscode/
55
+ *.swp
56
+ *.swo
57
+ *~
58
+
59
+ # Ruff cache
60
+ .ruff_cache/
61
+
62
+ # local pymolt cache
63
+ .pymolt_cache/
64
+ .pymolt/
65
+
66
+ # exported watcher bundle (regenerable: pymolt contract export-watcher)
67
+ /bundle/
68
+
69
+ # OS
70
+ .DS_Store
71
+ Thumbs.db
72
+
73
+ # Logs
74
+ *.log
75
+
76
+ # Migration Test Projects
77
+ tests/artifacts/*
78
+ tests/artifacts/flasgger/
79
+ tests/artifacts/blaze/
80
+ tests/artifacts/pyfolio/
81
+ .old
82
+ .research
83
+ .agent.md
84
+ .out
85
+ out
86
+ .pymolt/env_config.json
87
+ .codegraph
88
+ .claude
89
+ CLAUDE.md
90
+ EDITIONS.md
91
+ services/
pymolt-0.1.0/LICENSE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or exemplary damages of any kind arising as a result of
159
+ this License or out of the use or inability to use the Work (including
160
+ but not limited to damages for loss of goodwill, work stoppage,
161
+ computer failure or malfunction, or any and all other commercial
162
+ damages or losses), even if such Contributor has been advised of the
163
+ possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
pymolt-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,273 @@
1
+ Metadata-Version: 2.5
2
+ Name: pymolt
3
+ Version: 0.1.0
4
+ Summary: Prove your Python migration didn't change what your code does.
5
+ Project-URL: Homepage, https://pymolt.zeelex.me
6
+ Project-URL: Repository, https://github.com/iamzeelex/pymolt
7
+ Project-URL: Issues, https://github.com/iamzeelex/pymolt/issues
8
+ Author-email: Leo Vaychik <pymolt@zeelex.me>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: behavioral-testing,cli,codemod,dependency-management,libcst,mcp,migration,python,upgrade
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Build Tools
20
+ Classifier: Topic :: Software Development :: Quality Assurance
21
+ Classifier: Topic :: Software Development :: Testing
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.12
24
+ Requires-Dist: griffe[pypi]>=1.0.0
25
+ Requires-Dist: httpx>=0.27.0
26
+ Requires-Dist: libcst>=1.0.0
27
+ Requires-Dist: networkx>=3.0
28
+ Requires-Dist: packaging>=25.0
29
+ Requires-Dist: pydantic>=2.0
30
+ Requires-Dist: pyyaml>=6.0
31
+ Requires-Dist: rich>=13.0.0
32
+ Requires-Dist: typer>=0.12.0
33
+ Provides-Extra: dev
34
+ Requires-Dist: fastapi>=0.110; extra == 'dev'
35
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
36
+ Requires-Dist: requests>=2.0; extra == 'dev'
37
+ Requires-Dist: ruff>=0.8.0; extra == 'dev'
38
+ Provides-Extra: mcp
39
+ Requires-Dist: mcp>=1.2; extra == 'mcp'
40
+ Description-Content-Type: text/markdown
41
+
42
+ # PyMolt
43
+
44
+ **Prove your Python migration didn't change what your code does.**
45
+
46
+ Upgrading Python or a major dependency is easy to *start* and almost impossible to *finish* with confidence. The resolver goes green, the test suite goes green, and you still don't know whether some call now returns an empty generator where it used to return `None`.
47
+
48
+ PyMolt answers that question. It records what your code actually calls into its dependencies — before the migration and after — and reports exactly what changed: results, raised exceptions, calls that stopped happening altogether. No decorators, no code changes, no instrumentation of your app.
49
+
50
+ It also does the parts around it (surface scan, lock-first resolution, LibCST codemods), because a contract needs a migration to measure. But those are the means. The proof is the product.
51
+
52
+ ---
53
+
54
+ ## Why this exists
55
+
56
+ **A dependency resolve that succeeds is not a migration that works.** `uv pip compile` tells you a set of versions co-exists. It says nothing about behaviour. Neither does a passing test suite, unless your tests happen to cover every dependency call — and PyMolt will tell you what fraction they actually cover.
57
+
58
+ This matters more now that AI agents do migrations. We measured it ([`bench/RESULTS.md`](bench/RESULTS.md)): a coding agent with shell access resolves dependencies for Python 3.12 perfectly well on its own — it builds a venv, runs `pip check`, and gets there in about 45 seconds. But asked for the dependency contact surface of the same project, the same agent reported **35–38 call sites where there were 227**, because grepping imports finds modules, not the symbols your code actually calls. With PyMolt it got the exact number, in a fifth of the time and a thirteenth of the context.
59
+
60
+ That gap is the product: PyMolt is for the questions your agent cannot answer by reading files.
61
+
62
+ ---
63
+
64
+ ## Quick Start
65
+
66
+ Install via `uv` or `pipx`:
67
+
68
+ ```bash
69
+ uv tool install pymolt
70
+ # or with MCP server support:
71
+ uv tool install "pymolt[mcp]"
72
+ ```
73
+
74
+ **Record the contract before you change anything** — this is the step that cannot be recovered later:
75
+
76
+ ```bash
77
+ cd your-legacy-project
78
+ pymolt doctor .
79
+ pymolt contract capture --when baseline --mode tests -- pytest tests/
80
+ ```
81
+
82
+ Then migrate however you like — by hand, with `pymolt assess` + `pymolt codemods`, or by handing the project to an AI agent. When the target environment runs, record the other side and compare:
83
+
84
+ ```bash
85
+ pymolt plan . # freeze the exact reviewed codemod plan
86
+ pymolt apply . # apply that plan; retains durable rollback data
87
+ pymolt rollback . # restore the last applied plan if needed
88
+ pymolt migrate . # end-to-end read-only preview shortcut
89
+ pymolt migrate . --patch migration.patch # export the exact unified diff
90
+ pymolt migrate . --write # requires the valid baseline above
91
+ pymolt contract capture --when post-migration --mode tests -- pytest tests/
92
+ pymolt verify . # one verdict across traces, replay, golden/canary evidence
93
+ ```
94
+
95
+ `verify` gives you three numbers that no resolver can: how much of the Axiom-impacted dependency surface your tests actually exercised, how much stayed **BLIND**, and which calls changed behaviour. Its verdict is deliberately tri-state: `PASS`, `FAIL`, or `INCONCLUSIVE`. Missing, stale, opaque, sampled, or non-comparable evidence can never become a green result.
96
+
97
+ > Prefer one command? `pymolt migrate` runs the preparation phases end-to-end. It resolves, previews codemods and shows diffs — but it cannot prove anything on its own, and it will tell you so. The contract still needs a baseline recorded *before* the first edit.
98
+
99
+ ---
100
+
101
+ ## How It Works: The Funnel Feeds The Contract
102
+
103
+ The contract brackets the migration. Everything else happens inside the brackets:
104
+
105
+ ```
106
+ contract capture ──────── the migration ───────► contract capture
107
+ (baseline) (post-migration)
108
+ │ scan → setup → assess → codemods │
109
+ │ surfaces target resolve LibCST │
110
+ │ & edges Python baseline rewrites │
111
+ │ & tool vs target │
112
+ └───────────────────────┬───────────────────────────┘
113
+ ▼
114
+ pymolt verify
115
+ confirmed · BLIND · trust % · what changed
116
+ ```
117
+
118
+ ```bash
119
+ # 0. BASELINE — record first. This is the only step you cannot do later.
120
+ pymolt contract capture --when baseline --mode tests -- pytest tests/
121
+
122
+ # 1. SCAN: monorepo surfaces, Dockerfiles, Python-version divergence — offline
123
+ pymolt scan .
124
+
125
+ # 2. SETUP: pick target Python (3.12 / 3.13) and resolver toolset (uv, pip, conda)
126
+ pymolt setup .
127
+
128
+ # 3. ASSESS: lock-first resolution of baseline vs target, CVE deltas, compile risk
129
+ pymolt assess . --target-python 3.12 --risk
130
+
131
+ # 4. PLAN/APPLY: freeze the AST result, then apply exactly what was reviewed
132
+ pymolt plan . # dry-run, hash-bound plan with unified diff
133
+ pymolt apply . # baseline-gated, durable and transactional
134
+ # `codemods .` remains a focused preview/apply shortcut for one codemod phase.
135
+
136
+ # 5. PROVE IT: record the other side and diff the two contracts
137
+ pymolt contract capture --when post-migration --mode tests -- pytest tests/
138
+ pymolt verify .
139
+ ```
140
+
141
+ Steps 1–4 are the migration. Step 0 and step 5 are the reason to trust it.
142
+
143
+ **Where is the contact map in this?** `pymolt contract map .` is the static denominator — calls, attribute reads, decorators, bases, context managers, constants and protocol operations that cross into a dependency. Axiom delta paths focus this map automatically after `apply`; full-surface totals remain visible.
144
+
145
+ ---
146
+
147
+ ## Built for AI Agents (MCP Server)
148
+
149
+ PyMolt isn't just a CLI — it's a first-class Model Context Protocol (MCP) server. If you use Cursor, Claude Desktop, Windsurf, or Google Antigravity, your agent gets the migration funnel as tools.
150
+
151
+ Give your agent the contract tools in particular. It can already resolve dependencies and read manifests on its own; what it cannot do is tell you whether the migration changed behaviour — or even count its own dependency contact surface correctly.
152
+
153
+ ### Configure in your MCP Client
154
+
155
+ Add PyMolt to your agent config (e.g. `~/.cursor/mcp.json` or `claude_desktop_config.json`):
156
+
157
+ ```json
158
+ {
159
+ "mcpServers": {
160
+ "pymolt": {
161
+ "command": "pymolt",
162
+ "args": ["mcp"]
163
+ }
164
+ }
165
+ }
166
+ ```
167
+
168
+ ### Available MCP Tools
169
+
170
+ **The ones your agent cannot do for itself** — these need LibCST scope resolution or recorded runtime traces, and no amount of file reading substitutes:
171
+
172
+ | Tool | What the agent gets |
173
+ |---|---|
174
+ | `contract_map` | Every call site into a dependency, resolved through imports and scopes. Import greps undercount this severalfold. |
175
+ | `contract_capture` | Runs *your* test or app command with a boundary tracer injected — zero edits to the project — and stores it as the `baseline` or `post-migration` slot. |
176
+ | `contract_report` | The verdict: confirmed / BLIND coverage, trust %, and exactly which dependency calls changed result, changed raise, or disappeared. |
177
+
178
+ **Preparation** — faster and more reproducible than driving the tools by hand, and they carry honesty markers (fixation, resolution quality, baseline tier) that a hand-run loses:
179
+
180
+ | Tool | What the agent gets |
181
+ |---|---|
182
+ | `status` | Where the project stands in the funnel, and the single next command. |
183
+ | `scan` | Project roots, dependency edges and Python-version divergence, without parsing Dockerfiles by hand. |
184
+ | `setup_options` / `setup_apply` | Valid target Python versions and package managers, then the pinned configuration. |
185
+ | `assess` | Baseline vs target resolution: which versions move, which conflict, what enters the manual zone — plus optional risk scoring (CVEs, C-wheel compilation, abandonment). An input to the contract, never the conclusion. |
186
+ | `codemods_preview` / `codemods` | Unified diffs of AST rewrites; `write=True` applies them. |
187
+ | `env_hint` | Dockerfile recipes and `uv` commands for building the target environment. |
188
+ | `migrate` | Runs the preparation phases end-to-end in one call. |
189
+
190
+ ---
191
+
192
+ ## Behavioral Contract Verification
193
+
194
+ Static type checkers catch signature changes. They cannot tell you that a method started returning an empty generator instead of `None`, that a call now raises `KeyError` where it used to raise nothing, or that a dependency call your code used to make simply stopped happening.
195
+
196
+ PyMolt ships a zero-dependency runtime tracer that attaches through standard library hooks (`sys.setprofile` / import wrappers) — **no code changes, no decorators, nothing added to your requirements**. It runs inside your app's interpreter, which may well be Python 3.6, and it is pure stdlib on purpose.
197
+
198
+ 1. Run your existing test suite (or the app itself) under the baseline Python to record real interaction shapes.
199
+ 2. Upgrade dependencies, apply codemods, edit code.
200
+ 3. Re-run the same command under the target Python.
201
+ 4. `pymolt verify .` diffs the two and folds every configured oracle into one verdict.
202
+
203
+ What comes back combines three coverage numbers with a tri-state verdict:
204
+
205
+ - **confirmed** — dependency calls your run actually exercised, on both sides.
206
+ - **BLIND** — calls in the static contact map that your run never touched. This is the honest measure of how much your test suite does *not* cover. A green suite with high BLIND proves very little, and PyMolt says so instead of pretending otherwise.
207
+ - **trust %** — confirmed against the static denominator from `contract map`.
208
+
209
+ Plus the behavioural verdict: which calls changed result, changed raise, or disappeared. `PASS` means no change was observed on a valid, comparable and fully covered contract surface; `FAIL` means a comparable oracle found a change; `INCONCLUSIVE` identifies the exact missing evidence.
210
+
211
+ The contract also tracks **provenance**: each capture is stamped with its environment, workload, privacy profile, sampling rate and validity. Failed tests, empty traces and malformed artifacts are retained under `contract_traces/diagnostics/`, but never replace active evidence. Re-capturing displaces a valid old recording rather than deleting it.
212
+
213
+ Live and attach captures default to `--privacy shape`, which records types and structure without scalar values. Test-suite captures default to `values` for exact local comparison. Use `--sample-rate` for high-volume observation; sampled evidence remains `INCONCLUSIVE` for disappearance claims.
214
+
215
+ For canaries, pass `--policy policy.json --metrics metrics.json`; gates cover error rate, p95/p99 latency, output-shape mismatch, dependency-call drift and dropped events. `--auto-rollback` is explicit opt-in and executes only when a mandatory gate fails. `--shadow shadow.json` classifies read/idempotent operations and suppresses unsafe or unknown writes. Comparator profiles are `--profile exact`, `shape`, or `custom --comparator module:callable`; node-level cascade output can be added with `--cascade report.json`, and golden snapshots with `--golden-before/--golden-after`.
216
+
217
+ CI exit codes are stable: `0` = passed policy, `1` = incompatibility or failed captured command, `2` = invalid invocation, `3` = environment/service failure, `4` = insufficient evidence.
218
+
219
+ ---
220
+
221
+ ## AST Codemods & Axiom Cloud Hub
222
+
223
+ Regex replacements break code; large language models frequently hallucinate non-existent API flags. PyMolt uses **LibCST (Concrete Syntax Trees)** paired with **Axiom Cloud Hub** recipes.
224
+
225
+ - **Non-destructive AST edits**: Preserves your formatting, indentation, and comments exactly as written.
226
+ - **Typed Metavariables**: Declarative match/rewrite templates (e.g., `Series_1.append(Series_2)` → `pd.concat([Series_1, Series_2])`).
227
+ - **Client Verification**: PyMolt locally re-verifies every rule before applying it to your repository.
228
+ - **Transactional apply**: every changed file is prepared and parsed before the first replacement; an interrupted or failed mixed rule/pattern batch rolls all replacements back.
229
+ - **Free Public Cloud Hub**: Recipes are fetched on demand from Axiom Cloud Hub. Custom/private on-prem instances are supported via `--endpoint <url>` or `PYMOLT_ENDPOINT`.
230
+
231
+ ---
232
+
233
+ ## Commands Summary
234
+
235
+ **Proof**
236
+
237
+ | Command | Description |
238
+ |---|---|
239
+ | `pymolt verify [dir]` | Unified persisted `PASS` / `FAIL` / `INCONCLUSIVE`; supports exact/shape/custom, golden snapshots, canary policy, safe shadow classification and opt-in rollback. |
240
+ | `pymolt contract map [dir]` | Static contact map: every call site into a dependency (the coverage denominator). |
241
+ | `pymolt contract capture --when baseline\|post-migration -- <cmd>` | Runs your command and promotes only a valid trace; failed/empty captures remain diagnostic artifacts. |
242
+ | `pymolt contract report [dir]` | `PASS` / `FAIL` / `INCONCLUSIVE`, confirmed / BLIND / trust %, and behavioral changes. |
243
+ | `pymolt contract diff OLD NEW` | Fold two recordings into a BoundaryDiff directly. |
244
+
245
+ **Preparation**
246
+
247
+ | Command | Description |
248
+ |---|---|
249
+ | `pymolt status [dir]` | Where the project stands in the funnel, and the exact next command. |
250
+ | `pymolt doctor [dir]` | Read-only preflight for environments, detected workload, evidence validity and migration receipt. |
251
+ | `pymolt scan [dir]` | Monorepo surfaces, Dockerfiles and lockfiles: version divergence and edges. |
252
+ | `pymolt setup [dir]` | Interactive setup for target Python, package manager and manifest. |
253
+ | `pymolt assess [dir]` | Baseline vs target resolution, CVE deltas, pinned target manifest. |
254
+ | `pymolt plan [dir]` | Freeze the exact hash-bound codemod result for review and later apply. |
255
+ | `pymolt apply [dir]` | Apply only the saved plan; validates hashes and retains durable rollback data. |
256
+ | `pymolt rollback [dir]` | Atomically restore the latest applied plan; protects later edits unless `--force`. |
257
+ | `pymolt codemods [dir]` | Focused exact unified preview by default; `--patch FILE` exports it and `--write` uses the durable plan path. |
258
+ | `pymolt migrate [dir]` | End-to-end exact preview; `--patch FILE` exports it, while `--write` uses the durable plan path and requires a valid baseline. |
259
+ | `pymolt env hint [dir]` | Generates a target `Dockerfile` and `uv` environment commands. |
260
+
261
+ **Plumbing**
262
+
263
+ | Command | Description |
264
+ |---|---|
265
+ | `pymolt mcp` | Starts the stdio Model Context Protocol server for AI coding agents. |
266
+ | `pymolt auth login` | Authenticates the CLI for Axiom Cloud Hub recipe access. |
267
+
268
+ ---
269
+
270
+ ## License
271
+
272
+ PyMolt is open-source software licensed under the [Apache License, Version 2.0](LICENSE).
273
+ Axiom Cloud Hub recipes are provided under the Business Source License 1.1 with free public community access.