vexy-mkdocs-tools 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.
- vexy_mkdocs_tools-0.1.0/.gitignore +222 -0
- vexy_mkdocs_tools-0.1.0/CHANGELOG.md +20 -0
- vexy_mkdocs_tools-0.1.0/LICENSE +201 -0
- vexy_mkdocs_tools-0.1.0/PKG-INFO +110 -0
- vexy_mkdocs_tools-0.1.0/README.md +69 -0
- vexy_mkdocs_tools-0.1.0/pyproject.toml +90 -0
- vexy_mkdocs_tools-0.1.0/src/vexy_mkdocs_tools/__init__.py +11 -0
- vexy_mkdocs_tools-0.1.0/src/vexy_mkdocs_tools/__main__.py +7 -0
- vexy_mkdocs_tools-0.1.0/src/vexy_mkdocs_tools/__version__.py +24 -0
- vexy_mkdocs_tools-0.1.0/src/vexy_mkdocs_tools/cli.py +213 -0
- vexy_mkdocs_tools-0.1.0/tests/test_cli.py +52 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
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
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
# Temporary file for partial code execution
|
|
204
|
+
tempCodeRunnerFile.py
|
|
205
|
+
|
|
206
|
+
# Ruff stuff:
|
|
207
|
+
.ruff_cache/
|
|
208
|
+
|
|
209
|
+
# PyPI configuration file
|
|
210
|
+
.pypirc
|
|
211
|
+
|
|
212
|
+
# Marimo
|
|
213
|
+
marimo/_static/
|
|
214
|
+
marimo/_lsp/
|
|
215
|
+
__marimo__/
|
|
216
|
+
|
|
217
|
+
# Streamlit
|
|
218
|
+
.streamlit/secrets.toml
|
|
219
|
+
|
|
220
|
+
# hatch-vcs generated
|
|
221
|
+
src/vexy_mkdocs_tools/__version__.py
|
|
222
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.1.0]
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- First PyPI release as `vexy-mkdocs-tools`.
|
|
7
|
+
- `build.sh` runs `uvx hatch clean` before building; `publish.sh` runs `gitnextver .`.
|
|
8
|
+
|
|
9
|
+
## [Unreleased]
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Initial scaffolding: `pyproject.toml` with hatchling + hatch-vcs, `requires-python = ">=3.12"`.
|
|
13
|
+
- `src/vexy_mkdocs_tools/cli.py` — Fire CLI with `build`, `serve`, `clean`, `format`, `version`.
|
|
14
|
+
- Console-script entry points `vexy-mkdocs-tools` and `vmt`.
|
|
15
|
+
- Bundled dependencies: ProperDocs 1.6.7+, MaterialX 10.1.4+, `pymdown-extensions`, `mkdocs-awesome-nav`, `mkdocs-include-markdown-plugin`, `mkdocs-llmstxt`, `mkdocs-copy-to-llm`, `mkdocs-rss-plugin`.
|
|
16
|
+
- Optional `[flowmark]` extra for in-place Markdown formatting.
|
|
17
|
+
- `tests/test_cli.py` — pytest smoke tests for `_clean_docs` (CNAME preservation) and `_find_repo_root` (walk-up + missing-root error).
|
|
18
|
+
- `build.sh`, `publish.sh` — local build/publish wrappers.
|
|
19
|
+
- GitHub Actions: `ci.yml` (test on push/PR), `release.yml` (publish to PyPI on `v*.*.*` tag).
|
|
20
|
+
- README with usage, layout convention, and dev workflow.
|
|
@@ -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 [yyyy] [name of copyright owner]
|
|
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,110 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vexy-mkdocs-tools
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Fire-based CLI that bundles ProperDocs + MaterialX + the vexy mkdocs plugin set, for one-shot site builds via `uvx vexy-mkdocs-tools build`.
|
|
5
|
+
Project-URL: Homepage, https://github.com/vexyart/vexy-mkdocs-tools
|
|
6
|
+
Project-URL: Repository, https://github.com/vexyart/vexy-mkdocs-tools
|
|
7
|
+
Project-URL: Issues, https://github.com/vexyart/vexy-mkdocs-tools/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/vexyart/vexy-mkdocs-tools/blob/main/CHANGELOG.md
|
|
9
|
+
Author-email: Adam Twardoch <adam+github@twardoch.com>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: cli,materialx,mkdocs,properdocs,static-site
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Framework :: MkDocs
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Documentation
|
|
22
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
23
|
+
Requires-Python: >=3.12
|
|
24
|
+
Requires-Dist: fire>=0.7
|
|
25
|
+
Requires-Dist: loguru>=0.7
|
|
26
|
+
Requires-Dist: mkdocs-awesome-nav>=3.3
|
|
27
|
+
Requires-Dist: mkdocs-copy-to-llm>=0.2
|
|
28
|
+
Requires-Dist: mkdocs-include-markdown-plugin>=7.2
|
|
29
|
+
Requires-Dist: mkdocs-llmstxt>=0.2
|
|
30
|
+
Requires-Dist: mkdocs-materialx>=10.1.4
|
|
31
|
+
Requires-Dist: mkdocs-rss-plugin>=1.17
|
|
32
|
+
Requires-Dist: properdocs>=1.6.7
|
|
33
|
+
Requires-Dist: pymdown-extensions>=10.2
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: pytest-cov>=4.1; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
38
|
+
Provides-Extra: flowmark
|
|
39
|
+
Requires-Dist: flowmark>=0.6.5; extra == 'flowmark'
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
|
|
42
|
+
# vexy-mkdocs-tools
|
|
43
|
+
|
|
44
|
+
Fire-based CLI that bundles [ProperDocs](https://github.com/jaywhj/properdocs) + [MaterialX](https://github.com/jaywhj/mkdocs-materialx) and the standard `vexy-` plugin set, so a site builds in one shot:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
uvx vexy-mkdocs-tools build
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Why
|
|
51
|
+
|
|
52
|
+
Every FontLab/Vexy MkDocs-style site repeats the same dependency list and the same wrapper script (clean `docs/` but keep `CNAME`, optionally Flowmark-format `src_docs/md/` first, then `properdocs build`, then write `.nojekyll`). This package owns the dependency set and the wrapper, so site repos shrink to "Markdown + `mkdocs.yml`".
|
|
53
|
+
|
|
54
|
+
## Install
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
uv pip install vexy-mkdocs-tools # site builds
|
|
58
|
+
uv pip install "vexy-mkdocs-tools[flowmark]" # also Flowmark formatting
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or ad-hoc without installing:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
uvx vexy-mkdocs-tools build
|
|
65
|
+
uvx --with flowmark vexy-mkdocs-tools build
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Commands
|
|
69
|
+
|
|
70
|
+
| Command | What it does |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `vmt build` | Flowmark-format `src_docs/md/` (if available) → wipe `docs/` (preserving `CNAME`) → `properdocs build` → write `.nojekyll` |
|
|
73
|
+
| `vmt build --no-format` | Skip the Flowmark step |
|
|
74
|
+
| `vmt serve` | `properdocs serve` with the same config |
|
|
75
|
+
| `vmt clean` | Wipe `docs/` (preserving `CNAME`) without rebuilding |
|
|
76
|
+
| `vmt format` | Run Flowmark in place over `src_docs/md/` |
|
|
77
|
+
| `vmt version` | Print installed version |
|
|
78
|
+
|
|
79
|
+
`vexy-mkdocs-tools` and `vmt` are aliases.
|
|
80
|
+
|
|
81
|
+
## Site layout assumed
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
<repo>/
|
|
85
|
+
├── mkdocs/mkdocs.yml # config (--config to override)
|
|
86
|
+
├── src_docs/md/ # Markdown source (--src to override)
|
|
87
|
+
└── docs/ # build output (--docs to override)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The CLI walks up from `cwd` until it finds a directory containing both `mkdocs/mkdocs.yml` and `src_docs/`. Pass `--root` to skip the walk.
|
|
91
|
+
|
|
92
|
+
## Bundled dependencies
|
|
93
|
+
|
|
94
|
+
ProperDocs 1.6.7+, MaterialX 10.1.4+, plus `pymdown-extensions`, `mkdocs-awesome-nav`, `mkdocs-include-markdown-plugin`, `mkdocs-llmstxt`, `mkdocs-copy-to-llm`, `mkdocs-rss-plugin`. The `[flowmark]` extra adds `flowmark`.
|
|
95
|
+
|
|
96
|
+
## Develop
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
uv sync --extra dev
|
|
100
|
+
uv run python -m pytest -q
|
|
101
|
+
uvx ruff check src tests
|
|
102
|
+
./build.sh # full build + test + wheel/sdist
|
|
103
|
+
./publish.sh # upload to PyPI (needs UV_PUBLISH_TOKEN)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Releases are tag-driven — push a `vX.Y.Z` tag and the `release` workflow ships to PyPI.
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
Apache-2.0.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# vexy-mkdocs-tools
|
|
2
|
+
|
|
3
|
+
Fire-based CLI that bundles [ProperDocs](https://github.com/jaywhj/properdocs) + [MaterialX](https://github.com/jaywhj/mkdocs-materialx) and the standard `vexy-` plugin set, so a site builds in one shot:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
uvx vexy-mkdocs-tools build
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Why
|
|
10
|
+
|
|
11
|
+
Every FontLab/Vexy MkDocs-style site repeats the same dependency list and the same wrapper script (clean `docs/` but keep `CNAME`, optionally Flowmark-format `src_docs/md/` first, then `properdocs build`, then write `.nojekyll`). This package owns the dependency set and the wrapper, so site repos shrink to "Markdown + `mkdocs.yml`".
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
uv pip install vexy-mkdocs-tools # site builds
|
|
17
|
+
uv pip install "vexy-mkdocs-tools[flowmark]" # also Flowmark formatting
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or ad-hoc without installing:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
uvx vexy-mkdocs-tools build
|
|
24
|
+
uvx --with flowmark vexy-mkdocs-tools build
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Commands
|
|
28
|
+
|
|
29
|
+
| Command | What it does |
|
|
30
|
+
|---|---|
|
|
31
|
+
| `vmt build` | Flowmark-format `src_docs/md/` (if available) → wipe `docs/` (preserving `CNAME`) → `properdocs build` → write `.nojekyll` |
|
|
32
|
+
| `vmt build --no-format` | Skip the Flowmark step |
|
|
33
|
+
| `vmt serve` | `properdocs serve` with the same config |
|
|
34
|
+
| `vmt clean` | Wipe `docs/` (preserving `CNAME`) without rebuilding |
|
|
35
|
+
| `vmt format` | Run Flowmark in place over `src_docs/md/` |
|
|
36
|
+
| `vmt version` | Print installed version |
|
|
37
|
+
|
|
38
|
+
`vexy-mkdocs-tools` and `vmt` are aliases.
|
|
39
|
+
|
|
40
|
+
## Site layout assumed
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
<repo>/
|
|
44
|
+
├── mkdocs/mkdocs.yml # config (--config to override)
|
|
45
|
+
├── src_docs/md/ # Markdown source (--src to override)
|
|
46
|
+
└── docs/ # build output (--docs to override)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The CLI walks up from `cwd` until it finds a directory containing both `mkdocs/mkdocs.yml` and `src_docs/`. Pass `--root` to skip the walk.
|
|
50
|
+
|
|
51
|
+
## Bundled dependencies
|
|
52
|
+
|
|
53
|
+
ProperDocs 1.6.7+, MaterialX 10.1.4+, plus `pymdown-extensions`, `mkdocs-awesome-nav`, `mkdocs-include-markdown-plugin`, `mkdocs-llmstxt`, `mkdocs-copy-to-llm`, `mkdocs-rss-plugin`. The `[flowmark]` extra adds `flowmark`.
|
|
54
|
+
|
|
55
|
+
## Develop
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
uv sync --extra dev
|
|
59
|
+
uv run python -m pytest -q
|
|
60
|
+
uvx ruff check src tests
|
|
61
|
+
./build.sh # full build + test + wheel/sdist
|
|
62
|
+
./publish.sh # upload to PyPI (needs UV_PUBLISH_TOKEN)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Releases are tag-driven — push a `vX.Y.Z` tag and the `release` workflow ships to PyPI.
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
Apache-2.0.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# this_file: pyproject.toml
|
|
2
|
+
|
|
3
|
+
[build-system]
|
|
4
|
+
requires = ["hatchling", "hatch-vcs"]
|
|
5
|
+
build-backend = "hatchling.build"
|
|
6
|
+
|
|
7
|
+
[project]
|
|
8
|
+
name = "vexy-mkdocs-tools"
|
|
9
|
+
dynamic = ["version"]
|
|
10
|
+
description = "Fire-based CLI that bundles ProperDocs + MaterialX + the vexy mkdocs plugin set, for one-shot site builds via `uvx vexy-mkdocs-tools build`."
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
requires-python = ">=3.12"
|
|
13
|
+
license = "Apache-2.0"
|
|
14
|
+
authors = [
|
|
15
|
+
{ name = "Adam Twardoch", email = "adam+github@twardoch.com" },
|
|
16
|
+
]
|
|
17
|
+
keywords = ["mkdocs", "properdocs", "materialx", "static-site", "cli"]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 4 - Beta",
|
|
20
|
+
"Environment :: Console",
|
|
21
|
+
"Framework :: MkDocs",
|
|
22
|
+
"Intended Audience :: Developers",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Topic :: Documentation",
|
|
28
|
+
"Topic :: Software Development :: Documentation",
|
|
29
|
+
]
|
|
30
|
+
dependencies = [
|
|
31
|
+
"fire>=0.7",
|
|
32
|
+
"loguru>=0.7",
|
|
33
|
+
"properdocs>=1.6.7",
|
|
34
|
+
"mkdocs-materialx>=10.1.4",
|
|
35
|
+
"pymdown-extensions>=10.2",
|
|
36
|
+
"mkdocs-awesome-nav>=3.3",
|
|
37
|
+
"mkdocs-include-markdown-plugin>=7.2",
|
|
38
|
+
"mkdocs-llmstxt>=0.2",
|
|
39
|
+
"mkdocs-copy-to-llm>=0.2",
|
|
40
|
+
"mkdocs-rss-plugin>=1.17",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[project.optional-dependencies]
|
|
44
|
+
flowmark = [
|
|
45
|
+
"flowmark>=0.6.5",
|
|
46
|
+
]
|
|
47
|
+
dev = [
|
|
48
|
+
"pytest>=8.0",
|
|
49
|
+
"pytest-cov>=4.1",
|
|
50
|
+
"ruff>=0.6",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[project.urls]
|
|
54
|
+
Homepage = "https://github.com/vexyart/vexy-mkdocs-tools"
|
|
55
|
+
Repository = "https://github.com/vexyart/vexy-mkdocs-tools"
|
|
56
|
+
Issues = "https://github.com/vexyart/vexy-mkdocs-tools/issues"
|
|
57
|
+
Changelog = "https://github.com/vexyart/vexy-mkdocs-tools/blob/main/CHANGELOG.md"
|
|
58
|
+
|
|
59
|
+
[project.scripts]
|
|
60
|
+
vexy-mkdocs-tools = "vexy_mkdocs_tools.cli:main"
|
|
61
|
+
vmt = "vexy_mkdocs_tools.cli:main"
|
|
62
|
+
|
|
63
|
+
[tool.hatch.version]
|
|
64
|
+
source = "vcs"
|
|
65
|
+
|
|
66
|
+
[tool.hatch.build.hooks.vcs]
|
|
67
|
+
version-file = "src/vexy_mkdocs_tools/__version__.py"
|
|
68
|
+
|
|
69
|
+
[tool.hatch.build.targets.wheel]
|
|
70
|
+
packages = ["src/vexy_mkdocs_tools"]
|
|
71
|
+
|
|
72
|
+
[tool.hatch.build.targets.sdist]
|
|
73
|
+
include = [
|
|
74
|
+
"/src",
|
|
75
|
+
"/tests",
|
|
76
|
+
"/README.md",
|
|
77
|
+
"/CHANGELOG.md",
|
|
78
|
+
"/LICENSE",
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
[tool.pytest.ini_options]
|
|
82
|
+
testpaths = ["tests"]
|
|
83
|
+
|
|
84
|
+
[tool.ruff]
|
|
85
|
+
line-length = 100
|
|
86
|
+
target-version = "py312"
|
|
87
|
+
|
|
88
|
+
[tool.ruff.lint]
|
|
89
|
+
select = ["E", "F", "I", "UP", "B", "SIM"]
|
|
90
|
+
ignore = ["E501"]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# this_file: src/vexy_mkdocs_tools/__init__.py
|
|
2
|
+
"""vexy-mkdocs-tools: Fire CLI wrapper around ProperDocs/MaterialX."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
try:
|
|
7
|
+
from vexy_mkdocs_tools.__version__ import __version__
|
|
8
|
+
except ImportError: # editable install before hatch-vcs has run
|
|
9
|
+
__version__ = "0.0.0+local"
|
|
10
|
+
|
|
11
|
+
__all__ = ["__version__"]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '0.1.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 1, 0)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = None
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# this_file: src/vexy_mkdocs_tools/cli.py
|
|
2
|
+
"""Fire CLI for vexy-mkdocs-tools.
|
|
3
|
+
|
|
4
|
+
Wraps ProperDocs build/serve with the conventions used by the FontLab/Vexy
|
|
5
|
+
sites: a `mkdocs/mkdocs.yml` config, a `docs/` output directory whose `CNAME`
|
|
6
|
+
is preserved across cleans, and an optional Flowmark formatting pass over
|
|
7
|
+
`src_docs/md/` before each build.
|
|
8
|
+
|
|
9
|
+
Usage::
|
|
10
|
+
|
|
11
|
+
uvx vexy-mkdocs-tools build # full build pipeline
|
|
12
|
+
uvx vexy-mkdocs-tools serve # live-reload preview
|
|
13
|
+
uvx vexy-mkdocs-tools clean # wipe docs/ but keep CNAME
|
|
14
|
+
uvx vexy-mkdocs-tools format # Flowmark in-place format
|
|
15
|
+
|
|
16
|
+
Site layout (overridable via flags / constructor args)::
|
|
17
|
+
|
|
18
|
+
<root>/
|
|
19
|
+
mkdocs/mkdocs.yml
|
|
20
|
+
src_docs/md/
|
|
21
|
+
docs/ (build output)
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
from __future__ import annotations
|
|
25
|
+
|
|
26
|
+
import shlex
|
|
27
|
+
import shutil
|
|
28
|
+
import subprocess
|
|
29
|
+
import sys
|
|
30
|
+
from pathlib import Path
|
|
31
|
+
|
|
32
|
+
import fire
|
|
33
|
+
from loguru import logger
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class BuildError(RuntimeError):
|
|
37
|
+
"""Raised when the build pipeline cannot proceed."""
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _configure_logging(verbose: bool) -> None:
|
|
41
|
+
import os
|
|
42
|
+
|
|
43
|
+
level = "DEBUG" if verbose else os.environ.get("VMT_LOG_LEVEL", "INFO").upper()
|
|
44
|
+
logger.remove()
|
|
45
|
+
logger.add(sys.stderr, level=level, format="<level>{level: <8}</level> | {message}")
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _find_repo_root(start: Path | None = None) -> Path:
|
|
49
|
+
"""Walk up until we find a dir containing both `mkdocs/mkdocs.yml` and `src_docs`."""
|
|
50
|
+
cur = (start or Path.cwd()).resolve()
|
|
51
|
+
for candidate in [cur, *cur.parents]:
|
|
52
|
+
if (candidate / "mkdocs" / "mkdocs.yml").is_file() and (
|
|
53
|
+
candidate / "src_docs"
|
|
54
|
+
).is_dir():
|
|
55
|
+
return candidate
|
|
56
|
+
raise BuildError(
|
|
57
|
+
"cannot locate site root (no mkdocs/mkdocs.yml + src_docs/ found "
|
|
58
|
+
"walking up from cwd). Pass --root explicitly."
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _clean_docs(docs_dir: Path) -> None:
|
|
63
|
+
"""Remove everything in `docs_dir` except `CNAME`. Recreate if missing."""
|
|
64
|
+
if not docs_dir.exists():
|
|
65
|
+
docs_dir.mkdir(parents=True, exist_ok=True)
|
|
66
|
+
logger.info(f"Created {docs_dir}")
|
|
67
|
+
return
|
|
68
|
+
cname_content: str | None = None
|
|
69
|
+
cname_path = docs_dir / "CNAME"
|
|
70
|
+
if cname_path.is_file():
|
|
71
|
+
cname_content = cname_path.read_text(encoding="utf-8")
|
|
72
|
+
logger.debug(f"Preserving CNAME: {cname_content.strip()!r}")
|
|
73
|
+
for child in docs_dir.iterdir():
|
|
74
|
+
if child.name == "CNAME":
|
|
75
|
+
continue
|
|
76
|
+
if child.is_dir() and not child.is_symlink():
|
|
77
|
+
shutil.rmtree(child)
|
|
78
|
+
else:
|
|
79
|
+
child.unlink()
|
|
80
|
+
logger.debug(f"Removed {child}")
|
|
81
|
+
if cname_content is not None:
|
|
82
|
+
cname_path.write_text(cname_content, encoding="utf-8")
|
|
83
|
+
logger.info(f"Cleaned {docs_dir} (preserved CNAME)")
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _run(cmd: list[str], cwd: Path) -> None:
|
|
87
|
+
logger.info(f"Running: {shlex.join(cmd)}")
|
|
88
|
+
subprocess.run(cmd, check=True, cwd=cwd)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _flowmark_available() -> bool:
|
|
92
|
+
return shutil.which("flowmark") is not None
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def _format_with_flowmark(src_docs_dir: Path, root: Path) -> None:
|
|
96
|
+
if not src_docs_dir.is_dir():
|
|
97
|
+
raise BuildError(f"source Markdown directory missing: {src_docs_dir}")
|
|
98
|
+
if not _flowmark_available():
|
|
99
|
+
logger.warning(
|
|
100
|
+
"flowmark not on PATH; install the [flowmark] extra "
|
|
101
|
+
"(`uv pip install vexy-mkdocs-tools[flowmark]`) to enable this step"
|
|
102
|
+
)
|
|
103
|
+
return
|
|
104
|
+
cmd = [
|
|
105
|
+
"flowmark",
|
|
106
|
+
"--inplace",
|
|
107
|
+
"--nobackup",
|
|
108
|
+
"--semantic",
|
|
109
|
+
"--cleanups",
|
|
110
|
+
"--smartquotes",
|
|
111
|
+
"--ellipses",
|
|
112
|
+
"--width",
|
|
113
|
+
"0",
|
|
114
|
+
str(src_docs_dir),
|
|
115
|
+
]
|
|
116
|
+
_run(cmd, root)
|
|
117
|
+
logger.info("Formatted source Markdown with Flowmark")
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class CLI:
|
|
121
|
+
"""vexy-mkdocs-tools build orchestrator."""
|
|
122
|
+
|
|
123
|
+
def __init__(
|
|
124
|
+
self,
|
|
125
|
+
root: str | None = None,
|
|
126
|
+
config: str | None = None,
|
|
127
|
+
docs: str | None = None,
|
|
128
|
+
src: str | None = None,
|
|
129
|
+
) -> None:
|
|
130
|
+
self._root = Path(root).resolve() if root else _find_repo_root()
|
|
131
|
+
self._config = (
|
|
132
|
+
Path(config).resolve() if config else self._root / "mkdocs" / "mkdocs.yml"
|
|
133
|
+
)
|
|
134
|
+
self._docs_dir = Path(docs).resolve() if docs else self._root / "docs"
|
|
135
|
+
self._src_docs_dir = Path(src).resolve() if src else self._root / "src_docs" / "md"
|
|
136
|
+
|
|
137
|
+
def clean(self, verbose: bool = False) -> None:
|
|
138
|
+
"""Remove everything in docs/ except CNAME."""
|
|
139
|
+
_configure_logging(verbose)
|
|
140
|
+
try:
|
|
141
|
+
_clean_docs(self._docs_dir)
|
|
142
|
+
except BuildError as exc:
|
|
143
|
+
logger.error(str(exc))
|
|
144
|
+
sys.exit(1)
|
|
145
|
+
|
|
146
|
+
def format(self, verbose: bool = False) -> None:
|
|
147
|
+
"""Format src_docs/md/ in place via Flowmark."""
|
|
148
|
+
_configure_logging(verbose)
|
|
149
|
+
try:
|
|
150
|
+
_format_with_flowmark(self._src_docs_dir, self._root)
|
|
151
|
+
except (BuildError, subprocess.CalledProcessError) as exc:
|
|
152
|
+
logger.error(str(exc))
|
|
153
|
+
sys.exit(1)
|
|
154
|
+
|
|
155
|
+
def build(self, verbose: bool = False, no_format: bool = False) -> None:
|
|
156
|
+
"""Run full pipeline: format → clean → properdocs build → write .nojekyll."""
|
|
157
|
+
_configure_logging(verbose)
|
|
158
|
+
try:
|
|
159
|
+
if not no_format:
|
|
160
|
+
_format_with_flowmark(self._src_docs_dir, self._root)
|
|
161
|
+
_clean_docs(self._docs_dir)
|
|
162
|
+
if not self._config.is_file():
|
|
163
|
+
raise BuildError(f"mkdocs config missing: {self._config}")
|
|
164
|
+
_run(
|
|
165
|
+
[
|
|
166
|
+
"properdocs",
|
|
167
|
+
"build",
|
|
168
|
+
"-f",
|
|
169
|
+
str(self._config),
|
|
170
|
+
"-d",
|
|
171
|
+
str(self._docs_dir),
|
|
172
|
+
],
|
|
173
|
+
self._root,
|
|
174
|
+
)
|
|
175
|
+
(self._docs_dir / ".nojekyll").touch()
|
|
176
|
+
logger.info("Build complete")
|
|
177
|
+
except BuildError as exc:
|
|
178
|
+
logger.error(str(exc))
|
|
179
|
+
sys.exit(1)
|
|
180
|
+
except subprocess.CalledProcessError as exc:
|
|
181
|
+
logger.error(f"build failed (exit {exc.returncode})")
|
|
182
|
+
sys.exit(1)
|
|
183
|
+
|
|
184
|
+
def serve(self, verbose: bool = False) -> None:
|
|
185
|
+
"""Live-reload preview via properdocs serve."""
|
|
186
|
+
_configure_logging(verbose)
|
|
187
|
+
try:
|
|
188
|
+
if not self._config.is_file():
|
|
189
|
+
raise BuildError(f"mkdocs config missing: {self._config}")
|
|
190
|
+
_run(["properdocs", "serve", "-f", str(self._config)], self._root)
|
|
191
|
+
except BuildError as exc:
|
|
192
|
+
logger.error(str(exc))
|
|
193
|
+
sys.exit(1)
|
|
194
|
+
except subprocess.CalledProcessError as exc:
|
|
195
|
+
logger.error(f"properdocs serve failed (exit {exc.returncode})")
|
|
196
|
+
sys.exit(1)
|
|
197
|
+
except KeyboardInterrupt:
|
|
198
|
+
logger.info("Server stopped")
|
|
199
|
+
|
|
200
|
+
def version(self) -> None:
|
|
201
|
+
"""Print the installed package version."""
|
|
202
|
+
from vexy_mkdocs_tools import __version__
|
|
203
|
+
|
|
204
|
+
print(__version__)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def main() -> None:
|
|
208
|
+
"""Console-script entry point for `vexy-mkdocs-tools` and `vmt`."""
|
|
209
|
+
fire.Fire(CLI)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
if __name__ == "__main__":
|
|
213
|
+
main()
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# this_file: tests/test_cli.py
|
|
2
|
+
"""Smoke tests for vexy_mkdocs_tools.cli."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
import pytest
|
|
9
|
+
|
|
10
|
+
from vexy_mkdocs_tools.cli import (
|
|
11
|
+
BuildError,
|
|
12
|
+
_clean_docs,
|
|
13
|
+
_find_repo_root,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_clean_docs_creates_missing(tmp_path: Path) -> None:
|
|
18
|
+
target = tmp_path / "docs"
|
|
19
|
+
_clean_docs(target)
|
|
20
|
+
assert target.is_dir()
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_clean_docs_preserves_cname(tmp_path: Path) -> None:
|
|
24
|
+
docs = tmp_path / "docs"
|
|
25
|
+
docs.mkdir()
|
|
26
|
+
(docs / "CNAME").write_text("example.com\n", encoding="utf-8")
|
|
27
|
+
(docs / "index.html").write_text("<html></html>", encoding="utf-8")
|
|
28
|
+
nested = docs / "assets"
|
|
29
|
+
nested.mkdir()
|
|
30
|
+
(nested / "x.png").write_bytes(b"\x89PNG")
|
|
31
|
+
|
|
32
|
+
_clean_docs(docs)
|
|
33
|
+
|
|
34
|
+
assert (docs / "CNAME").read_text(encoding="utf-8") == "example.com\n"
|
|
35
|
+
assert not (docs / "index.html").exists()
|
|
36
|
+
assert not nested.exists()
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_find_repo_root_walks_up(tmp_path: Path) -> None:
|
|
40
|
+
root = tmp_path / "site"
|
|
41
|
+
(root / "mkdocs").mkdir(parents=True)
|
|
42
|
+
(root / "mkdocs" / "mkdocs.yml").write_text("site_name: x\n", encoding="utf-8")
|
|
43
|
+
(root / "src_docs").mkdir()
|
|
44
|
+
deep = root / "a" / "b" / "c"
|
|
45
|
+
deep.mkdir(parents=True)
|
|
46
|
+
|
|
47
|
+
assert _find_repo_root(start=deep) == root.resolve()
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_find_repo_root_raises_when_missing(tmp_path: Path) -> None:
|
|
51
|
+
with pytest.raises(BuildError, match="cannot locate site root"):
|
|
52
|
+
_find_repo_root(start=tmp_path)
|