primarysource 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 (490) hide show
  1. primarysource-0.1.0/.gitattributes +3 -0
  2. primarysource-0.1.0/.github/workflows/release.yml +68 -0
  3. primarysource-0.1.0/.gitignore +69 -0
  4. primarysource-0.1.0/AGENTS.md +41 -0
  5. primarysource-0.1.0/LICENSE +203 -0
  6. primarysource-0.1.0/NOTICE +51 -0
  7. primarysource-0.1.0/PKG-INFO +118 -0
  8. primarysource-0.1.0/PLAN.md +310 -0
  9. primarysource-0.1.0/README.md +47 -0
  10. primarysource-0.1.0/ROADMAP.md +490 -0
  11. primarysource-0.1.0/conftest.py +1 -0
  12. primarysource-0.1.0/docs/bbf.md +114 -0
  13. primarysource-0.1.0/docs/c2sp.md +85 -0
  14. primarysource-0.1.0/docs/cavp.md +134 -0
  15. primarysource-0.1.0/docs/cve-sources.md +185 -0
  16. primarysource-0.1.0/docs/cve.md +122 -0
  17. primarysource-0.1.0/docs/debpolicy.md +64 -0
  18. primarysource-0.1.0/docs/draft.md +120 -0
  19. primarysource-0.1.0/docs/ecma.md +85 -0
  20. primarysource-0.1.0/docs/gitdocs.md +66 -0
  21. primarysource-0.1.0/docs/iana.md +106 -0
  22. primarysource-0.1.0/docs/ieee.md +247 -0
  23. primarysource-0.1.0/docs/iso.md +128 -0
  24. primarysource-0.1.0/docs/kconfig.md +53 -0
  25. primarysource-0.1.0/docs/pep.md +55 -0
  26. primarysource-0.1.0/docs/pkgdocs.md +60 -0
  27. primarysource-0.1.0/docs/pms.md +63 -0
  28. primarysource-0.1.0/docs/rpmdocs.md +52 -0
  29. primarysource-0.1.0/docs/usbids.md +210 -0
  30. primarysource-0.1.0/docs/validation.md +125 -0
  31. primarysource-0.1.0/docs/zim/CHANGELOG.md +69 -0
  32. primarysource-0.1.0/docs/zim/PLAN.md +139 -0
  33. primarysource-0.1.0/docs/zim/README.md +182 -0
  34. primarysource-0.1.0/docs/zim/future-docs-by-purl.md +65 -0
  35. primarysource-0.1.0/docs/zim/future-formats-and-sources.md +57 -0
  36. primarysource-0.1.0/docs/zim/library-management.md +147 -0
  37. primarysource-0.1.0/docs/zim/on-demand-docs.md +108 -0
  38. primarysource-0.1.0/docs/zim/portfolio-entry.md +22 -0
  39. primarysource-0.1.0/docs/zim/release.md +29 -0
  40. primarysource-0.1.0/docs/zim/research-producer-and-more-zims.md +77 -0
  41. primarysource-0.1.0/docs/zim/research.md +85 -0
  42. primarysource-0.1.0/primarysource/__init__.py +5 -0
  43. primarysource-0.1.0/primarysource/bbf/__init__.py +56 -0
  44. primarysource-0.1.0/primarysource/bbf/_xml.py +63 -0
  45. primarysource-0.1.0/primarysource/bbf/catalogue.json +777 -0
  46. primarysource-0.1.0/primarysource/bbf/catalogue.py +137 -0
  47. primarysource-0.1.0/primarysource/bbf/cli.py +79 -0
  48. primarysource-0.1.0/primarysource/bbf/datamodel.py +281 -0
  49. primarysource-0.1.0/primarysource/bbf/importer.py +151 -0
  50. primarysource-0.1.0/primarysource/bbf/library.py +380 -0
  51. primarysource-0.1.0/primarysource/bbf/server.py +72 -0
  52. primarysource-0.1.0/primarysource/budget.py +63 -0
  53. primarysource-0.1.0/primarysource/c2sp/__init__.py +53 -0
  54. primarysource-0.1.0/primarysource/c2sp/_fetch.py +5 -0
  55. primarysource-0.1.0/primarysource/c2sp/catalogue.json +231 -0
  56. primarysource-0.1.0/primarysource/c2sp/catalogue.py +95 -0
  57. primarysource-0.1.0/primarysource/c2sp/cli.py +62 -0
  58. primarysource-0.1.0/primarysource/c2sp/importer.py +90 -0
  59. primarysource-0.1.0/primarysource/c2sp/library.py +309 -0
  60. primarysource-0.1.0/primarysource/c2sp/markdown.py +31 -0
  61. primarysource-0.1.0/primarysource/c2sp/server.py +68 -0
  62. primarysource-0.1.0/primarysource/cavp/__init__.py +42 -0
  63. primarysource-0.1.0/primarysource/cavp/cli.py +84 -0
  64. primarysource-0.1.0/primarysource/cavp/data/vectors.toml +47 -0
  65. primarysource-0.1.0/primarysource/cavp/importer.py +156 -0
  66. primarysource-0.1.0/primarysource/cavp/model.py +279 -0
  67. primarysource-0.1.0/primarysource/cavp/parse.py +269 -0
  68. primarysource-0.1.0/primarysource/cavp/paths.py +17 -0
  69. primarysource-0.1.0/primarysource/cavp/server.py +67 -0
  70. primarysource-0.1.0/primarysource/cavp/tools.py +169 -0
  71. primarysource-0.1.0/primarysource/cli.py +107 -0
  72. primarysource-0.1.0/primarysource/cursor.py +82 -0
  73. primarysource-0.1.0/primarysource/cve/__init__.py +5 -0
  74. primarysource-0.1.0/primarysource/cve/__main__.py +6 -0
  75. primarysource-0.1.0/primarysource/cve/cli.py +144 -0
  76. primarysource-0.1.0/primarysource/cve/collection.py +20 -0
  77. primarysource-0.1.0/primarysource/cve/config.py +58 -0
  78. primarysource-0.1.0/primarysource/cve/errors.py +16 -0
  79. primarysource-0.1.0/primarysource/cve/kernel.py +232 -0
  80. primarysource-0.1.0/primarysource/cve/mcp.py +139 -0
  81. primarysource-0.1.0/primarysource/cve/parse.py +318 -0
  82. primarysource-0.1.0/primarysource/cve/py.typed +0 -0
  83. primarysource-0.1.0/primarysource/cve/service.py +760 -0
  84. primarysource-0.1.0/primarysource/cve/store.py +214 -0
  85. primarysource-0.1.0/primarysource/cve/sync.py +438 -0
  86. primarysource-0.1.0/primarysource/cve/views.py +304 -0
  87. primarysource-0.1.0/primarysource/debpolicy/__init__.py +16 -0
  88. primarysource-0.1.0/primarysource/debpolicy/catalogue.py +263 -0
  89. primarysource-0.1.0/primarysource/debpolicy/cli.py +12 -0
  90. primarysource-0.1.0/primarysource/debpolicy/server.py +11 -0
  91. primarysource-0.1.0/primarysource/draft/__init__.py +11 -0
  92. primarysource-0.1.0/primarysource/draft/catalogue.py +117 -0
  93. primarysource-0.1.0/primarysource/draft/cli.py +149 -0
  94. primarysource-0.1.0/primarysource/draft/collection.py +21 -0
  95. primarysource-0.1.0/primarysource/draft/datatracker.py +158 -0
  96. primarysource-0.1.0/primarysource/draft/importer.py +163 -0
  97. primarysource-0.1.0/primarysource/draft/licence.py +89 -0
  98. primarysource-0.1.0/primarysource/draft/names.py +64 -0
  99. primarysource-0.1.0/primarysource/draft/net.py +133 -0
  100. primarysource-0.1.0/primarysource/draft/segment.py +192 -0
  101. primarysource-0.1.0/primarysource/draft/server.py +91 -0
  102. primarysource-0.1.0/primarysource/draft/status.py +146 -0
  103. primarysource-0.1.0/primarysource/draft/store.py +199 -0
  104. primarysource-0.1.0/primarysource/draft/tracked.json +104 -0
  105. primarysource-0.1.0/primarysource/draft/views.py +430 -0
  106. primarysource-0.1.0/primarysource/draft/xmlmeta.py +74 -0
  107. primarysource-0.1.0/primarysource/ecma/__init__.py +52 -0
  108. primarysource-0.1.0/primarysource/ecma/_pdf.py +143 -0
  109. primarysource-0.1.0/primarysource/ecma/catalogue.json +22 -0
  110. primarysource-0.1.0/primarysource/ecma/catalogue.py +100 -0
  111. primarysource-0.1.0/primarysource/ecma/cli.py +67 -0
  112. primarysource-0.1.0/primarysource/ecma/identify.py +25 -0
  113. primarysource-0.1.0/primarysource/ecma/importer.py +108 -0
  114. primarysource-0.1.0/primarysource/ecma/library.py +240 -0
  115. primarysource-0.1.0/primarysource/ecma/server.py +67 -0
  116. primarysource-0.1.0/primarysource/errors.py +29 -0
  117. primarysource-0.1.0/primarysource/fetch.py +360 -0
  118. primarysource-0.1.0/primarysource/fsutil.py +150 -0
  119. primarysource-0.1.0/primarysource/gitdocs/__init__.py +15 -0
  120. primarysource-0.1.0/primarysource/gitdocs/catalogue.py +116 -0
  121. primarysource-0.1.0/primarysource/gitdocs/cli.py +12 -0
  122. primarysource-0.1.0/primarysource/gitdocs/server.py +8 -0
  123. primarysource-0.1.0/primarysource/home.py +65 -0
  124. primarysource-0.1.0/primarysource/iana/__init__.py +32 -0
  125. primarysource-0.1.0/primarysource/iana/catalogue.json +244 -0
  126. primarysource-0.1.0/primarysource/iana/catalogue.py +69 -0
  127. primarysource-0.1.0/primarysource/iana/cli.py +69 -0
  128. primarysource-0.1.0/primarysource/iana/importer.py +157 -0
  129. primarysource-0.1.0/primarysource/iana/model.py +325 -0
  130. primarysource-0.1.0/primarysource/iana/reader.py +315 -0
  131. primarysource-0.1.0/primarysource/iana/server.py +67 -0
  132. primarysource-0.1.0/primarysource/iana/store.py +83 -0
  133. primarysource-0.1.0/primarysource/iana/xmlsafe.py +47 -0
  134. primarysource-0.1.0/primarysource/identify.py +186 -0
  135. primarysource-0.1.0/primarysource/ieee/__init__.py +58 -0
  136. primarysource-0.1.0/primarysource/ieee/_html.py +49 -0
  137. primarysource-0.1.0/primarysource/ieee/catalogue.json +74 -0
  138. primarysource-0.1.0/primarysource/ieee/catalogue.py +123 -0
  139. primarysource-0.1.0/primarysource/ieee/cli.py +79 -0
  140. primarysource-0.1.0/primarysource/ieee/identify.py +24 -0
  141. primarysource-0.1.0/primarysource/ieee/ieee802.py +47 -0
  142. primarysource-0.1.0/primarysource/ieee/importer.py +305 -0
  143. primarysource-0.1.0/primarysource/ieee/posix.py +233 -0
  144. primarysource-0.1.0/primarysource/ieee/server.py +79 -0
  145. primarysource-0.1.0/primarysource/index.py +446 -0
  146. primarysource-0.1.0/primarysource/iso/__init__.py +51 -0
  147. primarysource-0.1.0/primarysource/iso/cli.py +98 -0
  148. primarysource-0.1.0/primarysource/iso/designation.py +95 -0
  149. primarysource-0.1.0/primarysource/iso/identify.py +100 -0
  150. primarysource-0.1.0/primarysource/iso/importer.py +224 -0
  151. primarysource-0.1.0/primarysource/iso/library.py +249 -0
  152. primarysource-0.1.0/primarysource/iso/server.py +69 -0
  153. primarysource-0.1.0/primarysource/itu/__init__.py +41 -0
  154. primarysource-0.1.0/primarysource/itu/__main__.py +8 -0
  155. primarysource-0.1.0/primarysource/itu/asn1mod.py +478 -0
  156. primarysource-0.1.0/primarysource/itu/catalog.py +472 -0
  157. primarysource-0.1.0/primarysource/itu/cli.py +445 -0
  158. primarysource-0.1.0/primarysource/itu/collection.py +20 -0
  159. primarysource-0.1.0/primarysource/itu/corpus.py +118 -0
  160. primarysource-0.1.0/primarysource/itu/errata.py +16 -0
  161. primarysource-0.1.0/primarysource/itu/formal.py +565 -0
  162. primarysource-0.1.0/primarysource/itu/identify.py +26 -0
  163. primarysource-0.1.0/primarysource/itu/index.py +490 -0
  164. primarysource-0.1.0/primarysource/itu/mcp.py +474 -0
  165. primarysource-0.1.0/primarysource/itu/py.typed +0 -0
  166. primarysource-0.1.0/primarysource/itu/sources.py +600 -0
  167. primarysource-0.1.0/primarysource/itu/text.py +609 -0
  168. primarysource-0.1.0/primarysource/kconfig/__init__.py +16 -0
  169. primarysource-0.1.0/primarysource/kconfig/catalogue.py +98 -0
  170. primarysource-0.1.0/primarysource/kconfig/cli.py +12 -0
  171. primarysource-0.1.0/primarysource/kconfig/server.py +8 -0
  172. primarysource-0.1.0/primarysource/model.py +63 -0
  173. primarysource-0.1.0/primarysource/nist/__init__.py +5 -0
  174. primarysource-0.1.0/primarysource/nist/collection.py +46 -0
  175. primarysource-0.1.0/primarysource/nist/data/acquired-nist.json +1657 -0
  176. primarysource-0.1.0/primarysource/nist/data/nist-catalog.json +12090 -0
  177. primarysource-0.1.0/primarysource/nist/data/sources.toml +1996 -0
  178. primarysource-0.1.0/primarysource/nist/identify.py +41 -0
  179. primarysource-0.1.0/primarysource/nist/ingest/__init__.py +1 -0
  180. primarysource-0.1.0/primarysource/nist/ingest/acquire_nist.py +128 -0
  181. primarysource-0.1.0/primarysource/nist/ingest/controls.py +82 -0
  182. primarysource-0.1.0/primarysource/nist/ingest/discover_nist.py +218 -0
  183. primarysource-0.1.0/primarysource/nist/ingest/extract.py +48 -0
  184. primarysource-0.1.0/primarysource/nist/ingest/fetch.py +211 -0
  185. primarysource-0.1.0/primarysource/nist/ingest/index.py +14 -0
  186. primarysource-0.1.0/primarysource/nist/ingest/oscal.py +480 -0
  187. primarysource-0.1.0/primarysource/nist/ingest/prose_layouts.py +236 -0
  188. primarysource-0.1.0/primarysource/nist/ingest/sources.py +94 -0
  189. primarysource-0.1.0/primarysource/nist/ingest/status.py +255 -0
  190. primarysource-0.1.0/primarysource/nist/models.py +7 -0
  191. primarysource-0.1.0/primarysource/nist/paths.py +33 -0
  192. primarysource-0.1.0/primarysource/nist/server/__init__.py +3 -0
  193. primarysource-0.1.0/primarysource/nist/server/corpus.py +38 -0
  194. primarysource-0.1.0/primarysource/nist/server/mcp.py +19 -0
  195. primarysource-0.1.0/primarysource/nist/server/tools.py +35 -0
  196. primarysource-0.1.0/primarysource/nist/spec.py +38 -0
  197. primarysource-0.1.0/primarysource/pdfcorpus/__init__.py +16 -0
  198. primarysource-0.1.0/primarysource/pdfcorpus/corpus.py +159 -0
  199. primarysource-0.1.0/primarysource/pdfcorpus/fts.py +175 -0
  200. primarysource-0.1.0/primarysource/pdfcorpus/index.py +70 -0
  201. primarysource-0.1.0/primarysource/pdfcorpus/models.py +30 -0
  202. primarysource-0.1.0/primarysource/pdfcorpus/server.py +96 -0
  203. primarysource-0.1.0/primarysource/pdfcorpus/spec.py +37 -0
  204. primarysource-0.1.0/primarysource/pdfcorpus/split.py +391 -0
  205. primarysource-0.1.0/primarysource/pdfcorpus/tools.py +244 -0
  206. primarysource-0.1.0/primarysource/pep/__init__.py +15 -0
  207. primarysource-0.1.0/primarysource/pep/catalogue.py +191 -0
  208. primarysource-0.1.0/primarysource/pep/cli.py +12 -0
  209. primarysource-0.1.0/primarysource/pep/server.py +8 -0
  210. primarysource-0.1.0/primarysource/pkgdocs/__init__.py +19 -0
  211. primarysource-0.1.0/primarysource/pkgdocs/fetch.py +356 -0
  212. primarysource-0.1.0/primarysource/pkgdocs/index.py +89 -0
  213. primarysource-0.1.0/primarysource/pkgdocs/model.py +76 -0
  214. primarysource-0.1.0/primarysource/pkgdocs/readers/__init__.py +1 -0
  215. primarysource-0.1.0/primarysource/pkgdocs/readers/_common.py +134 -0
  216. primarysource-0.1.0/primarysource/pkgdocs/readers/asciidoc.py +160 -0
  217. primarysource-0.1.0/primarysource/pkgdocs/readers/latex.py +315 -0
  218. primarysource-0.1.0/primarysource/pkgdocs/readers/markdown.py +173 -0
  219. primarysource-0.1.0/primarysource/pkgdocs/readers/pod.py +132 -0
  220. primarysource-0.1.0/primarysource/pkgdocs/readers/rst.py +239 -0
  221. primarysource-0.1.0/primarysource/pkgdocs/readers/scdoc.py +108 -0
  222. primarysource-0.1.0/primarysource/pkgdocs/runtime.py +552 -0
  223. primarysource-0.1.0/primarysource/pkgdocs/serving.py +158 -0
  224. primarysource-0.1.0/primarysource/pkgdocs/store.py +167 -0
  225. primarysource-0.1.0/primarysource/pms/__init__.py +16 -0
  226. primarysource-0.1.0/primarysource/pms/catalogue.py +88 -0
  227. primarysource-0.1.0/primarysource/pms/cli.py +12 -0
  228. primarysource-0.1.0/primarysource/pms/server.py +8 -0
  229. primarysource-0.1.0/primarysource/py.typed +0 -0
  230. primarysource-0.1.0/primarysource/readers/__init__.py +10 -0
  231. primarysource-0.1.0/primarysource/readers/bookmarks.py +192 -0
  232. primarysource-0.1.0/primarysource/readers/html.py +1312 -0
  233. primarysource-0.1.0/primarysource/readers/markdown.py +189 -0
  234. primarysource-0.1.0/primarysource/readers/pdf.py +187 -0
  235. primarysource-0.1.0/primarysource/readers/xml.py +230 -0
  236. primarysource-0.1.0/primarysource/refs.py +87 -0
  237. primarysource-0.1.0/primarysource/registry.py +161 -0
  238. primarysource-0.1.0/primarysource/render.py +49 -0
  239. primarysource-0.1.0/primarysource/rfc/__init__.py +3 -0
  240. primarysource-0.1.0/primarysource/rfc/__main__.py +6 -0
  241. primarysource-0.1.0/primarysource/rfc/cite.py +204 -0
  242. primarysource-0.1.0/primarysource/rfc/cli.py +903 -0
  243. primarysource-0.1.0/primarysource/rfc/collection.py +19 -0
  244. primarysource-0.1.0/primarysource/rfc/config.py +138 -0
  245. primarysource-0.1.0/primarysource/rfc/errata.py +203 -0
  246. primarysource-0.1.0/primarysource/rfc/fsutil.py +82 -0
  247. primarysource-0.1.0/primarysource/rfc/graph.py +213 -0
  248. primarysource-0.1.0/primarysource/rfc/index/__init__.py +1 -0
  249. primarysource-0.1.0/primarysource/rfc/index/chunker.py +281 -0
  250. primarysource-0.1.0/primarysource/rfc/index/embed.py +166 -0
  251. primarysource-0.1.0/primarysource/rfc/index/hybrid.py +305 -0
  252. primarysource-0.1.0/primarysource/rfc/index/lexical.py +223 -0
  253. primarysource-0.1.0/primarysource/rfc/index/rfcxml.py +673 -0
  254. primarysource-0.1.0/primarysource/rfc/index/search.py +508 -0
  255. primarysource-0.1.0/primarysource/rfc/index/txtseg.py +585 -0
  256. primarysource-0.1.0/primarysource/rfc/library.py +294 -0
  257. primarysource-0.1.0/primarysource/rfc/mcp/__init__.py +1 -0
  258. primarysource-0.1.0/primarysource/rfc/mcp/server.py +381 -0
  259. primarysource-0.1.0/primarysource/rfc/packs/__init__.py +1 -0
  260. primarysource-0.1.0/primarysource/rfc/packs/builder.py +228 -0
  261. primarysource-0.1.0/primarysource/rfc/packs/collections/all-current-txt.json +10 -0
  262. primarysource-0.1.0/primarysource/rfc/packs/collections/essentials.json +19 -0
  263. primarysource-0.1.0/primarysource/rfc/packs/collections/fyi-current.json +10 -0
  264. primarysource-0.1.0/primarysource/rfc/packs/collections/standards-current.json +10 -0
  265. primarysource-0.1.0/primarysource/rfc/packs/collections/year-2025.json +10 -0
  266. primarysource-0.1.0/primarysource/rfc/packs/collections/year-2026.json +10 -0
  267. primarysource-0.1.0/primarysource/rfc/packs/collections.py +163 -0
  268. primarysource-0.1.0/primarysource/rfc/packs/docsetexport.py +163 -0
  269. primarysource-0.1.0/primarysource/rfc/packs/epub.py +159 -0
  270. primarysource-0.1.0/primarysource/rfc/packs/export.py +306 -0
  271. primarysource-0.1.0/primarysource/rfc/packs/htmlexport.py +82 -0
  272. primarysource-0.1.0/primarysource/rfc/packs/serve.py +143 -0
  273. primarysource-0.1.0/primarysource/rfc/packs/zimexport.py +171 -0
  274. primarysource-0.1.0/primarysource/rfc/query.py +466 -0
  275. primarysource-0.1.0/primarysource/rfc/subjects.py +457 -0
  276. primarysource-0.1.0/primarysource/rfc/sync/__init__.py +1 -0
  277. primarysource-0.1.0/primarysource/rfc/sync/downloader.py +132 -0
  278. primarysource-0.1.0/primarysource/rfc/sync/manifest.py +162 -0
  279. primarysource-0.1.0/primarysource/rfc/sync/scanner.py +49 -0
  280. primarysource-0.1.0/primarysource/rfc/sync/state.py +464 -0
  281. primarysource-0.1.0/primarysource/rfc/views.py +1067 -0
  282. primarysource-0.1.0/primarysource/rpmdocs/__init__.py +15 -0
  283. primarysource-0.1.0/primarysource/rpmdocs/catalogue.py +117 -0
  284. primarysource-0.1.0/primarysource/rpmdocs/cli.py +12 -0
  285. primarysource-0.1.0/primarysource/rpmdocs/server.py +8 -0
  286. primarysource-0.1.0/primarysource/scaffold.py +223 -0
  287. primarysource-0.1.0/primarysource/serve.py +75 -0
  288. primarysource-0.1.0/primarysource/settings.py +152 -0
  289. primarysource-0.1.0/primarysource/usb/__init__.py +5 -0
  290. primarysource-0.1.0/primarysource/usb/collection.py +37 -0
  291. primarysource-0.1.0/primarysource/usb/data/acquired.json +2025 -0
  292. primarysource-0.1.0/primarysource/usb/data/sources-usb.toml +852 -0
  293. primarysource-0.1.0/primarysource/usb/data/sources.toml +10 -0
  294. primarysource-0.1.0/primarysource/usb/data/usb-catalog.json +1663 -0
  295. primarysource-0.1.0/primarysource/usb/data/usb-classification.json +1986 -0
  296. primarysource-0.1.0/primarysource/usb/data/usb-corpus-build.json +608 -0
  297. primarysource-0.1.0/primarysource/usb/data/usb-pdf-choice.json +839 -0
  298. primarysource-0.1.0/primarysource/usb/data/usb-split-measure.json +1803 -0
  299. primarysource-0.1.0/primarysource/usb/ingest/__init__.py +1 -0
  300. primarysource-0.1.0/primarysource/usb/ingest/acquire.py +130 -0
  301. primarysource-0.1.0/primarysource/usb/ingest/discover_usb.py +88 -0
  302. primarysource-0.1.0/primarysource/usb/ingest/extract.py +48 -0
  303. primarysource-0.1.0/primarysource/usb/ingest/fetch.py +197 -0
  304. primarysource-0.1.0/primarysource/usb/ingest/index.py +14 -0
  305. primarysource-0.1.0/primarysource/usb/ingest/sources.py +85 -0
  306. primarysource-0.1.0/primarysource/usb/models.py +7 -0
  307. primarysource-0.1.0/primarysource/usb/paths.py +33 -0
  308. primarysource-0.1.0/primarysource/usb/server/__init__.py +3 -0
  309. primarysource-0.1.0/primarysource/usb/server/corpus.py +38 -0
  310. primarysource-0.1.0/primarysource/usb/server/mcp.py +19 -0
  311. primarysource-0.1.0/primarysource/usb/server/tools.py +35 -0
  312. primarysource-0.1.0/primarysource/usb/spec.py +20 -0
  313. primarysource-0.1.0/primarysource/usbids/__init__.py +56 -0
  314. primarysource-0.1.0/primarysource/usbids/cli.py +65 -0
  315. primarysource-0.1.0/primarysource/usbids/importer.py +272 -0
  316. primarysource-0.1.0/primarysource/usbids/parse.py +283 -0
  317. primarysource-0.1.0/primarysource/usbids/server.py +55 -0
  318. primarysource-0.1.0/primarysource/usbids/store.py +80 -0
  319. primarysource-0.1.0/primarysource/usbids/tools.py +174 -0
  320. primarysource-0.1.0/primarysource/zim/__init__.py +5 -0
  321. primarysource-0.1.0/primarysource/zim/__main__.py +8 -0
  322. primarysource-0.1.0/primarysource/zim/_libzim.py +37 -0
  323. primarysource-0.1.0/primarysource/zim/catalog.py +594 -0
  324. primarysource-0.1.0/primarysource/zim/cli.py +555 -0
  325. primarysource-0.1.0/primarysource/zim/collection.py +41 -0
  326. primarysource-0.1.0/primarysource/zim/errors.py +100 -0
  327. primarysource-0.1.0/primarysource/zim/groups.py +30 -0
  328. primarysource-0.1.0/primarysource/zim/library.py +668 -0
  329. primarysource-0.1.0/primarysource/zim/manage.py +636 -0
  330. primarysource-0.1.0/primarysource/zim/markdown.py +1247 -0
  331. primarysource-0.1.0/primarysource/zim/mcp.py +201 -0
  332. primarysource-0.1.0/primarysource/zim/purl.py +130 -0
  333. primarysource-0.1.0/primarysource/zim/py.typed +0 -0
  334. primarysource-0.1.0/primarysource/zim/refs.py +90 -0
  335. primarysource-0.1.0/primarysource/zim/service.py +1182 -0
  336. primarysource-0.1.0/primarysource/zim/snapshot.py +197 -0
  337. primarysource-0.1.0/primarysource/zim/sync.py +269 -0
  338. primarysource-0.1.0/primarysource/zim/views.py +230 -0
  339. primarysource-0.1.0/pyproject.toml +125 -0
  340. primarysource-0.1.0/scripts/itu_eval_blind.py +172 -0
  341. primarysource-0.1.0/scripts/itu_eval_retrieval.py +82 -0
  342. primarysource-0.1.0/scripts/itu_measure_segmentation.py +50 -0
  343. primarysource-0.1.0/scripts/rfc_make_test_fixture.py +79 -0
  344. primarysource-0.1.0/scripts/usb_build_usb_corpus.py +366 -0
  345. primarysource-0.1.0/scripts/usb_classify_usb.py +263 -0
  346. primarysource-0.1.0/scripts/usb_measure_usb.py +137 -0
  347. primarysource-0.1.0/scripts/zim_eval_retrieval.py +209 -0
  348. primarysource-0.1.0/scripts/zim_measure_conversion.py +77 -0
  349. primarysource-0.1.0/tests/bbf_fixture.py +148 -0
  350. primarysource-0.1.0/tests/c2sp_fixture.py +124 -0
  351. primarysource-0.1.0/tests/cursor_check.py +56 -0
  352. primarysource-0.1.0/tests/cve/__init__.py +0 -0
  353. primarysource-0.1.0/tests/cve/conftest.py +261 -0
  354. primarysource-0.1.0/tests/cve/test_cli_and_mcp.py +112 -0
  355. primarysource-0.1.0/tests/cve/test_contract.py +207 -0
  356. primarysource-0.1.0/tests/cve/test_home.py +51 -0
  357. primarysource-0.1.0/tests/cve/test_kernel.py +152 -0
  358. primarysource-0.1.0/tests/cve/test_parse_and_service.py +210 -0
  359. primarysource-0.1.0/tests/draft_fixture.py +285 -0
  360. primarysource-0.1.0/tests/iana_fixture.py +131 -0
  361. primarysource-0.1.0/tests/ieee_htmlfixture.py +82 -0
  362. primarysource-0.1.0/tests/ieee_posixfixture.py +112 -0
  363. primarysource-0.1.0/tests/itu/__init__.py +0 -0
  364. primarysource-0.1.0/tests/itu/test_catalog.py +329 -0
  365. primarysource-0.1.0/tests/itu/test_contract.py +241 -0
  366. primarysource-0.1.0/tests/itu/test_formal.py +403 -0
  367. primarysource-0.1.0/tests/itu/test_index_and_mcp.py +200 -0
  368. primarysource-0.1.0/tests/itu/test_license.py +80 -0
  369. primarysource-0.1.0/tests/itu/test_navigation.py +547 -0
  370. primarysource-0.1.0/tests/itu/test_sources.py +115 -0
  371. primarysource-0.1.0/tests/itu/test_text.py +100 -0
  372. primarysource-0.1.0/tests/nist/__init__.py +0 -0
  373. primarysource-0.1.0/tests/nist/ingest/__init__.py +0 -0
  374. primarysource-0.1.0/tests/nist/ingest/test_controls.py +70 -0
  375. primarysource-0.1.0/tests/nist/ingest/test_fetch_preserves_entries.py +60 -0
  376. primarysource-0.1.0/tests/nist/ingest/test_ingest_extract.py +150 -0
  377. primarysource-0.1.0/tests/nist/ingest/test_ingest_fetch.py +252 -0
  378. primarysource-0.1.0/tests/nist/ingest/test_prose_layouts.py +224 -0
  379. primarysource-0.1.0/tests/nist/oscal/__init__.py +0 -0
  380. primarysource-0.1.0/tests/nist/oscal/test_oscal_render.py +275 -0
  381. primarysource-0.1.0/tests/nist/server/__init__.py +0 -0
  382. primarysource-0.1.0/tests/nist/server/test_server.py +75 -0
  383. primarysource-0.1.0/tests/nist/test_status.py +106 -0
  384. primarysource-0.1.0/tests/pdfcorpus_fixtures/corpus/index.json +35 -0
  385. primarysource-0.1.0/tests/pdfcorpus_fixtures/corpus/synth-a.txt +15 -0
  386. primarysource-0.1.0/tests/pdfcorpus_fixtures/corpus/synth-b.txt +7 -0
  387. primarysource-0.1.0/tests/pdffixture.py +80 -0
  388. primarysource-0.1.0/tests/pkgdocs_fixture.py +132 -0
  389. primarysource-0.1.0/tests/rfc/conftest.py +43 -0
  390. primarysource-0.1.0/tests/rfc/fixtures/library/README.md +3 -0
  391. primarysource-0.1.0/tests/rfc/fixtures/library/errata.json +1997 -0
  392. primarysource-0.1.0/tests/rfc/fixtures/library/meta/rfc-index.xml +695 -0
  393. primarysource-0.1.0/tests/rfc/fixtures/library/mirror/rfc/rfc2119.txt +171 -0
  394. primarysource-0.1.0/tests/rfc/fixtures/library/mirror/rfc/rfc5234.txt +899 -0
  395. primarysource-0.1.0/tests/rfc/fixtures/library/mirror/rfc/rfc7405.txt +227 -0
  396. primarysource-0.1.0/tests/rfc/fixtures/library/mirror/rfc/rfc768.txt +174 -0
  397. primarysource-0.1.0/tests/rfc/fixtures/library/mirror/rfc/rfc8174.txt +227 -0
  398. primarysource-0.1.0/tests/rfc/fixtures/library/mirror/rfc/rfc8651.txt +577 -0
  399. primarysource-0.1.0/tests/rfc/fixtures/library/mirror/rfc/rfc8651.xml +973 -0
  400. primarysource-0.1.0/tests/rfc/test_features.py +40 -0
  401. primarysource-0.1.0/tests/rfc/test_lexical.py +48 -0
  402. primarysource-0.1.0/tests/rfc/test_library.py +203 -0
  403. primarysource-0.1.0/tests/rfc/test_mcp_contract_rfc.py +100 -0
  404. primarysource-0.1.0/tests/rfc/test_shared_server.py +380 -0
  405. primarysource-0.1.0/tests/rfc/test_txtseg_cascade.py +56 -0
  406. primarysource-0.1.0/tests/rfc/test_txtseg_directives.py +142 -0
  407. primarysource-0.1.0/tests/rfc/test_txtseg_titles_depth_appendix.py +170 -0
  408. primarysource-0.1.0/tests/test_bbf.py +469 -0
  409. primarysource-0.1.0/tests/test_budget.py +53 -0
  410. primarysource-0.1.0/tests/test_c2sp.py +270 -0
  411. primarysource-0.1.0/tests/test_cavp_parse.py +249 -0
  412. primarysource-0.1.0/tests/test_cavp_serving.py +238 -0
  413. primarysource-0.1.0/tests/test_cli.py +85 -0
  414. primarysource-0.1.0/tests/test_draft_basics.py +216 -0
  415. primarysource-0.1.0/tests/test_draft_importer.py +320 -0
  416. primarysource-0.1.0/tests/test_draft_segment.py +121 -0
  417. primarysource-0.1.0/tests/test_draft_serving.py +175 -0
  418. primarysource-0.1.0/tests/test_draft_views.py +265 -0
  419. primarysource-0.1.0/tests/test_ecma.py +266 -0
  420. primarysource-0.1.0/tests/test_extras_rule.py +186 -0
  421. primarysource-0.1.0/tests/test_fetch.py +263 -0
  422. primarysource-0.1.0/tests/test_fsutil.py +89 -0
  423. primarysource-0.1.0/tests/test_iana_importer.py +158 -0
  424. primarysource-0.1.0/tests/test_iana_reading.py +253 -0
  425. primarysource-0.1.0/tests/test_iana_xml_model.py +141 -0
  426. primarysource-0.1.0/tests/test_identify.py +204 -0
  427. primarysource-0.1.0/tests/test_ieee_collections.py +145 -0
  428. primarysource-0.1.0/tests/test_ieee_importer.py +178 -0
  429. primarysource-0.1.0/tests/test_ieee_posix.py +162 -0
  430. primarysource-0.1.0/tests/test_ieee_serving.py +59 -0
  431. primarysource-0.1.0/tests/test_index.py +395 -0
  432. primarysource-0.1.0/tests/test_iso.py +273 -0
  433. primarysource-0.1.0/tests/test_mcp_contract.py +315 -0
  434. primarysource-0.1.0/tests/test_model_render_home.py +129 -0
  435. primarysource-0.1.0/tests/test_pdfcorpus.py +560 -0
  436. primarysource-0.1.0/tests/test_pdfcorpus_split.py +124 -0
  437. primarysource-0.1.0/tests/test_pkgdocs_asciidoc.py +138 -0
  438. primarysource-0.1.0/tests/test_pkgdocs_collections.py +412 -0
  439. primarysource-0.1.0/tests/test_pkgdocs_fetch.py +182 -0
  440. primarysource-0.1.0/tests/test_pkgdocs_latex.py +135 -0
  441. primarysource-0.1.0/tests/test_pkgdocs_markdown_pod.py +221 -0
  442. primarysource-0.1.0/tests/test_pkgdocs_rst.py +129 -0
  443. primarysource-0.1.0/tests/test_pkgdocs_runtime.py +331 -0
  444. primarysource-0.1.0/tests/test_pkgdocs_serving.py +138 -0
  445. primarysource-0.1.0/tests/test_readers_html_markdown.py +321 -0
  446. primarysource-0.1.0/tests/test_readers_html_regions.py +381 -0
  447. primarysource-0.1.0/tests/test_readers_html_structure.py +261 -0
  448. primarysource-0.1.0/tests/test_readers_markdown.py +76 -0
  449. primarysource-0.1.0/tests/test_readers_pdf.py +147 -0
  450. primarysource-0.1.0/tests/test_readers_shims.py +26 -0
  451. primarysource-0.1.0/tests/test_readers_xml.py +157 -0
  452. primarysource-0.1.0/tests/test_refs.py +66 -0
  453. primarysource-0.1.0/tests/test_registry.py +114 -0
  454. primarysource-0.1.0/tests/test_settings.py +74 -0
  455. primarysource-0.1.0/tests/test_usbids_importer.py +179 -0
  456. primarysource-0.1.0/tests/test_usbids_parse.py +162 -0
  457. primarysource-0.1.0/tests/test_usbids_tools.py +208 -0
  458. primarysource-0.1.0/tests/usb/__init__.py +0 -0
  459. primarysource-0.1.0/tests/usb/acquire/__init__.py +0 -0
  460. primarysource-0.1.0/tests/usb/acquire/test_acquire.py +44 -0
  461. primarysource-0.1.0/tests/usb/ingest/__init__.py +0 -0
  462. primarysource-0.1.0/tests/usb/ingest/test_ingest_extract.py +556 -0
  463. primarysource-0.1.0/tests/usb/ingest/test_ingest_fetch.py +252 -0
  464. primarysource-0.1.0/tests/usb/server/__init__.py +0 -0
  465. primarysource-0.1.0/tests/usb/server/test_server.py +62 -0
  466. primarysource-0.1.0/tests/usbids_fixture.py +82 -0
  467. primarysource-0.1.0/tests/zim/__init__.py +0 -0
  468. primarysource-0.1.0/tests/zim/conftest.py +5 -0
  469. primarysource-0.1.0/tests/zim/test_catalog.py +429 -0
  470. primarysource-0.1.0/tests/zim/test_catalog_hardening.py +370 -0
  471. primarysource-0.1.0/tests/zim/test_cli_and_mcp.py +181 -0
  472. primarysource-0.1.0/tests/zim/test_contract.py +191 -0
  473. primarysource-0.1.0/tests/zim/test_converter_structure.py +261 -0
  474. primarysource-0.1.0/tests/zim/test_hardening.py +381 -0
  475. primarysource-0.1.0/tests/zim/test_license.py +68 -0
  476. primarysource-0.1.0/tests/zim/test_manage.py +356 -0
  477. primarysource-0.1.0/tests/zim/test_manage_safety.py +436 -0
  478. primarysource-0.1.0/tests/zim/test_markdown.py +215 -0
  479. primarysource-0.1.0/tests/zim/test_packaging.py +47 -0
  480. primarysource-0.1.0/tests/zim/test_refs_and_library.py +195 -0
  481. primarysource-0.1.0/tests/zim/test_regions.py +381 -0
  482. primarysource-0.1.0/tests/zim/test_roadmap_rows.py +104 -0
  483. primarysource-0.1.0/tests/zim/test_service.py +547 -0
  484. primarysource-0.1.0/tests/zim/test_snapshot.py +360 -0
  485. primarysource-0.1.0/tests/zim/test_sync.py +419 -0
  486. primarysource-0.1.0/tests/zim/test_usability_fixes.py +283 -0
  487. primarysource-0.1.0/tests/zim/test_versions.py +373 -0
  488. primarysource-0.1.0/tests/zimfixture.py +339 -0
  489. primarysource-0.1.0/tools/ieee_import_posix.py +62 -0
  490. primarysource-0.1.0/uv.lock +1668 -0
@@ -0,0 +1,3 @@
1
+ # RFC fixtures are byte-exact copies (sha256s, line numbers, form feeds):
2
+ # never convert their line endings.
3
+ tests/rfc/fixtures/** -text
@@ -0,0 +1,68 @@
1
+ name: release
2
+
3
+ # Tag vX.Y.Z (matching primarysource/__init__.py __version__) -> build, test the built wheel, publish to PyPI.
4
+ # "Run workflow" by hand -> TestPyPI. Publishing uses PyPI trusted publishing (OIDC, no API tokens).
5
+ # One-time setup on pypi.org / test.pypi.org: add a (pending) trusted publisher for owner b1tninja-labs,
6
+ # repository primarysource, workflow "release.yml", environment "pypi" / "testpypi".
7
+
8
+ on:
9
+ push:
10
+ tags: ["v*"]
11
+ workflow_dispatch:
12
+
13
+ jobs:
14
+ build:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: astral-sh/setup-uv@v6
19
+ with:
20
+ python-version: "3.12"
21
+ - name: Tag matches __version__
22
+ if: startsWith(github.ref, 'refs/tags/v')
23
+ run: |
24
+ v=$(python -c "import re;print(re.search(r'__version__ = \"(.+?)\"', open('primarysource/__init__.py').read()).group(1))")
25
+ test "v$v" = "${GITHUB_REF_NAME}" || { echo "tag ${GITHUB_REF_NAME} != v$v"; exit 1; }
26
+ - name: Full suite from the checkout (several tests read pyproject.toml, ROADMAP.md and .gitignore)
27
+ run: uv sync --extra dev --extra rfc --extra mcp --extra itu --extra ieee --extra ecma --extra bbf && uv run pytest -q
28
+ - run: uv build
29
+ - name: Smoke-test the built wheel, not the checkout
30
+ run: |
31
+ uv venv /tmp/wheeltest
32
+ uv pip install --python /tmp/wheeltest "$(ls dist/*.whl)[rfc,mcp,itu]"
33
+ cd /tmp && /tmp/wheeltest/bin/python -I -c "import primarysource, primarysource.rfc, primarysource.nist.collection; print(primarysource.__version__)"
34
+ /tmp/wheeltest/bin/primarysource collections
35
+ - uses: actions/upload-artifact@v4
36
+ with:
37
+ name: dist
38
+ path: dist/
39
+
40
+ testpypi:
41
+ if: github.event_name == 'workflow_dispatch'
42
+ needs: build
43
+ runs-on: ubuntu-latest
44
+ environment: testpypi
45
+ permissions:
46
+ id-token: write
47
+ steps:
48
+ - uses: actions/download-artifact@v4
49
+ with:
50
+ name: dist
51
+ path: dist/
52
+ - uses: pypa/gh-action-pypi-publish@release/v1
53
+ with:
54
+ repository-url: https://test.pypi.org/legacy/
55
+
56
+ pypi:
57
+ if: startsWith(github.ref, 'refs/tags/v')
58
+ needs: build
59
+ runs-on: ubuntu-latest
60
+ environment: pypi
61
+ permissions:
62
+ id-token: write
63
+ steps:
64
+ - uses: actions/download-artifact@v4
65
+ with:
66
+ name: dist
67
+ path: dist/
68
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,69 @@
1
+ # No document text lives in this repository: tests use invented text only.
2
+ .venv/
3
+ __pycache__/
4
+ *.pyc
5
+ .mypy_cache/
6
+ .pytest_cache/
7
+ .ruff_cache/
8
+ dist/
9
+ build/
10
+ *.egg-info/
11
+ .coverage
12
+ .coverage.*
13
+ htmlcov/
14
+
15
+ # Anything that could carry a corpus, by file type. A stray download is then never staged.
16
+ *.pdf
17
+ *.epub
18
+ *.doc
19
+ *.docx
20
+ *.rtf
21
+ *.zip
22
+ *.zim
23
+ # ZIM files in every spelling (the `zim` collection): a ZIM is one binary file that git history cannot take back.
24
+ # `/zim/` is anchored: the collection's own code is primarysource/zim/ and tests/zim/.
25
+ *.zim.*
26
+ *.zimaa
27
+ *.meta4
28
+ *.idx.tmp/
29
+ /zim/
30
+ zimlore-home/
31
+ .zimlore/
32
+ *.sqlite3
33
+ *.sqlite3-journal
34
+ *.db
35
+ *.db-wal
36
+ *.db-shm
37
+ *.sqlite
38
+ *.sqlite-wal
39
+ *.sqlite-shm
40
+ *.csv.gz
41
+ .cvelib/
42
+
43
+ # Captures and secrets
44
+ *.har
45
+ .env
46
+ .env.*
47
+ *.pem
48
+ *.key
49
+
50
+ # Scratch: the workspace pre-commit hook refuses these
51
+ probe_*.py
52
+ *.log
53
+ *.out
54
+ *.tmp
55
+ scratch/
56
+ tmp/
57
+
58
+ # Agent worktrees and local tool state
59
+ .claude/worktrees/
60
+ .claude/settings.local.json
61
+ .vscode/
62
+ .idea/
63
+
64
+ .DS_Store
65
+ Thumbs.db
66
+ desktop.ini
67
+
68
+ # A collection fetch target, should one ever be pointed inside the tree (itu licence test checks this)
69
+ /corpus/
@@ -0,0 +1,41 @@
1
+ # Instructions for coding agents
2
+
3
+ `primarysource` is the shared core of the citable document libraries in this workspace (`rfclibrary`, `itulibrary`,
4
+ `zimlore`, `nistlibrary`, `usblibrary`): the sectioned-document model, the ref grammar, token-budgeted paging and,
5
+ as they are built, readers, a full-text index, a CLI and an MCP server. `PLAN.md` says why and in what order;
6
+ `ROADMAP.md` says what is pinned by a test.
7
+
8
+ ## Finding work
9
+
10
+ If the person gave you a task, do that task. This project is not registered in `PORTFOLIO.md` yet, so the board
11
+ has no rows for it: with no task, ask the person.
12
+
13
+ ## Commands
14
+
15
+ ```
16
+ python -m pip install -e ".[dev]"
17
+ python -m pytest -q
18
+ python -m ruff check .
19
+ python -m ruff format --check .
20
+ python -m mypy primarysource tests
21
+ ```
22
+
23
+ Python 3.12+: `from __future__ import annotations`, `collections.abc`, `X | None`, `datetime.UTC`. `ruff format`
24
+ decides line breaks. Never run a formatter from above this directory.
25
+
26
+ ## Rules
27
+
28
+ - **No document text in the tree.** Not a PDF, not an extract, not one clause in a fixture. ITU and USB-IF text
29
+ cannot be redistributed; tests use invented text, and must pass with no corpus anywhere. One exception:
30
+ `tests/rfc/fixtures/library/`, moved in with rfclib, holds unmodified copies of six RFCs. RFCs may be
31
+ redistributed under the IETF Trust Legal Provisions, and the fixture's README says so. Add no other real text.
32
+ - **Move code here behind the tests that already pin it.** A function lifted from a library arrives with the
33
+ library's tests for it, and the library then imports it; a second copy that drifts is the problem this
34
+ repository exists to end.
35
+ - **Streams, not extraction.** A reader takes bytes or a stream and never unpacks an archive to disk.
36
+ - **An error names its remedy; an empty result means nothing matched.** Use `LibError(message, hint)`.
37
+ - **A result is text with the fixed footer** (`primarysource/render.py`). Do not add a footer key without adding it
38
+ to `FOOTER_ORDER` and to `PLAN.md` §5.
39
+ - **A new dependency arrives as an extra with the reader that needs it**, and its licence is read first.
40
+ - **`[ok]` in `ROADMAP.md` needs a named test that exists.**
41
+ - Do not edit the sibling libraries from here; adoption is a change in that library, under its own `AGENTS.md`.
@@ -0,0 +1,203 @@
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.
203
+
@@ -0,0 +1,51 @@
1
+ primarysource
2
+ Copyright 2026 Justin Capella. Licensed under the Apache License, Version 2.0 (LICENSE).
3
+
4
+ The collections moved in from the author's other libraries (rfclib, itulib, zimlore,
5
+ nistlib, usblib, cvelib and any later *lib) are the same author's original work and
6
+ are relicensed here under the Apache License 2.0, whatever licence they carried before.
7
+
8
+ Document text is not part of this software's licence
9
+ ----------------------------------------------------
10
+ primarysource ships no document text, with one exception: the test fixtures in
11
+ tests/rfc/fixtures/library are unmodified copies of a few RFCs and trimmed
12
+ copies of RFC Editor metadata, published by the IETF Trust under the IETF Trust
13
+ Legal Provisions (https://trustee.ietf.org/license-info), not under this
14
+ software's licence. RFCs may be copied and distributed in full but not modified
15
+ outside the IETF Standards Process.
16
+
17
+ Every other collection's documents are fetched by the user, under their
18
+ publishers' own terms, and are stored outside this package.
19
+
20
+ ZIM files (the `zim` collection)
21
+ --------------------------------
22
+ This repository contains no ZIM file and no text from any ZIM file. A ZIM is an archive of someone else's
23
+ content, and each one carries that content's own licence: DevDocs ZIMs archive upstream project documentation
24
+ under whatever licence each project chose, Stack Exchange ZIMs are user-contributed content under Creative
25
+ Commons terms with attribution requirements, Wikipedia is another case again. Those licences differ from each
26
+ other and from this software's. The collection therefore never ships, vendors or embeds ZIM content: files live
27
+ in the collection's home (`$PRIMARYSOURCE_HOME/zim`, or `ZIMLORE_HOME` as before; subdirectory `zim/`) on each
28
+ user's machine, fetched by the user with `primarysource zim get` or copied there, and `.gitignore` names every
29
+ way a ZIM can be spelled so that one cannot be staged by accident. `tests/zim/test_license.py` is a tripwire
30
+ against the obvious copy, not a proof against a determined one; its test ZIMs are built from invented text at
31
+ test time, in a temporary directory.
32
+
33
+ What the collection says about a document is a citation (library, ZIM edition date, entry path) plus the
34
+ licence metadata the ZIM itself carries in its `License` field. Many ZIMs carry none, and the collection reports
35
+ that as "not stated in the ZIM" rather than guessing: the licence of the text you reuse is the upstream
36
+ project's, and you should read it there.
37
+
38
+ The optional `zim` extra installs libzim (python-libzim), a compiled binding that is licensed GPL-3.0-or-later
39
+ by its own authors. This package's wheel contains none of it and carries only this package's own code under the
40
+ Apache License 2.0; libzim is a separately installed dependency under its own licence.
41
+
42
+ cve (moved in from cvelib, MIT before the move) ships no vulnerability data either: records are fetched by the user
43
+ with `primarysource cve sync` into the cve home, and its test fixtures are invented text. The sources keep their own
44
+ terms, summarised in docs/cve-sources.md:
45
+
46
+ - CVE List (cvelistV5) and the Linux kernel CNA repository: CVE Program Terms of Use, which ask that copies keep
47
+ MITRE's copyright designation and that licence.
48
+ - CISA Known Exploited Vulnerabilities and Vulnrichment: CC0 1.0.
49
+ - FIRST EPSS: published free of charge; cite it as FIRST EPSS, https://www.first.org/epss.
50
+ - NVD (not ingested yet): if added, display "This product uses data from the NVD API but is not endorsed or
51
+ certified by the NVD."
@@ -0,0 +1,118 @@
1
+ Metadata-Version: 2.5
2
+ Name: primarysource
3
+ Version: 0.1.0
4
+ Summary: Citable primary-source libraries for agents: RFCs, NIST, USB-IF, ITU-T, Kiwix and CVE collections behind one core (ref grammar, token-budgeted paging, full-text index, CLI, MCP server).
5
+ Author: Justin Capella
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ License-File: NOTICE
9
+ Keywords: citation,documents,full-text-search,mcp,model-context-protocol,standards
10
+ Classifier: Development Status :: 2 - Pre-Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Text Processing :: Indexing
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.12
22
+ Provides-Extra: bbf
23
+ Requires-Dist: pypdf>=5; extra == 'bbf'
24
+ Provides-Extra: c2sp
25
+ Provides-Extra: cavp
26
+ Provides-Extra: cve
27
+ Provides-Extra: debpolicy
28
+ Provides-Extra: dev
29
+ Requires-Dist: mypy>=1.20; extra == 'dev'
30
+ Requires-Dist: packaging>=24; extra == 'dev'
31
+ Requires-Dist: pytest>=8; extra == 'dev'
32
+ Requires-Dist: ruff>=0.15; extra == 'dev'
33
+ Provides-Extra: draft
34
+ Provides-Extra: ecma
35
+ Requires-Dist: pypdf>=5; extra == 'ecma'
36
+ Provides-Extra: gitdocs
37
+ Provides-Extra: iana
38
+ Provides-Extra: ieee
39
+ Requires-Dist: pypdf>=5; extra == 'ieee'
40
+ Provides-Extra: iso
41
+ Requires-Dist: pypdf>=5; extra == 'iso'
42
+ Provides-Extra: itu
43
+ Requires-Dist: pypdf>=5; extra == 'itu'
44
+ Provides-Extra: kconfig
45
+ Provides-Extra: mcp
46
+ Requires-Dist: mcp>=2; extra == 'mcp'
47
+ Provides-Extra: nist
48
+ Provides-Extra: pep
49
+ Provides-Extra: pms
50
+ Provides-Extra: rfc
51
+ Requires-Dist: httpx>=0.27; extra == 'rfc'
52
+ Requires-Dist: rich>=13; extra == 'rfc'
53
+ Requires-Dist: typer>=0.12; extra == 'rfc'
54
+ Provides-Extra: rfc-semantic
55
+ Requires-Dist: httpx>=0.27; extra == 'rfc-semantic'
56
+ Requires-Dist: model2vec>=0.3; extra == 'rfc-semantic'
57
+ Requires-Dist: rich>=13; extra == 'rfc-semantic'
58
+ Requires-Dist: sqlite-vec; extra == 'rfc-semantic'
59
+ Requires-Dist: typer>=0.12; extra == 'rfc-semantic'
60
+ Provides-Extra: rfc-zim
61
+ Requires-Dist: httpx>=0.27; extra == 'rfc-zim'
62
+ Requires-Dist: libzim>=3.7; extra == 'rfc-zim'
63
+ Requires-Dist: rich>=13; extra == 'rfc-zim'
64
+ Requires-Dist: typer>=0.12; extra == 'rfc-zim'
65
+ Provides-Extra: rpmdocs
66
+ Provides-Extra: usb
67
+ Provides-Extra: usbids
68
+ Provides-Extra: zim
69
+ Requires-Dist: libzim>=4.1; (sys_platform != 'win32' or platform_machine != 'ARM64') and extra == 'zim'
70
+ Description-Content-Type: text/markdown
71
+
72
+ # primarysource
73
+
74
+ A primary source is the text itself: answer from it, and say exactly where it is.
75
+
76
+ One package, many collections. The core is a sectioned-document model, a ref grammar, token-budgeted paging, a fixed result shape, readers, a full-text index, a CLI and an MCP server. Each collection is a subpackage behind an extra: `rfc` (the RFC series, moved in from rfclib), `nist`, `usb`, `itu`, `zim`, `cve`, and more. `PLAN.md` has the design and `ROADMAP.md` the open work.
77
+
78
+ ```
79
+ pip install "primarysource[rfc,mcp]"
80
+ primarysource collections
81
+ primarysource mcp --collection rfc
82
+ ```
83
+
84
+ Pre-alpha. It ships no document text: you fetch the sources yourself.
85
+
86
+ ## What works today
87
+
88
+ ```python
89
+ from primarysource.budget import page
90
+ from primarysource.model import Document, Section, Unit, span_hash
91
+ from primarysource.refs import RefGrammar
92
+ from primarysource.render import render
93
+
94
+ grammar = RefGrammar(r"(?:RFC|BCP|STD)\d+")
95
+ ref = grammar.parse("RFC9000§9.6¶2") # Ref(doc='RFC9000', section='9.6', para=2)
96
+
97
+ document = Document("demo", "Demo", Unit.SENTENCE, (Section("1", "Scope", ("First.", "Second.")),))
98
+ section = document.section("1")
99
+ result = page(section.units, start=1, max_tokens=2000)
100
+ print(render(" ".join(result.units), {"cite": "Demo §1", "unit": document.unit, "span": span_hash("First.")}))
101
+ ```
102
+
103
+ | Module | What it does |
104
+ |---|---|
105
+ | `primarysource.model` | `Document`, `Section`, the declared `Unit` that `¶n` counts, `span_hash` |
106
+ | `primarysource.refs` | `RefGrammar`: `<doc>§<section>[#anchor][¶n]` and `<doc>:<first>-<last>`, for a library's own document-id pattern |
107
+ | `primarysource.budget` | `tokens`, `page`: whole units up to a token budget, always making progress, with `next_start` |
108
+ | `primarysource.render` | body plus `cite:`, `unit:`, `span:`, `next:`, `relaxed:`, `warning:` footer lines in a fixed order |
109
+ | `primarysource.errors` | `LibError(message, hint)`: an error that names its remedy |
110
+ | `primarysource.home` | `resolve_home(app)`: `$<APP>_HOME` or the per-user data directory; `atomic_write` |
111
+
112
+ ## What it does not do yet
113
+
114
+ It reads no file format, builds no index, has no command and serves nothing. No library depends on it.
115
+
116
+ ## Tests
117
+
118
+ `python -m pytest -q` from this directory. All tests use invented text.