cpdocs 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. cpdocs-0.1.0/.github/workflows/docs.yml +72 -0
  2. cpdocs-0.1.0/.github/workflows/test.yml +20 -0
  3. cpdocs-0.1.0/.gitignore +9 -0
  4. cpdocs-0.1.0/LICENSES/Apache-2.0.txt +202 -0
  5. cpdocs-0.1.0/PKG-INFO +48 -0
  6. cpdocs-0.1.0/REUSE.toml +8 -0
  7. cpdocs-0.1.0/docs/api/index.md +8 -0
  8. cpdocs-0.1.0/docs/cpdocs.yml +19 -0
  9. cpdocs-0.1.0/docs/web/examples/index.md +25 -0
  10. cpdocs-0.1.0/docs/web/explanation/architecture.md +20 -0
  11. cpdocs-0.1.0/docs/web/explanation/variants.md +17 -0
  12. cpdocs-0.1.0/docs/web/how-to/ci.md +50 -0
  13. cpdocs-0.1.0/docs/web/how-to/generated-headers.md +19 -0
  14. cpdocs-0.1.0/docs/web/how-to/other-build-systems.md +40 -0
  15. cpdocs-0.1.0/docs/web/how-to/properdocs.md +23 -0
  16. cpdocs-0.1.0/docs/web/how-to/variants.md +53 -0
  17. cpdocs-0.1.0/docs/web/index.md +21 -0
  18. cpdocs-0.1.0/docs/web/reference/api.md +19 -0
  19. cpdocs-0.1.0/docs/web/reference/cli.md +28 -0
  20. cpdocs-0.1.0/docs/web/reference/cmake.md +51 -0
  21. cpdocs-0.1.0/docs/web/reference/comments.md +34 -0
  22. cpdocs-0.1.0/docs/web/reference/configuration.md +67 -0
  23. cpdocs-0.1.0/docs/web/reference/contract.md +106 -0
  24. cpdocs-0.1.0/docs/web/reference/extraction.md +35 -0
  25. cpdocs-0.1.0/docs/web/reference/links.md +31 -0
  26. cpdocs-0.1.0/docs/web/tutorials/first-reference.md +88 -0
  27. cpdocs-0.1.0/examples/basic-cpp/.gitignore +3 -0
  28. cpdocs-0.1.0/examples/basic-cpp/CMakeLists.txt +14 -0
  29. cpdocs-0.1.0/examples/basic-cpp/docs/api/index.md +10 -0
  30. cpdocs-0.1.0/examples/basic-cpp/docs/cpdocs.yml +28 -0
  31. cpdocs-0.1.0/examples/basic-cpp/docs/web/api.md +13 -0
  32. cpdocs-0.1.0/examples/basic-cpp/docs/web/index.md +14 -0
  33. cpdocs-0.1.0/examples/basic-cpp/include/acme/math.hpp +49 -0
  34. cpdocs-0.1.0/examples/basic-cpp/properdocs.yml +21 -0
  35. cpdocs-0.1.0/examples/basic-cpp/readme.md +12 -0
  36. cpdocs-0.1.0/examples/basic-cpp/src/math.cpp +22 -0
  37. cpdocs-0.1.0/examples/c-basic/.gitignore +3 -0
  38. cpdocs-0.1.0/examples/c-basic/CMakeLists.txt +14 -0
  39. cpdocs-0.1.0/examples/c-basic/docs/api/index.md +10 -0
  40. cpdocs-0.1.0/examples/c-basic/docs/cpdocs.yml +25 -0
  41. cpdocs-0.1.0/examples/c-basic/docs/web/api.md +13 -0
  42. cpdocs-0.1.0/examples/c-basic/docs/web/index.md +15 -0
  43. cpdocs-0.1.0/examples/c-basic/include/ring/ring.h +32 -0
  44. cpdocs-0.1.0/examples/c-basic/properdocs.yml +21 -0
  45. cpdocs-0.1.0/examples/c-basic/readme.md +12 -0
  46. cpdocs-0.1.0/examples/c-basic/src/ring.c +11 -0
  47. cpdocs-0.1.0/examples/cpp-features/.gitignore +3 -0
  48. cpdocs-0.1.0/examples/cpp-features/CMakeLists.txt +40 -0
  49. cpdocs-0.1.0/examples/cpp-features/cmake/feature.cmake +109 -0
  50. cpdocs-0.1.0/examples/cpp-features/docs/api/index.md +10 -0
  51. cpdocs-0.1.0/examples/cpp-features/docs/cpdocs-minibuild.yml +13 -0
  52. cpdocs-0.1.0/examples/cpp-features/docs/cpdocs.yml +33 -0
  53. cpdocs-0.1.0/examples/cpp-features/docs/web/api.md +13 -0
  54. cpdocs-0.1.0/examples/cpp-features/docs/web/index.md +16 -0
  55. cpdocs-0.1.0/examples/cpp-features/include/demo/solver.hpp +48 -0
  56. cpdocs-0.1.0/examples/cpp-features/properdocs.yml +21 -0
  57. cpdocs-0.1.0/examples/cpp-features/readme.md +12 -0
  58. cpdocs-0.1.0/examples/cpp-features/tools/minibuild.py +76 -0
  59. cpdocs-0.1.0/examples/cpp-templates/.gitignore +3 -0
  60. cpdocs-0.1.0/examples/cpp-templates/CMakeLists.txt +14 -0
  61. cpdocs-0.1.0/examples/cpp-templates/docs/api/index.md +10 -0
  62. cpdocs-0.1.0/examples/cpp-templates/docs/cpdocs.yml +29 -0
  63. cpdocs-0.1.0/examples/cpp-templates/docs/web/api.md +13 -0
  64. cpdocs-0.1.0/examples/cpp-templates/docs/web/index.md +18 -0
  65. cpdocs-0.1.0/examples/cpp-templates/include/meta/meta.hpp +127 -0
  66. cpdocs-0.1.0/examples/cpp-templates/properdocs.yml +21 -0
  67. cpdocs-0.1.0/examples/cpp-templates/readme.md +12 -0
  68. cpdocs-0.1.0/examples/generated-cpp/.gitignore +3 -0
  69. cpdocs-0.1.0/examples/generated-cpp/CMakeLists.txt +31 -0
  70. cpdocs-0.1.0/examples/generated-cpp/docs/api/index.md +10 -0
  71. cpdocs-0.1.0/examples/generated-cpp/docs/cpdocs.yml +25 -0
  72. cpdocs-0.1.0/examples/generated-cpp/docs/web/api.md +13 -0
  73. cpdocs-0.1.0/examples/generated-cpp/docs/web/index.md +13 -0
  74. cpdocs-0.1.0/examples/generated-cpp/generated-template/generated.hpp +16 -0
  75. cpdocs-0.1.0/examples/generated-cpp/include/acme/core.hpp +9 -0
  76. cpdocs-0.1.0/examples/generated-cpp/properdocs.yml +21 -0
  77. cpdocs-0.1.0/examples/generated-cpp/readme.md +12 -0
  78. cpdocs-0.1.0/examples/generated-cpp/src/generated.cpp +12 -0
  79. cpdocs-0.1.0/examples/mixed/.gitignore +3 -0
  80. cpdocs-0.1.0/examples/mixed/CMakeLists.txt +26 -0
  81. cpdocs-0.1.0/examples/mixed/cmake/feature.cmake +109 -0
  82. cpdocs-0.1.0/examples/mixed/docs/api/index.md +10 -0
  83. cpdocs-0.1.0/examples/mixed/docs/cpdocs.yml +25 -0
  84. cpdocs-0.1.0/examples/mixed/docs/web/api.md +13 -0
  85. cpdocs-0.1.0/examples/mixed/docs/web/index.md +16 -0
  86. cpdocs-0.1.0/examples/mixed/include/geom/vector.hpp +22 -0
  87. cpdocs-0.1.0/examples/mixed/properdocs.yml +21 -0
  88. cpdocs-0.1.0/examples/mixed/python/pygeom/__init__.py +8 -0
  89. cpdocs-0.1.0/examples/mixed/readme.md +12 -0
  90. cpdocs-0.1.0/examples/mixed/src/geom.cpp +7 -0
  91. cpdocs-0.1.0/examples/python-basic/.gitignore +3 -0
  92. cpdocs-0.1.0/examples/python-basic/docs/api/index.md +10 -0
  93. cpdocs-0.1.0/examples/python-basic/docs/cpdocs.yml +27 -0
  94. cpdocs-0.1.0/examples/python-basic/docs/web/api.md +13 -0
  95. cpdocs-0.1.0/examples/python-basic/docs/web/index.md +15 -0
  96. cpdocs-0.1.0/examples/python-basic/properdocs.yml +21 -0
  97. cpdocs-0.1.0/examples/python-basic/pyproject.toml +14 -0
  98. cpdocs-0.1.0/examples/python-basic/readme.md +12 -0
  99. cpdocs-0.1.0/examples/python-basic/src/dice/__init__.py +10 -0
  100. cpdocs-0.1.0/examples/python-basic/src/dice/_rng.py +10 -0
  101. cpdocs-0.1.0/examples/python-basic/src/dice/core.py +27 -0
  102. cpdocs-0.1.0/properdocs.yml +59 -0
  103. cpdocs-0.1.0/pyproject.toml +58 -0
  104. cpdocs-0.1.0/readme.md +32 -0
  105. cpdocs-0.1.0/src/cpdocs/__init__.py +5 -0
  106. cpdocs-0.1.0/src/cpdocs/__main__.py +5 -0
  107. cpdocs-0.1.0/src/cpdocs/build.py +645 -0
  108. cpdocs-0.1.0/src/cpdocs/clang_backend.py +1254 -0
  109. cpdocs-0.1.0/src/cpdocs/cli.py +78 -0
  110. cpdocs-0.1.0/src/cpdocs/config.py +160 -0
  111. cpdocs-0.1.0/src/cpdocs/contract.py +407 -0
  112. cpdocs-0.1.0/src/cpdocs/html_renderer.py +1803 -0
  113. cpdocs-0.1.0/src/cpdocs/model.py +228 -0
  114. cpdocs-0.1.0/src/cpdocs/properdocs_core.py +158 -0
  115. cpdocs-0.1.0/src/cpdocs/properdocs_plugin.py +236 -0
  116. cpdocs-0.1.0/src/cpdocs/python_backend.py +469 -0
  117. cpdocs-0.1.0/src/cpdocs/python_manifest.py +84 -0
  118. cpdocs-0.1.0/src/cpdocs/render.py +838 -0
  119. cpdocs-0.1.0/src/cpdocs/rust_backend.py +234 -0
  120. cpdocs-0.1.0/src/cpdocs/share/cmake/cpdocs.cmake +464 -0
  121. cpdocs-0.1.0/src/cpdocs/versioning.py +201 -0
  122. cpdocs-0.1.0/test/conftest.py +114 -0
  123. cpdocs-0.1.0/test/test_api_reference.py +420 -0
  124. cpdocs-0.1.0/test/test_build.py +158 -0
  125. cpdocs-0.1.0/test/test_config.py +106 -0
  126. cpdocs-0.1.0/test/test_contract.py +171 -0
  127. cpdocs-0.1.0/test/test_examples.py +441 -0
  128. cpdocs-0.1.0/test/test_properdocs_core.py +99 -0
  129. cpdocs-0.1.0/test/test_versioning.py +76 -0
  130. cpdocs-0.1.0/tools/build_example_sites.py +59 -0
  131. cpdocs-0.1.0/tools/build_examples.py +44 -0
  132. cpdocs-0.1.0/uv.lock +778 -0
@@ -0,0 +1,72 @@
1
+ # SPDX-FileCopyrightText: 2026 cpdocs developers
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ name: documentation
4
+
5
+ # The published site is always built from the default branch: with the full history, cpdocs
6
+ # documents every configured branch and tag from there. The github-pages environment only accepts
7
+ # deployments from the default branch, so a pushed tag does not deploy itself; it starts this
8
+ # workflow on the default branch, whose build then includes the new tag.
9
+
10
+ on:
11
+ push:
12
+ branches: [main]
13
+ tags: ["*"]
14
+ pull_request:
15
+ workflow_dispatch:
16
+
17
+ permissions:
18
+ contents: read
19
+
20
+ jobs:
21
+ rebuild-for-tag:
22
+ if: github.ref_type == 'tag'
23
+ runs-on: ubuntu-latest
24
+ permissions:
25
+ actions: write
26
+ steps:
27
+ - name: Rebuild the site on the default branch
28
+ env:
29
+ GH_TOKEN: ${{ github.token }}
30
+ run: >
31
+ gh workflow run docs.yml
32
+ --repo "${{ github.repository }}"
33
+ --ref "${{ github.event.repository.default_branch }}"
34
+
35
+ build:
36
+ if: github.ref_type != 'tag'
37
+ runs-on: ubuntu-latest
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+ with:
41
+ fetch-depth: 0
42
+ - uses: astral-sh/setup-uv@v6
43
+ - name: Install toolchain for the C and C++ examples
44
+ run: sudo apt-get install -y --no-install-recommends clang cmake ninja-build
45
+ - name: Build documentation
46
+ run: uv run properdocs build --strict
47
+ # Each example is published below examples/<name>/ as its own versioned site.
48
+ - name: Build example sites
49
+ run: uv run python tools/build_example_sites.py --output build/site/examples
50
+ - uses: actions/upload-pages-artifact@v3
51
+ with:
52
+ path: build/site
53
+
54
+ deploy:
55
+ if: >
56
+ github.event_name != 'pull_request'
57
+ && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
58
+ needs: build
59
+ runs-on: ubuntu-latest
60
+ permissions:
61
+ pages: write
62
+ id-token: write
63
+ concurrency:
64
+ group: github-pages
65
+ cancel-in-progress: false
66
+ environment:
67
+ name: github-pages
68
+ url: ${{ steps.deployment.outputs.page_url }}
69
+ steps:
70
+ - name: Deploy
71
+ id: deployment
72
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,20 @@
1
+ # SPDX-FileCopyrightText: 2026 cpdocs developers
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ name: test
4
+
5
+ on:
6
+ push:
7
+ pull_request:
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: astral-sh/setup-uv@v6
15
+ - name: Install toolchain for the C and C++ examples
16
+ run: sudo apt-get install -y --no-install-recommends clang cmake ninja-build
17
+ - name: Lint
18
+ run: uv run ruff check && uv run ruff format --check
19
+ - name: Test
20
+ run: uv run pytest -q
@@ -0,0 +1,9 @@
1
+ # SPDX-FileCopyrightText: 2026 cpdocs developers
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ __pycache__/
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ .venv/
7
+ build/
8
+ dist/
9
+ *.egg-info/
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
cpdocs-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,48 @@
1
+ Metadata-Version: 2.5
2
+ Name: cpdocs
3
+ Version: 0.1.0
4
+ Summary: Semantic, versioned API documentation for C, C++, Python and Rust projects
5
+ Project-URL: Source, https://github.com/ambhora/cpdocs
6
+ Author-email: Jayesh Badwaik <j.badwaik@fz-juelich.de>
7
+ License-Expression: Apache-2.0
8
+ Requires-Python: >=3.11
9
+ Requires-Dist: markdown-it-py>=3
10
+ Requires-Dist: packaging>=24
11
+ Requires-Dist: pygments>=2.17
12
+ Requires-Dist: pyyaml>=6
13
+ Provides-Extra: properdocs
14
+ Requires-Dist: properdocs>=1.6.7; extra == 'properdocs'
15
+ Description-Content-Type: text/markdown
16
+
17
+ <!--
18
+ SPDX-FileCopyrightText: 2026 cpdocs developers
19
+ SPDX-License-Identifier: Apache-2.0
20
+ -->
21
+ # cpdocs
22
+
23
+ cpdocs generates semantic, versioned API documentation for C, C++, Python and Rust projects.
24
+
25
+ It asks the project's build system, through a small JSON contract, which variants of the API exist
26
+ and how to read each of them. It then extracts every variant, Clang for C and C++, `ast` for Python
27
+ and rustdoc JSON for Rust, merges them into one reference, and publishes one version per configured
28
+ branch and tag. A CMake adapter ships with cpdocs; other build systems implement the same contract.
29
+
30
+ ```console
31
+ cpdocs build # document the working tree into build/cpdocs/current
32
+ cpdocs versions # document the configured branches and tags
33
+ properdocs build # project website with the versioned API mounted
34
+ ```
35
+
36
+ The configuration lives in `docs/cpdocs.yml`, the API introduction in `docs/api/index.md` and the
37
+ ProperDocs pages in `docs/web`. The documentation starts at `docs/web/index.md`; the `examples/`
38
+ directory holds standalone projects that the test suite builds.
39
+
40
+ ## Development
41
+
42
+ ```console
43
+ uv sync
44
+ uv run pytest
45
+ uv run ruff check && uv run ruff format --check
46
+ ```
47
+
48
+ The C and C++ tests need `clang++`, `cmake` and `ninja`; they are skipped when these are missing.
@@ -0,0 +1,8 @@
1
+ # SPDX-FileCopyrightText: 2026 cpdocs developers
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ version = 1
4
+
5
+ [[annotations]]
6
+ path = "uv.lock"
7
+ SPDX-FileCopyrightText = "2026 cpdocs developers"
8
+ SPDX-License-Identifier = "Apache-2.0"
@@ -0,0 +1,8 @@
1
+ <!--
2
+ SPDX-FileCopyrightText: 2026 cpdocs developers
3
+ SPDX-License-Identifier: Apache-2.0
4
+ -->
5
+ # {{ project }} Python API
6
+
7
+ The Python API of cpdocs {{ version }}. The command line is documented in the
8
+ [project documentation](projectdocs:reference/cli/).
@@ -0,0 +1,19 @@
1
+ # SPDX-FileCopyrightText: 2026 cpdocs developers
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ contract: 1
4
+
5
+ build:
6
+ describe:
7
+ - ["{python}", -m, cpdocs, manifest, python, --request, "{request}",
8
+ --package, cpdocs, --source, src/cpdocs]
9
+
10
+ versions:
11
+ branches:
12
+ include: [main]
13
+ tags:
14
+ select: all
15
+ default: main
16
+ legacy: skip
17
+
18
+ site:
19
+ copyright: Copyright © cpdocs developers · Apache-2.0
@@ -0,0 +1,25 @@
1
+ <!--
2
+ SPDX-FileCopyrightText: 2026 cpdocs developers
3
+ SPDX-License-Identifier: Apache-2.0
4
+ -->
5
+ # Examples
6
+
7
+ Every directory in `examples/` is a standalone project with its own `docs/cpdocs.yml` and
8
+ ProperDocs site. The test suite builds them, and the published documentation includes each
9
+ example's site, versioned with the branches and tags of the cpdocs repository.
10
+
11
+ | Example | Shows | Site |
12
+ | --- | --- | --- |
13
+ | `basic-cpp` | one compiled C++ library | [basic-cpp](basic-cpp/) |
14
+ | `cpp-templates` | specializations, concepts, requires-clauses, SFINAE and deduction guides | [cpp-templates](cpp-templates/) |
15
+ | `cpp-features` | besa-style features and three variants; the same project through `tools/minibuild.py` | [cpp-features](cpp-features/) |
16
+ | `generated-cpp` | headers generated during the build | [generated-cpp](generated-cpp/) |
17
+ | `c-basic` | a C library | [c-basic](c-basic/) |
18
+ | `mixed` | a C++ unit and a Python unit in one project | [mixed](mixed/) |
19
+ | `python-basic` | a plain Python package, answered by `cpdocs manifest python` | [python-basic](python-basic/) |
20
+
21
+ To build the example sites locally after `properdocs build`:
22
+
23
+ ```console
24
+ uv run python tools/build_example_sites.py
25
+ ```
@@ -0,0 +1,20 @@
1
+ <!--
2
+ SPDX-FileCopyrightText: 2026 cpdocs developers
3
+ SPDX-License-Identifier: Apache-2.0
4
+ -->
5
+ # Architecture
6
+
7
+ cpdocs is a pipeline with a single boundary to the outside:
8
+
9
+ 1. **Contract.** The build system describes the project and configures each variant. cpdocs only
10
+ reads the manifests.
11
+ 2. **Extraction.** Each unit of each variant becomes an API graph: Clang for C and C++, `ast` for
12
+ Python, rustdoc JSON for Rust.
13
+ 3. **Merge.** The graphs of all units of a variant are combined; the variant graphs are then merged
14
+ so that every entity records the variants it exists in.
15
+ 4. **Rendering.** The merged graph becomes a standalone HTML site. Versions are rendered
16
+ independently and joined by `versions.json`.
17
+
18
+ The API graph, @apidocs::cpdocs.model.ApiGraph, is the only interface between the stages; the
19
+ whole pipeline for one ref is @apidocs::cpdocs.build.build_graph. Adding a language means adding an
20
+ extractor that produces it; adding a build system means implementing the contract.
@@ -0,0 +1,17 @@
1
+ <!--
2
+ SPDX-FileCopyrightText: 2026 cpdocs developers
3
+ SPDX-License-Identifier: Apache-2.0
4
+ -->
5
+ # Why the build system owns variants
6
+
7
+ An API that depends on build features exists in several forms. The reliable way to see each form
8
+ is to configure the project the way a user would and read what the compiler then sees.
9
+
10
+ Only the build system knows how a feature becomes a definition, an include directory or a generated
11
+ header, and that knowledge changes from release to release. cpdocs therefore asks each ref's own
12
+ build system for its variants and their commands instead of keeping a copy of that knowledge in its
13
+ configuration. An old tag is documented with the features it had, and a change of build system
14
+ does not change `cpdocs.yml`.
15
+
16
+ What remains in `cpdocs.yml` is publishing policy: which refs to build, how many variants each
17
+ gets, and what the site looks like.
@@ -0,0 +1,50 @@
1
+ <!--
2
+ SPDX-FileCopyrightText: 2026 cpdocs developers
3
+ SPDX-License-Identifier: Apache-2.0
4
+ -->
5
+ # Build the documentation in CI
6
+
7
+ cpdocs runs from a fresh checkout: it configures every variant of every selected ref itself. The
8
+ checkout needs the history, tags and branches it documents, and the job needs Clang for C and C++
9
+ units.
10
+
11
+ ## GitHub Actions
12
+
13
+ ```yaml
14
+ - uses: actions/checkout@v4
15
+ with:
16
+ fetch-depth: 0
17
+ - run: pip install 'cpdocs[properdocs]' mkdocs-materialx
18
+ - run: properdocs build
19
+ - uses: actions/upload-pages-artifact@v3
20
+ with:
21
+ path: build/site
22
+ ```
23
+
24
+ ## GitLab CI
25
+
26
+ ```yaml
27
+ docs:
28
+ variables:
29
+ GIT_DEPTH: 0
30
+ script:
31
+ - git fetch --tags origin '+refs/heads/*:refs/remotes/origin/*'
32
+ - pip install 'cpdocs[properdocs]' mkdocs-materialx
33
+ - properdocs build
34
+ artifacts:
35
+ paths: [build/site]
36
+ ```
37
+
38
+ Branch names are matched against local and remote-tracking branches. The branch being built is
39
+ read from `CI_COMMIT_BRANCH`, `GITHUB_HEAD_REF` or `GITHUB_REF_NAME`, so the detached checkout of a
40
+ CI job is documented as its working tree. `CPDOCS_CURRENT_BRANCH` overrides all three.
41
+
42
+ A project may live in a subdirectory of its repository. Every ref is then checked out as a whole
43
+ and the same subdirectory is documented; refs in which it does not exist are skipped. The examples
44
+ in the cpdocs repository are published this way, with the branches and tags of cpdocs.
45
+
46
+ A build system that runs cpdocs itself passes its own build directory:
47
+
48
+ ```console
49
+ cpdocs versions --output "$BUILD_DIR"
50
+ ```
@@ -0,0 +1,19 @@
1
+ <!--
2
+ SPDX-FileCopyrightText: 2026 cpdocs developers
3
+ SPDX-License-Identifier: Apache-2.0
4
+ -->
5
+ # Document generated headers
6
+
7
+ Headers produced during the build are listed as `GENERATED` API roots, and the targets that
8
+ produce them as `DEPENDS`:
9
+
10
+ ```cmake
11
+ cpdocs_api(UNIT acme LANGUAGE cpp TARGET acme_generated
12
+ API include GENERATED ${GENERATED_INCLUDE} DEPENDS generate-api-header)
13
+ ```
14
+
15
+ The adapter's `cpdocs-prepare` target builds the `DEPENDS` targets before it writes the variant
16
+ manifest, so the headers exist when Clang reads them. Generated files are rendered like any other
17
+ source file and marked as generated, since they have no location in the repository.
18
+
19
+ The complete example is `examples/generated-cpp`.
@@ -0,0 +1,40 @@
1
+ <!--
2
+ SPDX-FileCopyrightText: 2026 cpdocs developers
3
+ SPDX-License-Identifier: Apache-2.0
4
+ -->
5
+ # Use a build system other than CMake
6
+
7
+ cpdocs talks to a build system only through the [contract](../reference/contract.md). A build
8
+ system supports cpdocs by answering two requests:
9
+
10
+ 1. **describe**: write the project name, feature axes, units and variants, with the commands that
11
+ configure each variant;
12
+ 2. **variant**: write, per unit, the API roots and the options needed to parse them.
13
+
14
+ `examples/cpp-features/tools/minibuild.py` is a complete implementation in about seventy lines of
15
+ Python. Its configuration names it as the describe command:
16
+
17
+ ```yaml
18
+ contract: 1
19
+ build:
20
+ describe:
21
+ - ["{python}", tools/minibuild.py, "{request}"]
22
+ ```
23
+
24
+ The test suite checks that it produces the same API reference as the CMake build of the same
25
+ project.
26
+
27
+ ## Plain Python packages
28
+
29
+ A package built with a standard backend such as hatchling needs no configuration step. cpdocs' own
30
+ helper answers the requests for it:
31
+
32
+ ```yaml
33
+ contract: 1
34
+ build:
35
+ describe:
36
+ - ["{python}", -m, cpdocs, manifest, python, --request, "{request}",
37
+ --package, dice, --source, src/dice]
38
+ ```
39
+
40
+ It reads the project name and version from `pyproject.toml` and documents one `default` variant.
@@ -0,0 +1,23 @@
1
+ <!--
2
+ SPDX-FileCopyrightText: 2026 cpdocs developers
3
+ SPDX-License-Identifier: Apache-2.0
4
+ -->
5
+ # Mount the API in a ProperDocs site
6
+
7
+ The project website lives in `docs/web`; the plugin builds the versioned API and mounts it:
8
+
9
+ ```yaml
10
+ docs_dir: docs/web
11
+
12
+ plugins:
13
+ - search
14
+ - cpdocs:
15
+ mount: reference/api
16
+ ```
17
+
18
+ The plugin options and their defaults are `config: docs/cpdocs.yml`, `output: build` and
19
+ `mount: reference/api`. `properdocs serve` rebuilds the API when a file tracked by Git changes.
20
+
21
+ Pages refer to API entities with `@apidocs::demo::solve`; see
22
+ [semantic links](../reference/links.md). With `checks.broken-references: fail`, a reference to an
23
+ entity that does not exist fails the build.
@@ -0,0 +1,53 @@
1
+ <!--
2
+ SPDX-FileCopyrightText: 2026 cpdocs developers
3
+ SPDX-License-Identifier: Apache-2.0
4
+ -->
5
+ # Document feature variants
6
+
7
+ A project whose API depends on build features declares the features and the variants to document
8
+ in its build system. cpdocs builds every declared variant and records, per entity, the variants in
9
+ which it exists. This guide uses CMake and the besa feature convention.
10
+
11
+ ## Declare the feature axis
12
+
13
+ ```cmake
14
+ include(cmake/feature.cmake)
15
+ set(PROJECT_FEATURES "none" CACHE STRING "Optional features: none, mpi, cuda, or all")
16
+ besa_feature(PROJECT_FEATURES VALUES "mpi;cuda" DESCRIPTION "Optional solver features")
17
+
18
+ if(PROJECT_FEATURES_MPI)
19
+ target_compile_definitions(demo INTERFACE DEMO_HAVE_MPI=1)
20
+ endif()
21
+ ```
22
+
23
+ The mapping from a feature to a compile definition stays in the build system; cpdocs never sees it.
24
+
25
+ ## Declare the variants
26
+
27
+ ```cmake
28
+ if(COMMAND cpdocs_api)
29
+ cpdocs_features(PROJECT_FEATURES)
30
+ cpdocs_variant(serial PRIMARY PROJECT_FEATURES none)
31
+ cpdocs_variant(mpi PROJECT_FEATURES mpi)
32
+ cpdocs_variant(full PROJECT_FEATURES all)
33
+ cpdocs_api(UNIT demo LANGUAGE cpp TARGET demo API include)
34
+ endif()
35
+ ```
36
+
37
+ `cpdocs_features` takes the valid values from `PROJECT_FEATURES_ARRAY`, which `besa_feature`
38
+ sets. The primary variant is the one built when only one variant is wanted.
39
+
40
+ ## Build fewer variants for branches
41
+
42
+ Which refs build all variants is publishing policy, set in `docs/cpdocs.yml`:
43
+
44
+ ```yaml
45
+ versions:
46
+ branches:
47
+ include: [main]
48
+ variants: primary
49
+ tags:
50
+ variants: all
51
+ ```
52
+
53
+ The complete example is `examples/cpp-features`.
@@ -0,0 +1,21 @@
1
+ <!--
2
+ SPDX-FileCopyrightText: 2026 cpdocs developers
3
+ SPDX-License-Identifier: Apache-2.0
4
+ -->
5
+ # cpdocs
6
+
7
+ cpdocs generates semantic, versioned API documentation for C, C++, Python and Rust projects. It
8
+ reads declarations the way the compiler or interpreter sees them, merges every documented variant
9
+ of the API into one reference, and publishes one directory per Git branch or tag.
10
+
11
+ cpdocs does not know how a project is built. It asks the project's build system, through a small
12
+ [contract](reference/contract.md), which variants exist and how to read each of them. CMake support
13
+ ships with cpdocs; any other build system implements the same two JSON manifests.
14
+
15
+ ```console
16
+ cpdocs build # document the working tree
17
+ cpdocs versions # document the configured branches and tags
18
+ properdocs build # build the project website with the API mounted
19
+ ```
20
+
21
+ Start with the [tutorial](tutorials/first-reference.md).