markweave 0.3.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.
- markweave-0.3.0/.gitignore +23 -0
- markweave-0.3.0/LICENSE +201 -0
- markweave-0.3.0/PKG-INFO +129 -0
- markweave-0.3.0/README.md +101 -0
- markweave-0.3.0/pyproject.toml +149 -0
- markweave-0.3.0/src/markweave/__init__.py +8 -0
- markweave-0.3.0/src/markweave/app.py +1973 -0
- markweave-0.3.0/src/markweave/auth/__init__.py +1 -0
- markweave-0.3.0/src/markweave/auth/errors.py +49 -0
- markweave-0.3.0/src/markweave/auth/memory.py +161 -0
- markweave-0.3.0/src/markweave/auth/models.py +77 -0
- markweave-0.3.0/src/markweave/auth/ports.py +95 -0
- markweave-0.3.0/src/markweave/auth/security.py +105 -0
- markweave-0.3.0/src/markweave/auth/service.py +238 -0
- markweave-0.3.0/src/markweave/config.py +207 -0
- markweave-0.3.0/src/markweave/conversion/__init__.py +47 -0
- markweave-0.3.0/src/markweave/conversion/archive.py +328 -0
- markweave-0.3.0/src/markweave/conversion/errors.py +38 -0
- markweave-0.3.0/src/markweave/conversion/images.py +363 -0
- markweave-0.3.0/src/markweave/conversion/libreoffice.py +800 -0
- markweave-0.3.0/src/markweave/conversion/mermaid.py +673 -0
- markweave-0.3.0/src/markweave/conversion/pandoc.py +301 -0
- markweave-0.3.0/src/markweave/conversion/processor.py +351 -0
- markweave-0.3.0/src/markweave/conversion/service.py +104 -0
- markweave-0.3.0/src/markweave/conversion/validation.py +300 -0
- markweave-0.3.0/src/markweave/jobs/__init__.py +10 -0
- markweave-0.3.0/src/markweave/jobs/errors.py +37 -0
- markweave-0.3.0/src/markweave/jobs/models.py +358 -0
- markweave-0.3.0/src/markweave/jobs/policy.py +153 -0
- markweave-0.3.0/src/markweave/jobs/ports.py +110 -0
- markweave-0.3.0/src/markweave/jobs/runner.py +161 -0
- markweave-0.3.0/src/markweave/jobs/runtime.py +83 -0
- markweave-0.3.0/src/markweave/jobs/service.py +203 -0
- markweave-0.3.0/src/markweave/jobs/worker.py +610 -0
- markweave-0.3.0/src/markweave/malware.py +98 -0
- markweave-0.3.0/src/markweave/observability.py +756 -0
- markweave-0.3.0/src/markweave/persistence/__init__.py +23 -0
- markweave-0.3.0/src/markweave/persistence/errors.py +8 -0
- markweave-0.3.0/src/markweave/persistence/jobs.py +878 -0
- markweave-0.3.0/src/markweave/persistence/migrations/__init__.py +68 -0
- markweave-0.3.0/src/markweave/persistence/migrations/env.py +9 -0
- markweave-0.3.0/src/markweave/persistence/migrations/script.py.mako +25 -0
- markweave-0.3.0/src/markweave/persistence/migrations/versions/20260823_01_auth_tables.py +51 -0
- markweave-0.3.0/src/markweave/persistence/migrations/versions/20260823_02_template_identity.py +118 -0
- markweave-0.3.0/src/markweave/persistence/migrations/versions/20260824_03_conversion_jobs.py +110 -0
- markweave-0.3.0/src/markweave/persistence/migrations/versions/20260824_04_template_versions.py +119 -0
- markweave-0.3.0/src/markweave/persistence/migrations/versions/20260824_05_template_integrity.py +406 -0
- markweave-0.3.0/src/markweave/persistence/migrations/versions/20260824_06_template_publication_leases.py +72 -0
- markweave-0.3.0/src/markweave/persistence/migrations/versions/20260824_07_retention_cleanup.py +51 -0
- markweave-0.3.0/src/markweave/persistence/migrations/versions/20260824_08_immutable_retention_records.py +47 -0
- markweave-0.3.0/src/markweave/persistence/migrations/versions/20260824_09_immutable_cleanup_evidence.py +40 -0
- markweave-0.3.0/src/markweave/persistence/migrations/versions/20260824_10_job_correlation.py +30 -0
- markweave-0.3.0/src/markweave/persistence/migrations/versions/20260824_11_authentication_audit.py +98 -0
- markweave-0.3.0/src/markweave/persistence/migrations/versions/20260825_12_job_integrity_metadata.py +62 -0
- markweave-0.3.0/src/markweave/persistence/observability.py +248 -0
- markweave-0.3.0/src/markweave/persistence/retention.py +223 -0
- markweave-0.3.0/src/markweave/persistence/schema.py +366 -0
- markweave-0.3.0/src/markweave/persistence/sql.py +412 -0
- markweave-0.3.0/src/markweave/persistence/templates.py +1000 -0
- markweave-0.3.0/src/markweave/recovery.py +163 -0
- markweave-0.3.0/src/markweave/retention.py +111 -0
- markweave-0.3.0/src/markweave/runtime.py +105 -0
- markweave-0.3.0/src/markweave/static/administration.css +19 -0
- markweave-0.3.0/src/markweave/static/administration.js +458 -0
- markweave-0.3.0/src/markweave/static/conversion.css +31 -0
- markweave-0.3.0/src/markweave/static/conversion.js +446 -0
- markweave-0.3.0/src/markweave/storage.py +201 -0
- markweave-0.3.0/src/markweave/templates/__init__.py +23 -0
- markweave-0.3.0/src/markweave/templates/engines.py +305 -0
- markweave-0.3.0/src/markweave/templates/errors.py +52 -0
- markweave-0.3.0/src/markweave/templates/models.py +154 -0
- markweave-0.3.0/src/markweave/templates/ports.py +161 -0
- markweave-0.3.0/src/markweave/templates/processor.py +118 -0
- markweave-0.3.0/src/markweave/templates/runtime.py +56 -0
- markweave-0.3.0/src/markweave/templates/service.py +635 -0
- markweave-0.3.0/src/markweave/templates/validation.py +727 -0
- markweave-0.3.0/src/markweave/version.py +3 -0
- markweave-0.3.0/src/markweave/web.py +141 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Local development environment notes (machine-specific)
|
|
2
|
+
.agents/local-environment.md
|
|
3
|
+
.agents/orchestrateur.md
|
|
4
|
+
|
|
5
|
+
# Original source material kept only for local reference
|
|
6
|
+
.agents/reference/
|
|
7
|
+
|
|
8
|
+
# Python and uv
|
|
9
|
+
.venv/
|
|
10
|
+
__pycache__/
|
|
11
|
+
*.py[cod]
|
|
12
|
+
.pytest_cache/
|
|
13
|
+
.ruff_cache/
|
|
14
|
+
.coverage
|
|
15
|
+
.coverage.*
|
|
16
|
+
coverage.json
|
|
17
|
+
htmlcov/
|
|
18
|
+
mutants/
|
|
19
|
+
dist/
|
|
20
|
+
build/
|
|
21
|
+
artifacts/
|
|
22
|
+
node_modules/
|
|
23
|
+
*.egg-info/
|
markweave-0.3.0/LICENSE
ADDED
|
@@ -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.
|
markweave-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: markweave
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A service for converting Markdown documents to DOCX and PDF
|
|
5
|
+
Project-URL: Documentation, https://github.com/Guillaume-Lombardo/simple-md-to-docx-converter#readme
|
|
6
|
+
Project-URL: Issues, https://github.com/Guillaume-Lombardo/simple-md-to-docx-converter/issues
|
|
7
|
+
Project-URL: Repository, https://github.com/Guillaume-Lombardo/simple-md-to-docx-converter
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Python: <3.15,>=3.14
|
|
11
|
+
Requires-Dist: alembic<2,>=1.16
|
|
12
|
+
Requires-Dist: argon2-cffi<26,>=25.1
|
|
13
|
+
Requires-Dist: boto3<2,>=1.40
|
|
14
|
+
Requires-Dist: cairosvg<3,>=2.8
|
|
15
|
+
Requires-Dist: fastapi<1,>=0.116
|
|
16
|
+
Requires-Dist: markdown-it-py<5,>=4
|
|
17
|
+
Requires-Dist: mdit-py-plugins<0.7,>=0.5
|
|
18
|
+
Requires-Dist: pillow<13,>=12
|
|
19
|
+
Requires-Dist: psycopg[binary]<4,>=3.2
|
|
20
|
+
Requires-Dist: pydantic-settings<3,>=2.10
|
|
21
|
+
Requires-Dist: pypdf<7,>=6.16.2
|
|
22
|
+
Requires-Dist: python-multipart<1,>=0.0.20
|
|
23
|
+
Requires-Dist: pyyaml<7,>=6
|
|
24
|
+
Requires-Dist: sqlalchemy<3,>=2.0
|
|
25
|
+
Requires-Dist: tinycss2<2,>=1.5
|
|
26
|
+
Requires-Dist: uvicorn<1,>=0.35
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# Markdown to DOCX and PDF Converter
|
|
30
|
+
|
|
31
|
+
This repository contains the foundation for a service that will convert Markdown documents to
|
|
32
|
+
DOCX and PDF. It currently provides local authentication, administrative account management,
|
|
33
|
+
revocable sessions, health endpoints, and durable standalone or distributed storage profiles.
|
|
34
|
+
It also provides a versioned template API with ownership, visibility-aware search, preferences,
|
|
35
|
+
full T10 Pandoc/LibreOffice activation, immutable font-validation evidence,
|
|
36
|
+
safe downloads, optimistic concurrency, immutable history, restoration, audit, and guarded
|
|
37
|
+
deletion across both storage profiles. The internal conversion component now validates standalone Markdown or bounded ZIP
|
|
38
|
+
packages, binds and normalizes approved local images, sanitizes and rasterizes untrusted SVG,
|
|
39
|
+
renders bounded Mermaid diagrams through local sandboxed Chromium, runs Pandoc in an isolated
|
|
40
|
+
workspace, and converts validated DOCX to bounded PDF through an isolated LibreOffice profile.
|
|
41
|
+
The versioned API persists owner-scoped conversion requests, exposes deterministic job state,
|
|
42
|
+
supports idempotent submission and cancellation, and uses lease-owning embedded or external worker
|
|
43
|
+
loops over SQLite or PostgreSQL. The authenticated server-rendered conversion page now provides
|
|
44
|
+
upload and drag-and-drop, active-template search with preferred/fallback visibility, DOCX/PDF/both
|
|
45
|
+
selection, asynchronous status and cancellation, expiration handling, and safe downloads. The
|
|
46
|
+
template administration page provides owner and administrator lifecycle controls, preferences,
|
|
47
|
+
version history, and an administrator-only local-account tab. Configurable quotas and resource
|
|
48
|
+
policy are assembled. Structured JSON logs, durable request-to-worker correlation, low-cardinality
|
|
49
|
+
queue and worker metrics, bounded immutable-audit reads, version traceability, and cheap profile
|
|
50
|
+
readiness are available; final-container features remain under development.
|
|
51
|
+
|
|
52
|
+
The project is licensed under [Apache-2.0](LICENSE). The approved first public version is `0.3.0`,
|
|
53
|
+
published on PyPI as `markweave` with the matching public Python import `markweave`. See
|
|
54
|
+
[the release process](docs/releasing.md) for the protected PyPI and GHCR publication contract and
|
|
55
|
+
required one-time external configuration. A reviewed version-change pull request merged to
|
|
56
|
+
protected `main` starts the automatic release; repository edits without a version transition do not.
|
|
57
|
+
|
|
58
|
+
## Requirements
|
|
59
|
+
|
|
60
|
+
- [`uv`](https://docs.astral.sh/uv/)
|
|
61
|
+
- A platform supported by the Python 3.14 distribution managed by `uv`
|
|
62
|
+
- Pandoc 3.10.2 for real DOCX conversion, Mermaid CLI 11.16.0 with Chrome 151.0.7922.173 for
|
|
63
|
+
diagram rendering, LibreOffice 26.2.5.2 for PDF conversion, and the Cairo shared library for SVG
|
|
64
|
+
rasterization; the validated UBI toolchain image provides these engines
|
|
65
|
+
- A reachable ClamAV `clamd` service for fail-closed pre-persistence upload scanning
|
|
66
|
+
|
|
67
|
+
`uv` reads `.python-version`, installs Python 3.14 when needed, and creates the project environment.
|
|
68
|
+
No manually managed virtual environment or direct `pip` invocation is required.
|
|
69
|
+
|
|
70
|
+
## Set up the project
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git clone git@github.com:Guillaume-Lombardo/simple-md-to-docx-converter.git
|
|
74
|
+
cd simple-md-to-docx-converter
|
|
75
|
+
uv sync --all-groups
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Run the canonical local checks:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
uv run ruff format .
|
|
82
|
+
uv run ruff check .
|
|
83
|
+
uv run ty check
|
|
84
|
+
npm ci --ignore-scripts
|
|
85
|
+
npm run test:web
|
|
86
|
+
uv run pytest -m "not requires_pandoc and not requires_mermaid and not requires_libreoffice"
|
|
87
|
+
uv run pytest
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
These Pytest commands independently enforce at least 90% overall coverage and 90% branch-only
|
|
91
|
+
coverage for the `markweave` application package. Pull-request CI also enforces 90% coverage of
|
|
92
|
+
changed executable application lines. Tests use `pytest-mock`; direct imports from `unittest.mock`
|
|
93
|
+
are rejected.
|
|
94
|
+
|
|
95
|
+
The lock file is committed. Use `uv sync --locked --all-groups` to require the committed dependency
|
|
96
|
+
resolution. Build dependencies are a locked project group and are also constrained explicitly for
|
|
97
|
+
isolated builds. Build distributions with the generated, hash-checked constraints:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
uv build --build-constraint build-constraints.txt --require-hashes
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Repository map
|
|
104
|
+
|
|
105
|
+
- `src/markweave/`: installable Python package
|
|
106
|
+
- `tests/`: automated tests
|
|
107
|
+
- `build-constraints.txt`: hash-checked constraints exported from the build dependency group
|
|
108
|
+
- `docs/architecture.md`: target architecture and component boundaries
|
|
109
|
+
- `docs/authentication.md`: local accounts, sessions, configuration, and current limitations
|
|
110
|
+
- `docs/storage-profiles.md`: profile configuration, backup, and restore procedures
|
|
111
|
+
- `docs/jobs.md`: conversion API, durable state machine, queue, worker, and recovery contract
|
|
112
|
+
- `docs/resource-policy.md`: quotas, budgets, retention, recovery, and cleanup configuration
|
|
113
|
+
- `docs/container-deployment.md`: final-image build, hardening, runtime profiles, and SBOM scans
|
|
114
|
+
- `docs/observability.md`: JSON logging, correlation, metrics, audit, and readiness contracts
|
|
115
|
+
- `docs/releasing.md`: version, tag, PyPI Trusted Publishing, GHCR, SBOM, and provenance procedure
|
|
116
|
+
- `docs/conversion-ui.md`: authenticated conversion-page workflow, security, and validation scope
|
|
117
|
+
- `docs/administration-ui.md`: template-owner and administrator browser workflows
|
|
118
|
+
- `docs/templates.md`: template identity, visibility, selection, and T15 boundaries
|
|
119
|
+
- `docs/golden-testing.md`: reference corpus and deterministic DOCX/PDF comparison helpers
|
|
120
|
+
- `docs/pandoc-docx.md`: approved Markdown dialect and isolated Pandoc DOCX boundary
|
|
121
|
+
- `docs/archive-images.md`: secure archive and local-image preparation contract
|
|
122
|
+
- `docs/mermaid.md`: bounded local Mermaid/Chromium preprocessing contract
|
|
123
|
+
- `docs/word-templates-fonts.md`: bounded template activation and pinned font contract
|
|
124
|
+
- `docs/pdf-conversion.md`: isolated LibreOffice PDF and traceability contract
|
|
125
|
+
- `docs/local-development.md`: detailed local workflow
|
|
126
|
+
- `tickets/`: repository-reviewed project ticket mirrors
|
|
127
|
+
|
|
128
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) before proposing a change. The normative product decisions
|
|
129
|
+
and delivery plan are in [docs/product-specification.md](docs/product-specification.md).
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Markdown to DOCX and PDF Converter
|
|
2
|
+
|
|
3
|
+
This repository contains the foundation for a service that will convert Markdown documents to
|
|
4
|
+
DOCX and PDF. It currently provides local authentication, administrative account management,
|
|
5
|
+
revocable sessions, health endpoints, and durable standalone or distributed storage profiles.
|
|
6
|
+
It also provides a versioned template API with ownership, visibility-aware search, preferences,
|
|
7
|
+
full T10 Pandoc/LibreOffice activation, immutable font-validation evidence,
|
|
8
|
+
safe downloads, optimistic concurrency, immutable history, restoration, audit, and guarded
|
|
9
|
+
deletion across both storage profiles. The internal conversion component now validates standalone Markdown or bounded ZIP
|
|
10
|
+
packages, binds and normalizes approved local images, sanitizes and rasterizes untrusted SVG,
|
|
11
|
+
renders bounded Mermaid diagrams through local sandboxed Chromium, runs Pandoc in an isolated
|
|
12
|
+
workspace, and converts validated DOCX to bounded PDF through an isolated LibreOffice profile.
|
|
13
|
+
The versioned API persists owner-scoped conversion requests, exposes deterministic job state,
|
|
14
|
+
supports idempotent submission and cancellation, and uses lease-owning embedded or external worker
|
|
15
|
+
loops over SQLite or PostgreSQL. The authenticated server-rendered conversion page now provides
|
|
16
|
+
upload and drag-and-drop, active-template search with preferred/fallback visibility, DOCX/PDF/both
|
|
17
|
+
selection, asynchronous status and cancellation, expiration handling, and safe downloads. The
|
|
18
|
+
template administration page provides owner and administrator lifecycle controls, preferences,
|
|
19
|
+
version history, and an administrator-only local-account tab. Configurable quotas and resource
|
|
20
|
+
policy are assembled. Structured JSON logs, durable request-to-worker correlation, low-cardinality
|
|
21
|
+
queue and worker metrics, bounded immutable-audit reads, version traceability, and cheap profile
|
|
22
|
+
readiness are available; final-container features remain under development.
|
|
23
|
+
|
|
24
|
+
The project is licensed under [Apache-2.0](LICENSE). The approved first public version is `0.3.0`,
|
|
25
|
+
published on PyPI as `markweave` with the matching public Python import `markweave`. See
|
|
26
|
+
[the release process](docs/releasing.md) for the protected PyPI and GHCR publication contract and
|
|
27
|
+
required one-time external configuration. A reviewed version-change pull request merged to
|
|
28
|
+
protected `main` starts the automatic release; repository edits without a version transition do not.
|
|
29
|
+
|
|
30
|
+
## Requirements
|
|
31
|
+
|
|
32
|
+
- [`uv`](https://docs.astral.sh/uv/)
|
|
33
|
+
- A platform supported by the Python 3.14 distribution managed by `uv`
|
|
34
|
+
- Pandoc 3.10.2 for real DOCX conversion, Mermaid CLI 11.16.0 with Chrome 151.0.7922.173 for
|
|
35
|
+
diagram rendering, LibreOffice 26.2.5.2 for PDF conversion, and the Cairo shared library for SVG
|
|
36
|
+
rasterization; the validated UBI toolchain image provides these engines
|
|
37
|
+
- A reachable ClamAV `clamd` service for fail-closed pre-persistence upload scanning
|
|
38
|
+
|
|
39
|
+
`uv` reads `.python-version`, installs Python 3.14 when needed, and creates the project environment.
|
|
40
|
+
No manually managed virtual environment or direct `pip` invocation is required.
|
|
41
|
+
|
|
42
|
+
## Set up the project
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
git clone git@github.com:Guillaume-Lombardo/simple-md-to-docx-converter.git
|
|
46
|
+
cd simple-md-to-docx-converter
|
|
47
|
+
uv sync --all-groups
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Run the canonical local checks:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
uv run ruff format .
|
|
54
|
+
uv run ruff check .
|
|
55
|
+
uv run ty check
|
|
56
|
+
npm ci --ignore-scripts
|
|
57
|
+
npm run test:web
|
|
58
|
+
uv run pytest -m "not requires_pandoc and not requires_mermaid and not requires_libreoffice"
|
|
59
|
+
uv run pytest
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
These Pytest commands independently enforce at least 90% overall coverage and 90% branch-only
|
|
63
|
+
coverage for the `markweave` application package. Pull-request CI also enforces 90% coverage of
|
|
64
|
+
changed executable application lines. Tests use `pytest-mock`; direct imports from `unittest.mock`
|
|
65
|
+
are rejected.
|
|
66
|
+
|
|
67
|
+
The lock file is committed. Use `uv sync --locked --all-groups` to require the committed dependency
|
|
68
|
+
resolution. Build dependencies are a locked project group and are also constrained explicitly for
|
|
69
|
+
isolated builds. Build distributions with the generated, hash-checked constraints:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
uv build --build-constraint build-constraints.txt --require-hashes
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Repository map
|
|
76
|
+
|
|
77
|
+
- `src/markweave/`: installable Python package
|
|
78
|
+
- `tests/`: automated tests
|
|
79
|
+
- `build-constraints.txt`: hash-checked constraints exported from the build dependency group
|
|
80
|
+
- `docs/architecture.md`: target architecture and component boundaries
|
|
81
|
+
- `docs/authentication.md`: local accounts, sessions, configuration, and current limitations
|
|
82
|
+
- `docs/storage-profiles.md`: profile configuration, backup, and restore procedures
|
|
83
|
+
- `docs/jobs.md`: conversion API, durable state machine, queue, worker, and recovery contract
|
|
84
|
+
- `docs/resource-policy.md`: quotas, budgets, retention, recovery, and cleanup configuration
|
|
85
|
+
- `docs/container-deployment.md`: final-image build, hardening, runtime profiles, and SBOM scans
|
|
86
|
+
- `docs/observability.md`: JSON logging, correlation, metrics, audit, and readiness contracts
|
|
87
|
+
- `docs/releasing.md`: version, tag, PyPI Trusted Publishing, GHCR, SBOM, and provenance procedure
|
|
88
|
+
- `docs/conversion-ui.md`: authenticated conversion-page workflow, security, and validation scope
|
|
89
|
+
- `docs/administration-ui.md`: template-owner and administrator browser workflows
|
|
90
|
+
- `docs/templates.md`: template identity, visibility, selection, and T15 boundaries
|
|
91
|
+
- `docs/golden-testing.md`: reference corpus and deterministic DOCX/PDF comparison helpers
|
|
92
|
+
- `docs/pandoc-docx.md`: approved Markdown dialect and isolated Pandoc DOCX boundary
|
|
93
|
+
- `docs/archive-images.md`: secure archive and local-image preparation contract
|
|
94
|
+
- `docs/mermaid.md`: bounded local Mermaid/Chromium preprocessing contract
|
|
95
|
+
- `docs/word-templates-fonts.md`: bounded template activation and pinned font contract
|
|
96
|
+
- `docs/pdf-conversion.md`: isolated LibreOffice PDF and traceability contract
|
|
97
|
+
- `docs/local-development.md`: detailed local workflow
|
|
98
|
+
- `tickets/`: repository-reviewed project ticket mirrors
|
|
99
|
+
|
|
100
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) before proposing a change. The normative product decisions
|
|
101
|
+
and delivery plan are in [docs/product-specification.md](docs/product-specification.md).
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling==1.32.0"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "markweave"
|
|
7
|
+
version = "0.3.0"
|
|
8
|
+
description = "A service for converting Markdown documents to DOCX and PDF"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.14,<3.15"
|
|
13
|
+
dependencies = [
|
|
14
|
+
"alembic>=1.16,<2",
|
|
15
|
+
"argon2-cffi>=25.1,<26",
|
|
16
|
+
"boto3>=1.40,<2",
|
|
17
|
+
"cairosvg>=2.8,<3",
|
|
18
|
+
"fastapi>=0.116,<1",
|
|
19
|
+
"markdown-it-py>=4,<5",
|
|
20
|
+
"mdit-py-plugins>=0.5,<0.7",
|
|
21
|
+
"pillow>=12,<13",
|
|
22
|
+
"psycopg[binary]>=3.2,<4",
|
|
23
|
+
"pydantic-settings>=2.10,<3",
|
|
24
|
+
"pypdf>=6.16.2,<7",
|
|
25
|
+
"python-multipart>=0.0.20,<1",
|
|
26
|
+
"pyyaml>=6,<7",
|
|
27
|
+
"sqlalchemy>=2.0,<3",
|
|
28
|
+
"tinycss2>=1.5,<2",
|
|
29
|
+
"uvicorn>=0.35,<1",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Documentation = "https://github.com/Guillaume-Lombardo/simple-md-to-docx-converter#readme"
|
|
34
|
+
Issues = "https://github.com/Guillaume-Lombardo/simple-md-to-docx-converter/issues"
|
|
35
|
+
Repository = "https://github.com/Guillaume-Lombardo/simple-md-to-docx-converter"
|
|
36
|
+
|
|
37
|
+
[dependency-groups]
|
|
38
|
+
build = ["hatchling==1.32.0"]
|
|
39
|
+
dev = [
|
|
40
|
+
"httpx>=0.28,<1",
|
|
41
|
+
"mutmut==3.7.0",
|
|
42
|
+
"pypdfium2>=5.13,<6",
|
|
43
|
+
"pytest>=9.0,<10",
|
|
44
|
+
"pytest-cov>=7.0,<8",
|
|
45
|
+
"pytest-mock>=3.15,<4",
|
|
46
|
+
"ruff>=0.13,<1",
|
|
47
|
+
"ty>=0.0.1a20,<1",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[tool.uv]
|
|
51
|
+
build-constraint-dependencies = [
|
|
52
|
+
"hatchling==1.32.0",
|
|
53
|
+
"packaging==26.3",
|
|
54
|
+
"pathspec==1.1.1",
|
|
55
|
+
"pluggy==1.6.0",
|
|
56
|
+
"tomlkit==0.15.1",
|
|
57
|
+
"trove-classifiers==2026.6.1.19",
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
[tool.hatch.build.targets.sdist]
|
|
61
|
+
include = ["/LICENSE", "/README.md", "/pyproject.toml", "/src/markweave"]
|
|
62
|
+
|
|
63
|
+
[tool.hatch.build.targets.wheel]
|
|
64
|
+
packages = ["src/markweave"]
|
|
65
|
+
|
|
66
|
+
[tool.pytest.ini_options]
|
|
67
|
+
addopts = [
|
|
68
|
+
"--strict-config",
|
|
69
|
+
"--strict-markers",
|
|
70
|
+
"-p",
|
|
71
|
+
"scripts.ci.pytest_branch_coverage",
|
|
72
|
+
"--cov=markweave",
|
|
73
|
+
"--cov-branch",
|
|
74
|
+
"--cov-report=term-missing",
|
|
75
|
+
"--cov-report=json:coverage.json",
|
|
76
|
+
"--cov-fail-under=90",
|
|
77
|
+
]
|
|
78
|
+
pythonpath = ["."]
|
|
79
|
+
testpaths = ["tests"]
|
|
80
|
+
markers = [
|
|
81
|
+
"unit: deterministic tests without external dependencies",
|
|
82
|
+
"functional: application behavior through public interfaces",
|
|
83
|
+
"integration: integration with a real component",
|
|
84
|
+
"e2e: complete flow against the built container",
|
|
85
|
+
"slow: excluded from explicitly fast checks",
|
|
86
|
+
"requires_pandoc: requires Pandoc",
|
|
87
|
+
"requires_mermaid: requires Mermaid CLI and Chromium",
|
|
88
|
+
"requires_libreoffice: requires LibreOffice",
|
|
89
|
+
"requires_postgres: requires PostgreSQL",
|
|
90
|
+
"requires_s3: requires S3-compatible storage",
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
[tool.ruff]
|
|
94
|
+
target-version = "py314"
|
|
95
|
+
line-length = 88
|
|
96
|
+
|
|
97
|
+
[tool.ruff.lint]
|
|
98
|
+
select = [
|
|
99
|
+
"B",
|
|
100
|
+
"C4",
|
|
101
|
+
"DTZ",
|
|
102
|
+
"E4",
|
|
103
|
+
"E7",
|
|
104
|
+
"E9",
|
|
105
|
+
"F",
|
|
106
|
+
"I",
|
|
107
|
+
"PERF",
|
|
108
|
+
"PIE",
|
|
109
|
+
"PL",
|
|
110
|
+
"RET",
|
|
111
|
+
"RUF",
|
|
112
|
+
"S",
|
|
113
|
+
"SIM",
|
|
114
|
+
"TID",
|
|
115
|
+
"UP",
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
[tool.ruff.lint.flake8-tidy-imports.banned-api]
|
|
119
|
+
"unittest.mock".msg = "Use the pytest-mock mocker fixture instead."
|
|
120
|
+
|
|
121
|
+
[tool.ruff.lint.per-file-ignores]
|
|
122
|
+
"scripts/ci/check_changed_coverage.py" = ["S603", "S607"]
|
|
123
|
+
"scripts/ci/run_domain.py" = ["S603"]
|
|
124
|
+
"tests/**/*.py" = ["PLR2004", "S101", "S603", "S607"]
|
|
125
|
+
|
|
126
|
+
[tool.ty.environment]
|
|
127
|
+
python-version = "3.14"
|
|
128
|
+
|
|
129
|
+
[tool.ty.src]
|
|
130
|
+
include = ["src", "scripts", "tests"]
|
|
131
|
+
|
|
132
|
+
[tool.coverage.run]
|
|
133
|
+
branch = true
|
|
134
|
+
source = ["markweave"]
|
|
135
|
+
|
|
136
|
+
[tool.coverage.report]
|
|
137
|
+
fail_under = 90
|
|
138
|
+
show_missing = true
|
|
139
|
+
|
|
140
|
+
[tool.mutmut]
|
|
141
|
+
source_paths = ["src/markweave"]
|
|
142
|
+
pytest_add_cli_args = [
|
|
143
|
+
"-c",
|
|
144
|
+
"/dev/null",
|
|
145
|
+
"-q",
|
|
146
|
+
"tests/unit/test_observability.py",
|
|
147
|
+
]
|
|
148
|
+
timeout_constant = 5.0
|
|
149
|
+
timeout_multiplier = 3.0
|