sphinx-mkdocs-migrate 0.0.1.dev0__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 (40) hide show
  1. sphinx_mkdocs_migrate-0.0.1.dev0/.gitignore +35 -0
  2. sphinx_mkdocs_migrate-0.0.1.dev0/LICENSE +201 -0
  3. sphinx_mkdocs_migrate-0.0.1.dev0/MIGRATION_GUIDE.md +78 -0
  4. sphinx_mkdocs_migrate-0.0.1.dev0/PKG-INFO +199 -0
  5. sphinx_mkdocs_migrate-0.0.1.dev0/README.md +126 -0
  6. sphinx_mkdocs_migrate-0.0.1.dev0/pyproject.toml +145 -0
  7. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/__init__.py +8 -0
  8. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/analyzer/__init__.py +17 -0
  9. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/analyzer/ci.py +223 -0
  10. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/analyzer/dependencies.py +134 -0
  11. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/analyzer/markdown.py +148 -0
  12. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/analyzer/mkdocs.py +263 -0
  13. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/analyzer/models.py +348 -0
  14. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/analyzer/navigation.py +108 -0
  15. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/analyzer/project.py +511 -0
  16. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/cli.py +507 -0
  17. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/parsing/doc_ir.py +533 -0
  18. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/parsing/flow_extractor.py +457 -0
  19. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/parsing/html_flow_parser.py +349 -0
  20. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/parsing/markdown.py +22 -0
  21. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/parsing/markdown_ir.py +49 -0
  22. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/parsing/markdown_it_adapter.py +496 -0
  23. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/parsing/requirements.py +155 -0
  24. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/planner/accountability.py +111 -0
  25. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/planner/ci.py +142 -0
  26. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/planner/conf_builder.py +183 -0
  27. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/planner/models.py +379 -0
  28. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/planner/planner.py +1867 -0
  29. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/planner/policy.py +474 -0
  30. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/planner/theme_constants.py +70 -0
  31. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/planner/toctree.py +158 -0
  32. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/py.typed +1 -0
  33. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/rules/catalog.py +154 -0
  34. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/rules/engine.py +94 -0
  35. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/rules/models.py +176 -0
  36. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/transformer/engine.py +897 -0
  37. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/transformer/models.py +59 -0
  38. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/transformer/myst_transformer.py +393 -0
  39. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/validator/models.py +40 -0
  40. sphinx_mkdocs_migrate-0.0.1.dev0/src/sphinx_mkdocs_migrate/validator/verifier.py +377 -0
@@ -0,0 +1,35 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Distribution / packaging
7
+ dist/
8
+ build/
9
+ *.egg-info/
10
+ .eggs/
11
+
12
+ # Virtual Environments
13
+ venv/
14
+ .venv/
15
+ env/
16
+ ENV/
17
+
18
+ # Testing & Coverage
19
+ .pytest_cache/
20
+ .coverage
21
+ htmlcov/
22
+
23
+ # Temporary / Scratch Files
24
+ scratch/
25
+ .system_generated/
26
+ *.log
27
+ .env*
28
+
29
+ # IDE & OS
30
+ .DS_Store
31
+ .idea/
32
+ .vscode/
33
+ docs/_build/
34
+ research/
35
+ scratch/
@@ -0,0 +1,201 @@
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 consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the 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
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Prateek Dagar
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,78 @@
1
+ # sphinx-migrate Migration Guide
2
+
3
+ This guide explains how `sphinx-migrate` converts MkDocs and Material for MkDocs projects into modern Sphinx + MyST Parser documentation suites, and outlines the deliberate boundaries between automated transformation, source preservation, and manual developer review.
4
+
5
+ ---
6
+
7
+ ## 1. Core Concepts & Equivalences
8
+
9
+ | MkDocs / Material Concept | Sphinx + MyST Equivalent | Automation Status |
10
+ | :--- | :--- | :--- |
11
+ | `mkdocs.yml` (Configuration) | `docs/conf.py` (Sphinx config) | Automated (new) / Preserved (if existing conflict) |
12
+ | `nav:` hierarchy | `{toctree}` directives in `index.md` | Automated (deterministic, order-preserving) |
13
+ | Tabs (`pymdownx.tabbed`) | `{tab-set}` & `{tab-item}` (sphinx-design) | Automated (byte-preserving transformation) |
14
+ | Dropdowns (`pymdownx.details`) | `{dropdown}` (sphinx-design) | Automated (byte-preserving transformation) |
15
+ | Nested fences (`pymdownx.superfences`) | MyST 4+ backticks or `:::` colon_fence | Automated / Native MyST |
16
+ | Math (`pymdownx.arithmatex`) | MyST `dollarmath` extension | Automated config enablement |
17
+ | File snippets (`pymdownx.snippets`) | MyST `{include}` / `literalinclude` | Document transformation required |
18
+ | API Reference (`mkdocstrings`) | `sphinx.ext.autodoc` + `sphinx.ext.napoleon` | Static AST resolved (see Section 3) |
19
+
20
+ ---
21
+
22
+ ## 2. Theme Migration Policy
23
+
24
+ The migration engine explicitly separates theme selection from feature-level dependency derivation:
25
+ * **Material for MkDocs** maps to `sphinx_immaterial` together with its planned package and theme options. Build and validation paths must use that plan; they must not silently substitute another theme.
26
+ * **ReadTheDocs / MkDocs default** maps to `sphinx_rtd_theme`.
27
+ * **Custom Themes** route to `MANUAL` review.
28
+
29
+ Features (such as `content.code.copy`) are derived independently via the Declarative Policy Engine (e.g. `sphinx-copybutton`) if and only if explicitly present in the source config.
30
+
31
+ ---
32
+
33
+ ## 3. API Documentation & Static Symbol Resolution
34
+
35
+ Mkdocstrings directives (`::: package.module.Symbol`) are analyzed statically using Python AST inspection (zero untrusted code execution):
36
+
37
+ 1. **MODULE, CLASS, FUNCTION, METHOD, ATTRIBUTE** (`STATICALLY_RESOLVED`):
38
+ * Maps to Sphinx directive candidates:
39
+ * `MODULE` -> `automodule`
40
+ * `CLASS` -> `autoclass`
41
+ * `FUNCTION` -> `autofunction`
42
+ * `METHOD` -> `automethod`
43
+ * `ATTRIBUTE` -> `autodata`
44
+ 2. **REEXPORT, AMBIGUOUS, UNRESOLVED**:
45
+ * Routes conservatively to `MANUAL` review. Source Markdown constructs are preserved byte-for-byte without speculative mutations.
46
+
47
+ ---
48
+
49
+ ## 4. Manual Review Items
50
+
51
+ Every manual review item generated in `plan.json` and CLI output explicitly answers:
52
+ 1. **WHAT** was detected;
53
+ 2. **WHERE** it was detected;
54
+ 3. **WHY** it cannot be automated;
55
+ 4. **WHAT REMEDIATION** is required;
56
+ 5. **WHAT SOURCE** was preserved byte-for-byte.
57
+
58
+ ---
59
+
60
+ ## 5. Build Pipelines, Obsolete Scripts, & Dependency Groups
61
+
62
+ ### 5.1 Generator Script Lifecycle (`mkdocs-gen-files`)
63
+ In MkDocs projects, API reference pages and navigation structures were often generated dynamically at build time using the `gen-files` plugin and a script such as `scripts/gen_ref_nav.py`:
64
+ - **MkDocs Paradigm**: Relied on runtime generation of in-memory virtual files via `import mkdocs_gen_files` and `mkdocs_gen_files.open(...)`.
65
+ - **Sphinx Paradigm**: Sphinx natively builds from persistent filesystem documents using `sphinx.ext.autodoc` and `autosummary`. The migration planner analyzes generator scripts via AST and directly synthesizes deterministic, checked-in MyST markdown files in `docs/reference/`.
66
+ - **Post-Migration Cleanup**: Because `mkdocs-gen-files` is removed from project dependencies during migration, generator scripts importing it become broken dead code. The migration engine automatically deletes obsolete generator scripts declared in `mkdocs.yml` (and their enclosing directory if left empty) during `--apply`.
67
+ - **Single-Stage Build**: In `tox.ini` and CI workflows, the build command requires only the single standard command:
68
+ ```ini
69
+ commands =
70
+ sphinx-build -b html docs site/_build/html
71
+ ```
72
+ No preceding `python scripts/...` execution step is needed or valid.
73
+
74
+ ### 5.2 Dynamic Dependency Group & Extras Resolution
75
+ When configuring `[testenv:docs]` in `tox.ini`, the migration engine detects where documentation packages reside in the source project:
76
+ - **PEP 735 (`[dependency-groups]`)**: If dependencies were in a group (e.g. `docs`, `dev`, `documentation`), tox is configured with `dependency_groups = <group_name>`.
77
+ - **PEP 621 (`[project.optional-dependencies]`)**: If dependencies were declared as package extras (e.g. `[project.optional-dependencies] docs`), tox is configured with `extras = <extra_name>`.
78
+ - **Pip Requirements**: If dependencies are tracked via `docs/requirements.txt` or `requirements.txt`, tox is configured with `deps = -r <file_path>`.
@@ -0,0 +1,199 @@
1
+ Metadata-Version: 2.5
2
+ Name: sphinx-mkdocs-migrate
3
+ Version: 0.0.1.dev0
4
+ Summary: Deterministic, evidence-driven analyzer and migration engine from MkDocs to Sphinx + MyST
5
+ Project-URL: Homepage, https://github.com/prateek-dagar/sphinx-mkdocs-migrate
6
+ Project-URL: Documentation, https://github.com/prateek-dagar/sphinx-mkdocs-migrate#readme
7
+ Project-URL: Repository, https://github.com/prateek-dagar/sphinx-mkdocs-migrate.git
8
+ Project-URL: Issues, https://github.com/prateek-dagar/sphinx-mkdocs-migrate/issues
9
+ Project-URL: Changelog, https://github.com/prateek-dagar/sphinx-mkdocs-migrate/blob/main/CHANGELOG.md
10
+ Author-email: Prateek Dagar <prateek0508dagar@gmail.com>
11
+ License-Expression: Apache-2.0
12
+ License-File: LICENSE
13
+ Keywords: autodoc,docs-migration,documentation-converter,material-for-mkdocs,migrate-mkdocs-to-sphinx,migration,mkdocs,mkdocs-to-sphinx,myst-parser,sphinx,sphinx-design,sphinx-to-mkdocs
14
+ Classifier: Development Status :: 2 - Pre-Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Programming Language :: Python :: 3.15
24
+ Classifier: Programming Language :: Python :: Implementation :: CPython
25
+ Classifier: Topic :: Documentation
26
+ Classifier: Topic :: Software Development :: Documentation
27
+ Requires-Python: >=3.10
28
+ Requires-Dist: beautifulsoup4>=4.12.0
29
+ Requires-Dist: click>=8.1
30
+ Requires-Dist: markdown-it-py>=3.0.0
31
+ Requires-Dist: mdit-py-plugins>=0.4.0
32
+ Requires-Dist: myst-parser>=2.0.0
33
+ Requires-Dist: pydantic>=2.0
34
+ Requires-Dist: pyyaml>=6.0
35
+ Requires-Dist: rich>=13.0
36
+ Requires-Dist: sphinx>=7.0.0
37
+ Requires-Dist: tomli>=2.0.0; python_version < '3.11'
38
+ Provides-Extra: dev
39
+ Requires-Dist: build>=1.0.0; extra == 'dev'
40
+ Requires-Dist: furo>=2024.1.0; extra == 'dev'
41
+ Requires-Dist: mypy>=1.10.0; extra == 'dev'
42
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
43
+ Requires-Dist: pytest>=7.0; extra == 'dev'
44
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
45
+ Requires-Dist: sphinx-copybutton>=0.5.2; extra == 'dev'
46
+ Requires-Dist: sphinx-design>=0.5.0; extra == 'dev'
47
+ Requires-Dist: sphinx-immaterial>=0.11.0; extra == 'dev'
48
+ Requires-Dist: sphinx-rtd-theme>=2.0.0; extra == 'dev'
49
+ Requires-Dist: sphinxcontrib-mermaid>=0.9.0; extra == 'dev'
50
+ Requires-Dist: twine>=4.0.0; extra == 'dev'
51
+ Provides-Extra: docs
52
+ Requires-Dist: furo>=2024.1.0; extra == 'docs'
53
+ Requires-Dist: myst-parser>=2.0.0; extra == 'docs'
54
+ Requires-Dist: sphinx-copybutton>=0.5.2; extra == 'docs'
55
+ Requires-Dist: sphinx-design>=0.5.0; extra == 'docs'
56
+ Requires-Dist: sphinx>=7.0.0; extra == 'docs'
57
+ Provides-Extra: research
58
+ Requires-Dist: beautifulsoup4>=4.12.0; extra == 'research'
59
+ Requires-Dist: mkdocs-literate-nav>=0.6.0; extra == 'research'
60
+ Requires-Dist: mkdocs-material>=9.5.0; extra == 'research'
61
+ Requires-Dist: mkdocs>=1.5.0; extra == 'research'
62
+ Requires-Dist: mkdocstrings[python]>=0.24.0; extra == 'research'
63
+ Provides-Extra: test
64
+ Requires-Dist: furo>=2024.1.0; extra == 'test'
65
+ Requires-Dist: pytest-cov>=4.0; extra == 'test'
66
+ Requires-Dist: pytest>=7.0; extra == 'test'
67
+ Requires-Dist: sphinx-copybutton>=0.5.2; extra == 'test'
68
+ Requires-Dist: sphinx-design>=0.5.0; extra == 'test'
69
+ Requires-Dist: sphinx-immaterial>=0.11.0; extra == 'test'
70
+ Requires-Dist: sphinx-rtd-theme>=2.0.0; extra == 'test'
71
+ Requires-Dist: sphinxcontrib-mermaid>=0.9.0; extra == 'test'
72
+ Description-Content-Type: text/markdown
73
+
74
+ # sphinx_mkdocs_migrate
75
+
76
+ [![PyPI version](https://img.shields.io/badge/pypi-0.0.1.dev0-blue.svg)](https://pypi.org/project/sphinx-mkdocs-migrate/)
77
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
78
+
79
+ **`sphinx-mkdocs-migrate`** (`sphinx-migrate`) is a deterministic, evidence-driven analyzer and migration engine that safely converts MkDocs and Material for MkDocs documentation projects to Sphinx + MyST Parser.
80
+
81
+ ---
82
+
83
+ ## Key Principles & Design Boundaries
84
+
85
+ ### What `sphinx-migrate` Does
86
+ * **Evidence-Driven Subsystem Analysis**: Inspects `mkdocs.yml`, directory structures, theme features, Markdown extensions, and plugins.
87
+ * **Deterministic, Read-Only Planning**: Generates a canonical `MigrationPlan` with stable hashes and provenance tracking for every extension and package.
88
+ * **Byte-Preserving Transformation**: Transforms only specific non-standard syntax spans (e.g. tabs, dropdowns, includes) into native MyST/Sphinx directives while guaranteeing byte-for-byte identity on untouched Markdown.
89
+ * **AST-Guided API Migration**: Resolves Python symbols statically (`ast.parse`) without executing untrusted repository code. Conservative manual boundary for re-exports and ambiguities.
90
+ * **Dual Validation Engine**: Performs structural Markdown AST validation and real isolated Sphinx HTML builds in an isolated sandbox.
91
+
92
+ ### What `sphinx-migrate` Does NOT Do
93
+ * **No Speculative Heuristics**: If a syntax construct or custom plugin cannot be deterministically mapped, it is routed to `MANUAL` or `UNSUPPORTED` rather than guessed.
94
+ * **No Source Code Mutation**: Does not rewrite Python `.py` source code or docstrings.
95
+ * **Source-Faithful Theme Mapping**: Material for MkDocs maps to `sphinx_immaterial`; the planned target theme and its package are preserved in generated `conf.py` rather than being silently replaced during validation.
96
+ * **Build Success != Runtime Equivalence**: A successful Sphinx build proves structural and buildability correctness; it does not guarantee visual or JavaScript runtime identity with MkDocs Material.
97
+
98
+ ---
99
+
100
+ ## Installation
101
+
102
+ ```bash
103
+ pip install sphinx-mkdocs-migrate
104
+ ```
105
+
106
+ ---
107
+
108
+ ## CLI Workflow
109
+
110
+ The migration lifecycle consists of 4 distinct commands:
111
+
112
+ ```text
113
+ sphinx-migrate analyze # 1. Factual project & subsystem inspection
114
+ ↑
115
+ sphinx-migrate plan # 2. Deterministic, read-only MigrationPlan generation
116
+ ⊑
117
+ sphinx-migrate migrate # 3. Dry-run diffing or atomic disk transformation
118
+ ⊑
119
+ sphinx-migrate validate # 4. AST validation & isolated sandbox Sphinx build
120
+ ```
121
+
122
+ ### 1. Project Inspection (`analyze`)
123
+ ```bash
124
+ sphinx-migrate analyze path/to/project
125
+ # Machine-readable JSON output:
126
+ sphinx-migrate analyze path/to/project --json-output
127
+ ```
128
+
129
+ ### 2. Migration Planning(`plan`)
130
+ ```bash
131
+ # Human-readable summary with Rich tables:
132
+ sphinx-migrate plan path/to/project
133
+
134
+ # Export canonical plan JSON:
135
+ sphinx-migrate plan path/to/project --output-json plan.json
136
+ ```
137
+
138
+ ### 3. Transformation & Scaffolding (`migrate`)
139
+ ```bash
140
+ # Dry-run with unified diff preview (no disk mutations):
141
+ sphinx-migrate migrate path/to/project --diff
142
+
143
+ # Apply changes to disk and scaffold conf.py:
144
+ sphinx-migrate migrate path/to/project --apply
145
+
146
+ # Overwrite conflicting existing conf.py:
147
+ sphinx-migrate migrate path/to/project --apply --force-conf
148
+ ```
149
+
150
+ ### 4. Build Validation(`validate`)
151
+ ```bash
152
+ # Full isolated sandbox Sphinx build:
153
+ sphinx-migrate validate path/to/project --build
154
+
155
+ # Strict mode (fail on any Sphinx warnings):
156
+ sphinx-migrate validate path/to/project --build --strict
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Supported Feature Policies
162
+
163
+ | Source Feature | Category | Action | Target / Resolution | Provenance |
164
+ | :--- | :--- | :--- | :--- | :--- |
165
+ | `content.code.copy` | `THEME_FEATURE` | `ENABLE_EXTENSION` | `sphinx_copybutton` / `sphinx-copybutton>=0.5.2` | `FEATURE_POLICY` |
166
+ | `content.tabs.link` | `THEME_FEATURE` | `ENABLE_EXTENSION` | `sphinx_design` / `sphinx-design>=0.5.0` | `FEATURE_POLICY` |
167
+ | `pymdownx.tabbed` | `MARKDOWN_EXTENSION` | `TRANSFORM` | `sphinx-design` (`{tab-set}`, `{tab-item}`) | `EXTENSION_POLICY` |
168
+ | `pymdownx.details` | `MARKDOWN_EXTENSION` | `TRANSFORM` | `sphinx-design` (`{dropdown}`) | `EXTENSION_POLICY` |
169
+ | `pymdownx.superfences` | `MARKDOWN_EXTENSION` | `PRESERVE` | MyST `colon_fence` | `EXTENSION_POLICY` |
170
+ | `pymdownx.arithmatex` | `MARKDOWN_EXTENSION` | `PRESERVE` | MyST `dollarmath` | `EXTENSION_POLICY` |
171
+ | `pymdownx.snippets` | `MARKDOWN_EXTENSION` | `TRANSFORM` | MyST `{include}` / `literalinclude` | `EXTENSION_POLICY` |
172
+ | `pymdownx.emoji` | `MARKDOWN_EXTENSION` | `MANUAL` | Manual review of icon shortcodes (`:smile:`) | `MANUAL` |
173
+ | `mkdocstrings` | `PLUGIN` | `TRANSFORM` | `sphinx.ext.autodoc` + `sphinx.ext.napoleon` | `EXTENSION_POLICY` |
174
+ | `search.share` | `THEME_FEATURE` | `UNSUPPORTED` | No static Sphinx HTML equivalent | `UNSUPPORTED` |
175
+
176
+ ---
177
+
178
+ ## Roadmap & Future Evolution
179
+
180
+ While `sphinx-mkdocs-migrate` is currently focused on high-fidelity migration from **MkDocs to Sphinx + MyST**, our planned roadmap includes full bi-directional support:
181
+
182
+ * **Phase 1 (Current)**: Full-fidelity MkDocs & Material for MkDocs ➔ Sphinx + MyST migration with 100% AST byte preservation.
183
+ * **Phase 2 (Bi-Directional)**: Reverse migration (Sphinx + MyST ➔ MkDocs + Material).
184
+
185
+ See our full [**Roadmap Document**](docs/roadmap.md) for details.
186
+
187
+ ---
188
+
189
+ ## Contributors
190
+
191
+ Thank you to everyone who has contributed to `sphinx-mkdocs-migrate`!
192
+
193
+ Please see our [**Contributors List**](docs/contributors.md) for the full list of contributors.
194
+
195
+ ---
196
+
197
+ ## License
198
+
199
+ Licensed under the [Apache License, Version 2.0](LICENSE).
@@ -0,0 +1,126 @@
1
+ # sphinx_mkdocs_migrate
2
+
3
+ [![PyPI version](https://img.shields.io/badge/pypi-0.0.1.dev0-blue.svg)](https://pypi.org/project/sphinx-mkdocs-migrate/)
4
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
5
+
6
+ **`sphinx-mkdocs-migrate`** (`sphinx-migrate`) is a deterministic, evidence-driven analyzer and migration engine that safely converts MkDocs and Material for MkDocs documentation projects to Sphinx + MyST Parser.
7
+
8
+ ---
9
+
10
+ ## Key Principles & Design Boundaries
11
+
12
+ ### What `sphinx-migrate` Does
13
+ * **Evidence-Driven Subsystem Analysis**: Inspects `mkdocs.yml`, directory structures, theme features, Markdown extensions, and plugins.
14
+ * **Deterministic, Read-Only Planning**: Generates a canonical `MigrationPlan` with stable hashes and provenance tracking for every extension and package.
15
+ * **Byte-Preserving Transformation**: Transforms only specific non-standard syntax spans (e.g. tabs, dropdowns, includes) into native MyST/Sphinx directives while guaranteeing byte-for-byte identity on untouched Markdown.
16
+ * **AST-Guided API Migration**: Resolves Python symbols statically (`ast.parse`) without executing untrusted repository code. Conservative manual boundary for re-exports and ambiguities.
17
+ * **Dual Validation Engine**: Performs structural Markdown AST validation and real isolated Sphinx HTML builds in an isolated sandbox.
18
+
19
+ ### What `sphinx-migrate` Does NOT Do
20
+ * **No Speculative Heuristics**: If a syntax construct or custom plugin cannot be deterministically mapped, it is routed to `MANUAL` or `UNSUPPORTED` rather than guessed.
21
+ * **No Source Code Mutation**: Does not rewrite Python `.py` source code or docstrings.
22
+ * **Source-Faithful Theme Mapping**: Material for MkDocs maps to `sphinx_immaterial`; the planned target theme and its package are preserved in generated `conf.py` rather than being silently replaced during validation.
23
+ * **Build Success != Runtime Equivalence**: A successful Sphinx build proves structural and buildability correctness; it does not guarantee visual or JavaScript runtime identity with MkDocs Material.
24
+
25
+ ---
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ pip install sphinx-mkdocs-migrate
31
+ ```
32
+
33
+ ---
34
+
35
+ ## CLI Workflow
36
+
37
+ The migration lifecycle consists of 4 distinct commands:
38
+
39
+ ```text
40
+ sphinx-migrate analyze # 1. Factual project & subsystem inspection
41
+ ↑
42
+ sphinx-migrate plan # 2. Deterministic, read-only MigrationPlan generation
43
+ ⊑
44
+ sphinx-migrate migrate # 3. Dry-run diffing or atomic disk transformation
45
+ ⊑
46
+ sphinx-migrate validate # 4. AST validation & isolated sandbox Sphinx build
47
+ ```
48
+
49
+ ### 1. Project Inspection (`analyze`)
50
+ ```bash
51
+ sphinx-migrate analyze path/to/project
52
+ # Machine-readable JSON output:
53
+ sphinx-migrate analyze path/to/project --json-output
54
+ ```
55
+
56
+ ### 2. Migration Planning(`plan`)
57
+ ```bash
58
+ # Human-readable summary with Rich tables:
59
+ sphinx-migrate plan path/to/project
60
+
61
+ # Export canonical plan JSON:
62
+ sphinx-migrate plan path/to/project --output-json plan.json
63
+ ```
64
+
65
+ ### 3. Transformation & Scaffolding (`migrate`)
66
+ ```bash
67
+ # Dry-run with unified diff preview (no disk mutations):
68
+ sphinx-migrate migrate path/to/project --diff
69
+
70
+ # Apply changes to disk and scaffold conf.py:
71
+ sphinx-migrate migrate path/to/project --apply
72
+
73
+ # Overwrite conflicting existing conf.py:
74
+ sphinx-migrate migrate path/to/project --apply --force-conf
75
+ ```
76
+
77
+ ### 4. Build Validation(`validate`)
78
+ ```bash
79
+ # Full isolated sandbox Sphinx build:
80
+ sphinx-migrate validate path/to/project --build
81
+
82
+ # Strict mode (fail on any Sphinx warnings):
83
+ sphinx-migrate validate path/to/project --build --strict
84
+ ```
85
+
86
+ ---
87
+
88
+ ## Supported Feature Policies
89
+
90
+ | Source Feature | Category | Action | Target / Resolution | Provenance |
91
+ | :--- | :--- | :--- | :--- | :--- |
92
+ | `content.code.copy` | `THEME_FEATURE` | `ENABLE_EXTENSION` | `sphinx_copybutton` / `sphinx-copybutton>=0.5.2` | `FEATURE_POLICY` |
93
+ | `content.tabs.link` | `THEME_FEATURE` | `ENABLE_EXTENSION` | `sphinx_design` / `sphinx-design>=0.5.0` | `FEATURE_POLICY` |
94
+ | `pymdownx.tabbed` | `MARKDOWN_EXTENSION` | `TRANSFORM` | `sphinx-design` (`{tab-set}`, `{tab-item}`) | `EXTENSION_POLICY` |
95
+ | `pymdownx.details` | `MARKDOWN_EXTENSION` | `TRANSFORM` | `sphinx-design` (`{dropdown}`) | `EXTENSION_POLICY` |
96
+ | `pymdownx.superfences` | `MARKDOWN_EXTENSION` | `PRESERVE` | MyST `colon_fence` | `EXTENSION_POLICY` |
97
+ | `pymdownx.arithmatex` | `MARKDOWN_EXTENSION` | `PRESERVE` | MyST `dollarmath` | `EXTENSION_POLICY` |
98
+ | `pymdownx.snippets` | `MARKDOWN_EXTENSION` | `TRANSFORM` | MyST `{include}` / `literalinclude` | `EXTENSION_POLICY` |
99
+ | `pymdownx.emoji` | `MARKDOWN_EXTENSION` | `MANUAL` | Manual review of icon shortcodes (`:smile:`) | `MANUAL` |
100
+ | `mkdocstrings` | `PLUGIN` | `TRANSFORM` | `sphinx.ext.autodoc` + `sphinx.ext.napoleon` | `EXTENSION_POLICY` |
101
+ | `search.share` | `THEME_FEATURE` | `UNSUPPORTED` | No static Sphinx HTML equivalent | `UNSUPPORTED` |
102
+
103
+ ---
104
+
105
+ ## Roadmap & Future Evolution
106
+
107
+ While `sphinx-mkdocs-migrate` is currently focused on high-fidelity migration from **MkDocs to Sphinx + MyST**, our planned roadmap includes full bi-directional support:
108
+
109
+ * **Phase 1 (Current)**: Full-fidelity MkDocs & Material for MkDocs ➔ Sphinx + MyST migration with 100% AST byte preservation.
110
+ * **Phase 2 (Bi-Directional)**: Reverse migration (Sphinx + MyST ➔ MkDocs + Material).
111
+
112
+ See our full [**Roadmap Document**](docs/roadmap.md) for details.
113
+
114
+ ---
115
+
116
+ ## Contributors
117
+
118
+ Thank you to everyone who has contributed to `sphinx-mkdocs-migrate`!
119
+
120
+ Please see our [**Contributors List**](docs/contributors.md) for the full list of contributors.
121
+
122
+ ---
123
+
124
+ ## License
125
+
126
+ Licensed under the [Apache License, Version 2.0](LICENSE).