akms-learn 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- akms_learn-0.3.0/LICENSE +201 -0
- akms_learn-0.3.0/PKG-INFO +51 -0
- akms_learn-0.3.0/README.md +23 -0
- akms_learn-0.3.0/pyproject.toml +67 -0
- akms_learn-0.3.0/setup.cfg +4 -0
- akms_learn-0.3.0/src/akms_learn/__init__.py +155 -0
- akms_learn-0.3.0/src/akms_learn/_code_links.py +154 -0
- akms_learn-0.3.0/src/akms_learn/adapters/__init__.py +38 -0
- akms_learn-0.3.0/src/akms_learn/adapters/fake_adapter.py +172 -0
- akms_learn-0.3.0/src/akms_learn/adapters/protocols.py +197 -0
- akms_learn-0.3.0/src/akms_learn/adapters/status.py +130 -0
- akms_learn-0.3.0/src/akms_learn/capabilities_catalog.py +263 -0
- akms_learn-0.3.0/src/akms_learn/capability_gates.py +293 -0
- akms_learn-0.3.0/src/akms_learn/cli.py +563 -0
- akms_learn-0.3.0/src/akms_learn/compiler.py +1127 -0
- akms_learn-0.3.0/src/akms_learn/domain_packs/__init__.py +51 -0
- akms_learn-0.3.0/src/akms_learn/domain_packs/capabilities.py +49 -0
- akms_learn-0.3.0/src/akms_learn/domain_packs/descriptors.py +208 -0
- akms_learn-0.3.0/src/akms_learn/domain_packs/registry.py +133 -0
- akms_learn-0.3.0/src/akms_learn/domain_packs/warnings.py +65 -0
- akms_learn-0.3.0/src/akms_learn/exporters/__init__.py +89 -0
- akms_learn-0.3.0/src/akms_learn/exporters/_mathaware.py +119 -0
- akms_learn-0.3.0/src/akms_learn/exporters/assessment.py +369 -0
- akms_learn-0.3.0/src/akms_learn/exporters/bundle.py +332 -0
- akms_learn-0.3.0/src/akms_learn/exporters/html.py +354 -0
- akms_learn-0.3.0/src/akms_learn/exporters/markdown.py +532 -0
- akms_learn-0.3.0/src/akms_learn/exporters/notebook.py +443 -0
- akms_learn-0.3.0/src/akms_learn/graph_import.py +363 -0
- akms_learn-0.3.0/src/akms_learn/llm/__init__.py +21 -0
- akms_learn-0.3.0/src/akms_learn/llm/no_provider_stub.py +121 -0
- akms_learn-0.3.0/src/akms_learn/llm/protocol.py +105 -0
- akms_learn-0.3.0/src/akms_learn/llm/providers/__init__.py +6 -0
- akms_learn-0.3.0/src/akms_learn/llm/providers/akms_completion.py +100 -0
- akms_learn-0.3.0/src/akms_learn/llm/providers/nlm_cli.py +187 -0
- akms_learn-0.3.0/src/akms_learn/llm/registry.py +232 -0
- akms_learn-0.3.0/src/akms_learn/models/__init__.py +76 -0
- akms_learn-0.3.0/src/akms_learn/models/assessment.py +119 -0
- akms_learn-0.3.0/src/akms_learn/models/learner_profile.py +56 -0
- akms_learn-0.3.0/src/akms_learn/models/llm_expansion.py +204 -0
- akms_learn-0.3.0/src/akms_learn/models/lsp.py +318 -0
- akms_learn-0.3.0/src/akms_learn/modes/__init__.py +3 -0
- akms_learn-0.3.0/src/akms_learn/modes/adaptive_path.py +415 -0
- akms_learn-0.3.0/src/akms_learn/modes/anthology.py +227 -0
- akms_learn-0.3.0/src/akms_learn/modes/assessment_first.py +553 -0
- akms_learn-0.3.0/src/akms_learn/modes/bundle_source.py +50 -0
- akms_learn-0.3.0/src/akms_learn/modes/derivation_first.py +469 -0
- akms_learn-0.3.0/src/akms_learn/modes/implementation_first.py +468 -0
- akms_learn-0.3.0/src/akms_learn/modes/llm_expanded.py +590 -0
- akms_learn-0.3.0/src/akms_learn/modes/multi_granularity.py +507 -0
- akms_learn-0.3.0/src/akms_learn/modes/notebook_source.py +620 -0
- akms_learn-0.3.0/src/akms_learn/modes/outline.py +232 -0
- akms_learn-0.3.0/src/akms_learn/modes/pedagogical_template.py +384 -0
- akms_learn-0.3.0/src/akms_learn/modes/pitfall.py +266 -0
- akms_learn-0.3.0/src/akms_learn/optional_metadata.py +185 -0
- akms_learn-0.3.0/src/akms_learn/ordering.py +512 -0
- akms_learn-0.3.0/src/akms_learn/plugin.py +88 -0
- akms_learn-0.3.0/src/akms_learn/profiles.py +3 -0
- akms_learn-0.3.0/src/akms_learn/requests.py +325 -0
- akms_learn-0.3.0/src/akms_learn/section_extraction.py +355 -0
- akms_learn-0.3.0/src/akms_learn/sections.py +329 -0
- akms_learn-0.3.0/src/akms_learn/toy_fixtures.py +671 -0
- akms_learn-0.3.0/src/akms_learn/validation.py +107 -0
- akms_learn-0.3.0/src/akms_learn/warnings.py +145 -0
- akms_learn-0.3.0/src/akms_learn.egg-info/PKG-INFO +51 -0
- akms_learn-0.3.0/src/akms_learn.egg-info/SOURCES.txt +126 -0
- akms_learn-0.3.0/src/akms_learn.egg-info/dependency_links.txt +1 -0
- akms_learn-0.3.0/src/akms_learn.egg-info/entry_points.txt +5 -0
- akms_learn-0.3.0/src/akms_learn.egg-info/requires.txt +18 -0
- akms_learn-0.3.0/src/akms_learn.egg-info/top_level.txt +1 -0
- akms_learn-0.3.0/tests/test_adapter_protocols.py +370 -0
- akms_learn-0.3.0/tests/test_adaptive_path_compiler.py +895 -0
- akms_learn-0.3.0/tests/test_anthology_mode.py +217 -0
- akms_learn-0.3.0/tests/test_assessment_exporter.py +553 -0
- akms_learn-0.3.0/tests/test_assessment_first_compiler.py +1013 -0
- akms_learn-0.3.0/tests/test_bundle_exporter.py +166 -0
- akms_learn-0.3.0/tests/test_bundle_manifest_domain_pack.py +117 -0
- akms_learn-0.3.0/tests/test_bundle_manifest_mode_granularity.py +158 -0
- akms_learn-0.3.0/tests/test_capabilities_catalog.py +320 -0
- akms_learn-0.3.0/tests/test_capability_gates.py +446 -0
- akms_learn-0.3.0/tests/test_cli.py +157 -0
- akms_learn-0.3.0/tests/test_code_links.py +259 -0
- akms_learn-0.3.0/tests/test_compile_integration.py +279 -0
- akms_learn-0.3.0/tests/test_cross_mode_pedagogical.py +351 -0
- akms_learn-0.3.0/tests/test_cross_mode_structured.py +215 -0
- akms_learn-0.3.0/tests/test_default_provider_and_base_extras.py +231 -0
- akms_learn-0.3.0/tests/test_derivation_first_mode.py +650 -0
- akms_learn-0.3.0/tests/test_domain_pack_descriptors.py +84 -0
- akms_learn-0.3.0/tests/test_domain_pack_lsp_provenance.py +70 -0
- akms_learn-0.3.0/tests/test_domain_pack_no_companion_imports.py +129 -0
- akms_learn-0.3.0/tests/test_domain_pack_registry.py +83 -0
- akms_learn-0.3.0/tests/test_domain_pack_required_unavailable.py +89 -0
- akms_learn-0.3.0/tests/test_domain_pack_warnings.py +86 -0
- akms_learn-0.3.0/tests/test_domain_packs.py +277 -0
- akms_learn-0.3.0/tests/test_global_vault_readonly.py +178 -0
- akms_learn-0.3.0/tests/test_graph_import.py +189 -0
- akms_learn-0.3.0/tests/test_html_exporter.py +573 -0
- akms_learn-0.3.0/tests/test_implementation_first_mode.py +458 -0
- akms_learn-0.3.0/tests/test_import_direction.py +92 -0
- akms_learn-0.3.0/tests/test_llm_expanded_compiler.py +806 -0
- akms_learn-0.3.0/tests/test_lsp_models.py +201 -0
- akms_learn-0.3.0/tests/test_markdown_exporter.py +163 -0
- akms_learn-0.3.0/tests/test_markdown_exporter_pedagogical.py +462 -0
- akms_learn-0.3.0/tests/test_markdown_exporter_rendering_regressions.py +246 -0
- akms_learn-0.3.0/tests/test_multi_granularity_mode.py +502 -0
- akms_learn-0.3.0/tests/test_no_provider_warning.py +72 -0
- akms_learn-0.3.0/tests/test_notebook_exporter.py +649 -0
- akms_learn-0.3.0/tests/test_notebook_source_compiler.py +773 -0
- akms_learn-0.3.0/tests/test_optional_metadata.py +361 -0
- akms_learn-0.3.0/tests/test_ordering.py +150 -0
- akms_learn-0.3.0/tests/test_ordering_strategies.py +289 -0
- akms_learn-0.3.0/tests/test_outline_mode.py +158 -0
- akms_learn-0.3.0/tests/test_packet_determinism.py +111 -0
- akms_learn-0.3.0/tests/test_pedagogical_template_mode.py +685 -0
- akms_learn-0.3.0/tests/test_pitfall_mode.py +231 -0
- akms_learn-0.3.0/tests/test_pitfall_sections.py +128 -0
- akms_learn-0.3.0/tests/test_plugin.py +103 -0
- akms_learn-0.3.0/tests/test_request_hash.py +147 -0
- akms_learn-0.3.0/tests/test_review_bundle.py +152 -0
- akms_learn-0.3.0/tests/test_review_bundle_closure.py +189 -0
- akms_learn-0.3.0/tests/test_review_bundle_pedagogical.py +237 -0
- akms_learn-0.3.0/tests/test_review_bundle_pedagogical_closure.py +331 -0
- akms_learn-0.3.0/tests/test_review_bundle_structured.py +280 -0
- akms_learn-0.3.0/tests/test_review_bundle_structured_closure.py +510 -0
- akms_learn-0.3.0/tests/test_section_extraction.py +363 -0
- akms_learn-0.3.0/tests/test_sections.py +373 -0
- akms_learn-0.3.0/tests/test_suite_runtime.py +97 -0
- akms_learn-0.3.0/tests/test_toy_fixtures.py +270 -0
- akms_learn-0.3.0/tests/test_validation.py +208 -0
akms_learn-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Shmuel Osovski
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: akms-learn
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Learning Source Packet compiler and exporters for AKMS (experimental preview)
|
|
5
|
+
Author: Shmuel Osovski
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Intended Audience :: Science/Research
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering
|
|
11
|
+
Requires-Python: <3.13,>=3.12
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: akms
|
|
15
|
+
Requires-Dist: nbformat<6,>=5
|
|
16
|
+
Requires-Dist: jinja2<4,>=3
|
|
17
|
+
Requires-Dist: pydantic<3.0,>=2.7
|
|
18
|
+
Requires-Dist: pyyaml<7,>=6.0.3
|
|
19
|
+
Requires-Dist: networkx<4,>=3.0
|
|
20
|
+
Requires-Dist: markdown-it-py<5,>=3
|
|
21
|
+
Provides-Extra: notebook
|
|
22
|
+
Provides-Extra: html
|
|
23
|
+
Provides-Extra: llm
|
|
24
|
+
Provides-Extra: nlm
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=9.0.2; extra == "dev"
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# akms-learn
|
|
30
|
+
|
|
31
|
+
> **Experimental preview.** This package ships as a clearly-labeled preview:
|
|
32
|
+
> its API and output formats may change between minor releases, and it is not
|
|
33
|
+
> yet covered by the stability promises of the core `akms` package.
|
|
34
|
+
|
|
35
|
+
Learning Source Packet (LSP) compiler and exporters for the AKMS framework.
|
|
36
|
+
|
|
37
|
+
- Distribution name: `akms-learn`
|
|
38
|
+
- Import name: `akms_learn`
|
|
39
|
+
- Python: `>=3.12,<3.13`
|
|
40
|
+
- CLI: `akms-learn`
|
|
41
|
+
- Plugin entry point: `akms.plugins` / `learn`
|
|
42
|
+
|
|
43
|
+
The package depends on `akms` for read-only graph and schema access. The reverse
|
|
44
|
+
direction is forbidden and tested: core never imports `akms_learn`.
|
|
45
|
+
|
|
46
|
+
`nbformat` and Jinja2 are base dependencies, so notebook and HTML features work
|
|
47
|
+
without an extras install. The `notebook` and `html` extras remain empty
|
|
48
|
+
compatibility sentinels. The `nlm` extra is also a sentinel because the grounded
|
|
49
|
+
NotebookLM provider probes the external `nlm` executable at runtime.
|
|
50
|
+
|
|
51
|
+
See the unified documentation: `docs/getting-started/akms-learn.md`, `docs/concepts/akms-learn.md`, and `docs/reference/akms-learn/`.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# akms-learn
|
|
2
|
+
|
|
3
|
+
> **Experimental preview.** This package ships as a clearly-labeled preview:
|
|
4
|
+
> its API and output formats may change between minor releases, and it is not
|
|
5
|
+
> yet covered by the stability promises of the core `akms` package.
|
|
6
|
+
|
|
7
|
+
Learning Source Packet (LSP) compiler and exporters for the AKMS framework.
|
|
8
|
+
|
|
9
|
+
- Distribution name: `akms-learn`
|
|
10
|
+
- Import name: `akms_learn`
|
|
11
|
+
- Python: `>=3.12,<3.13`
|
|
12
|
+
- CLI: `akms-learn`
|
|
13
|
+
- Plugin entry point: `akms.plugins` / `learn`
|
|
14
|
+
|
|
15
|
+
The package depends on `akms` for read-only graph and schema access. The reverse
|
|
16
|
+
direction is forbidden and tested: core never imports `akms_learn`.
|
|
17
|
+
|
|
18
|
+
`nbformat` and Jinja2 are base dependencies, so notebook and HTML features work
|
|
19
|
+
without an extras install. The `notebook` and `html` extras remain empty
|
|
20
|
+
compatibility sentinels. The `nlm` extra is also a sentinel because the grounded
|
|
21
|
+
NotebookLM provider probes the external `nlm` executable at runtime.
|
|
22
|
+
|
|
23
|
+
See the unified documentation: `docs/getting-started/akms-learn.md`, `docs/concepts/akms-learn.md`, and `docs/reference/akms-learn/`.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "akms-learn"
|
|
3
|
+
version = "0.3.0"
|
|
4
|
+
description = "Learning Source Packet compiler and exporters for AKMS (experimental preview)"
|
|
5
|
+
requires-python = ">=3.12,<3.13"
|
|
6
|
+
license = "Apache-2.0"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
authors = [{ name = "Shmuel Osovski" }]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 3 - Alpha",
|
|
12
|
+
"Intended Audience :: Science/Research",
|
|
13
|
+
"Programming Language :: Python :: 3.12",
|
|
14
|
+
"Topic :: Scientific/Engineering",
|
|
15
|
+
]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"akms",
|
|
18
|
+
# nbformat + jinja2 are now BASE deps (previously the [notebook]/[html]
|
|
19
|
+
# extras) so notebook/html features — assessment_first, quiz_export,
|
|
20
|
+
# html_export, notebook_source, notebook_export — work out of the box
|
|
21
|
+
# without an extras install. The [notebook]/[html] keys below are kept as
|
|
22
|
+
# empty sentinels for backward compatibility.
|
|
23
|
+
"nbformat>=5,<6",
|
|
24
|
+
"jinja2>=3,<4",
|
|
25
|
+
"pydantic>=2.7,<3.0",
|
|
26
|
+
"pyyaml>=6.0.3,<7",
|
|
27
|
+
"networkx>=3.0,<4",
|
|
28
|
+
"markdown-it-py>=3,<5",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
# nbformat/jinja2 moved to base dependencies above; these stay as empty
|
|
33
|
+
# sentinels so `akms-learn[notebook]` / `akms-learn[html]` keep resolving.
|
|
34
|
+
notebook = []
|
|
35
|
+
html = []
|
|
36
|
+
llm = []
|
|
37
|
+
# Grounded NotebookLM provider. The `nlm` CLI is an external
|
|
38
|
+
# binary, not a pip package, so this extra is an empty sentinel: availability is
|
|
39
|
+
# probed at runtime via shutil.which("nlm"). Listed so the capability gate and
|
|
40
|
+
# downstream consumers can declare intent.
|
|
41
|
+
nlm = []
|
|
42
|
+
dev = [
|
|
43
|
+
"pytest>=9.0.2",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.scripts]
|
|
47
|
+
akms-learn = "akms_learn.cli:main"
|
|
48
|
+
|
|
49
|
+
[project.entry-points."akms.plugins"]
|
|
50
|
+
learn = "akms_learn.plugin:get_plugin"
|
|
51
|
+
|
|
52
|
+
[build-system]
|
|
53
|
+
requires = ["setuptools>=68.0"]
|
|
54
|
+
build-backend = "setuptools.build_meta"
|
|
55
|
+
|
|
56
|
+
[tool.setuptools.packages.find]
|
|
57
|
+
where = ["src"]
|
|
58
|
+
|
|
59
|
+
[tool.pytest.ini_options]
|
|
60
|
+
testpaths = ["tests"]
|
|
61
|
+
pythonpath = ["src"]
|
|
62
|
+
markers = [
|
|
63
|
+
"unit: fast unit-level tests",
|
|
64
|
+
"integration: cross-module/integration tests",
|
|
65
|
+
"regression: regression and backfill-evidence tests",
|
|
66
|
+
"e2e: end-to-end tests exercising the full pipeline",
|
|
67
|
+
]
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"""akms_learn: Learning Source Packet compiler and exporters for AKMS."""
|
|
2
|
+
|
|
3
|
+
from akms_learn.cli import main
|
|
4
|
+
from akms_learn.compiler import (
|
|
5
|
+
STAGES,
|
|
6
|
+
CompileResult,
|
|
7
|
+
compile_learning_source,
|
|
8
|
+
)
|
|
9
|
+
from akms_learn.domain_packs import (
|
|
10
|
+
CapabilityStatus,
|
|
11
|
+
CompanionRole,
|
|
12
|
+
DomainPackDescriptor,
|
|
13
|
+
DomainPackRegistry,
|
|
14
|
+
DomainPackWarning,
|
|
15
|
+
LearningCapabilityError,
|
|
16
|
+
RuntimeHint,
|
|
17
|
+
SourcePackDescriptor,
|
|
18
|
+
build_registry_from_paths,
|
|
19
|
+
load_descriptor_from_yaml,
|
|
20
|
+
load_source_pack_from_yaml,
|
|
21
|
+
warn_planned_companion,
|
|
22
|
+
)
|
|
23
|
+
from akms_learn.exporters.bundle import MANIFEST_VERSION
|
|
24
|
+
from akms_learn.exporters.bundle import export as bundle_export
|
|
25
|
+
from akms_learn.exporters.markdown import export as markdown_export
|
|
26
|
+
from akms_learn.graph_import import (
|
|
27
|
+
GraphSlice,
|
|
28
|
+
compute_graph_hash,
|
|
29
|
+
fixture_graph,
|
|
30
|
+
load_graph,
|
|
31
|
+
)
|
|
32
|
+
from akms_learn.modes.anthology import (
|
|
33
|
+
TEACHING_SECTIONS,
|
|
34
|
+
AnthologyEntry,
|
|
35
|
+
anthology_mode,
|
|
36
|
+
)
|
|
37
|
+
from akms_learn.modes.bundle_source import bundle_source_mode
|
|
38
|
+
from akms_learn.modes.outline import outline_mode
|
|
39
|
+
from akms_learn.modes.pitfall import (
|
|
40
|
+
PITFALL_EDGE_TYPES,
|
|
41
|
+
STRUCTURED_FIELDS,
|
|
42
|
+
pitfall_mode,
|
|
43
|
+
)
|
|
44
|
+
from akms_learn.models import (
|
|
45
|
+
AssessmentView,
|
|
46
|
+
CodeLinkView,
|
|
47
|
+
CompilerInfo,
|
|
48
|
+
LearningEdgeView,
|
|
49
|
+
LearningNodeView,
|
|
50
|
+
LearningRequestInfo,
|
|
51
|
+
LearningSourcePacket,
|
|
52
|
+
LearningWarning,
|
|
53
|
+
PacketBody,
|
|
54
|
+
PitfallView,
|
|
55
|
+
ReferenceView,
|
|
56
|
+
SourceInfo,
|
|
57
|
+
)
|
|
58
|
+
from akms_learn.ordering import LEARNING_BUCKETS, order_nodes
|
|
59
|
+
from akms_learn.requests import (
|
|
60
|
+
LearningRequest,
|
|
61
|
+
normalize_request,
|
|
62
|
+
request_hash,
|
|
63
|
+
to_canonical_dict,
|
|
64
|
+
)
|
|
65
|
+
from akms_learn.section_extraction import (
|
|
66
|
+
APPROVED_HEADINGS,
|
|
67
|
+
EXCERPT_MAX_CHARS,
|
|
68
|
+
ExtractedSection,
|
|
69
|
+
ExtractionMethod,
|
|
70
|
+
extract_sections_from_node,
|
|
71
|
+
extract_sections_from_nodes,
|
|
72
|
+
)
|
|
73
|
+
from akms_learn.sections import APPROVED_SECTIONS, SectionView, extract_sections
|
|
74
|
+
from akms_learn.validation import PacketValidationError, validate_packet
|
|
75
|
+
from akms_learn.warnings import (
|
|
76
|
+
WarningAccumulator,
|
|
77
|
+
emit_dangling_reference_warning,
|
|
78
|
+
emit_missing_section_warning,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
__all__ = [
|
|
82
|
+
# Compiler
|
|
83
|
+
"STAGES",
|
|
84
|
+
"CompileResult",
|
|
85
|
+
"compile_learning_source",
|
|
86
|
+
# Graph import
|
|
87
|
+
"GraphSlice",
|
|
88
|
+
"load_graph",
|
|
89
|
+
"compute_graph_hash",
|
|
90
|
+
"fixture_graph",
|
|
91
|
+
# Ordering
|
|
92
|
+
"LEARNING_BUCKETS",
|
|
93
|
+
"order_nodes",
|
|
94
|
+
# Sections
|
|
95
|
+
"APPROVED_SECTIONS",
|
|
96
|
+
"SectionView",
|
|
97
|
+
"extract_sections",
|
|
98
|
+
# Node-level section extraction
|
|
99
|
+
"APPROVED_HEADINGS",
|
|
100
|
+
"EXCERPT_MAX_CHARS",
|
|
101
|
+
"ExtractedSection",
|
|
102
|
+
"ExtractionMethod",
|
|
103
|
+
"extract_sections_from_node",
|
|
104
|
+
"extract_sections_from_nodes",
|
|
105
|
+
# LSP models
|
|
106
|
+
"LearningSourcePacket",
|
|
107
|
+
"CompilerInfo",
|
|
108
|
+
"SourceInfo",
|
|
109
|
+
"LearningRequestInfo",
|
|
110
|
+
"PacketBody",
|
|
111
|
+
"LearningNodeView",
|
|
112
|
+
"LearningEdgeView",
|
|
113
|
+
"PitfallView",
|
|
114
|
+
"CodeLinkView",
|
|
115
|
+
"AssessmentView",
|
|
116
|
+
"ReferenceView",
|
|
117
|
+
"LearningWarning",
|
|
118
|
+
"LearningRequest",
|
|
119
|
+
"normalize_request",
|
|
120
|
+
"request_hash",
|
|
121
|
+
"to_canonical_dict",
|
|
122
|
+
"WarningAccumulator",
|
|
123
|
+
"emit_missing_section_warning",
|
|
124
|
+
"emit_dangling_reference_warning",
|
|
125
|
+
"PacketValidationError",
|
|
126
|
+
"validate_packet",
|
|
127
|
+
# Domain-pack foundation
|
|
128
|
+
"CapabilityStatus",
|
|
129
|
+
"CompanionRole",
|
|
130
|
+
"DomainPackDescriptor",
|
|
131
|
+
"DomainPackRegistry",
|
|
132
|
+
"DomainPackWarning",
|
|
133
|
+
"LearningCapabilityError",
|
|
134
|
+
"RuntimeHint",
|
|
135
|
+
"SourcePackDescriptor",
|
|
136
|
+
"build_registry_from_paths",
|
|
137
|
+
"load_descriptor_from_yaml",
|
|
138
|
+
"load_source_pack_from_yaml",
|
|
139
|
+
"warn_planned_companion",
|
|
140
|
+
# Exporters
|
|
141
|
+
"markdown_export",
|
|
142
|
+
"bundle_export",
|
|
143
|
+
"MANIFEST_VERSION",
|
|
144
|
+
# Structured modes
|
|
145
|
+
"outline_mode",
|
|
146
|
+
"anthology_mode",
|
|
147
|
+
"AnthologyEntry",
|
|
148
|
+
"TEACHING_SECTIONS",
|
|
149
|
+
"pitfall_mode",
|
|
150
|
+
"PITFALL_EDGE_TYPES",
|
|
151
|
+
"STRUCTURED_FIELDS",
|
|
152
|
+
"bundle_source_mode",
|
|
153
|
+
# CLI
|
|
154
|
+
"main",
|
|
155
|
+
]
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"""Shared helpers for code-link extraction.
|
|
2
|
+
|
|
3
|
+
Promoted from ``compiler.py`` and ``modes/implementation_first.py`` to
|
|
4
|
+
remove duplication. Lives at the package
|
|
5
|
+
top level so both the compiler stage and the ``implementation_first`` mode
|
|
6
|
+
can call into the same authoritative implementation.
|
|
7
|
+
|
|
8
|
+
Surface
|
|
9
|
+
-------
|
|
10
|
+
* :data:`MISSING_SOURCE_PATH_SENTINELS` — frozenset of placeholder strings
|
|
11
|
+
that count as "no usable source path" (``"", "unknown", "none", "null"``).
|
|
12
|
+
* :func:`is_missing_source_path` — predicate over a raw ``source_path``
|
|
13
|
+
value; case-insensitive, whitespace-tolerant, None-safe.
|
|
14
|
+
* :func:`coerce_line_range` — best-effort coercion of a node/edge
|
|
15
|
+
``line_range`` value into a ``(start, end)`` integer tuple.
|
|
16
|
+
* :func:`build_code_links` — walks ``implements`` edges and emits one
|
|
17
|
+
:class:`CodeLinkView` per edge. Optionally invokes a missing-source
|
|
18
|
+
callback so the compiler can emit ``code_mirror_missing_source_path``
|
|
19
|
+
warnings while the mode keeps its own simpler warning path.
|
|
20
|
+
|
|
21
|
+
Callers
|
|
22
|
+
-------
|
|
23
|
+
* ``compiler._build_code_links`` thin-wraps :func:`build_code_links`
|
|
24
|
+
passing the WarningAccumulator-driven callback.
|
|
25
|
+
* ``implementation_first._build_code_references`` uses the no-callback
|
|
26
|
+
form; it emits ``implementation_anchor_missing_source`` separately
|
|
27
|
+
via :func:`implementation_first._emit_anchor_missing_source_warnings`.
|
|
28
|
+
|
|
29
|
+
The module has no LLM imports.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
from __future__ import annotations
|
|
33
|
+
|
|
34
|
+
from typing import Any, Callable, Optional
|
|
35
|
+
|
|
36
|
+
from akms_learn.models import CodeLinkView
|
|
37
|
+
|
|
38
|
+
__all__ = [
|
|
39
|
+
"MISSING_SOURCE_PATH_SENTINELS",
|
|
40
|
+
"is_missing_source_path",
|
|
41
|
+
"coerce_line_range",
|
|
42
|
+
"build_code_links",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
MISSING_SOURCE_PATH_SENTINELS: frozenset[str] = frozenset(
|
|
47
|
+
{"", "unknown", "none", "null"}
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def is_missing_source_path(value: Any) -> bool:
|
|
52
|
+
"""Return True if *value* is an unusable placeholder source path.
|
|
53
|
+
|
|
54
|
+
Treats ``None``, empty string, and the canonical sentinels
|
|
55
|
+
(``"unknown"`` / ``"none"`` / ``"null"``) as missing. Comparison is
|
|
56
|
+
case-insensitive after stripping whitespace.
|
|
57
|
+
"""
|
|
58
|
+
if value is None:
|
|
59
|
+
return True
|
|
60
|
+
text = str(value).strip().lower()
|
|
61
|
+
return text in MISSING_SOURCE_PATH_SENTINELS
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def coerce_line_range(value: Any) -> tuple[int, int]:
|
|
65
|
+
"""Best-effort coercion of a node/edge ``line_range`` to ``(start, end)``.
|
|
66
|
+
|
|
67
|
+
Returns ``(0, 0)`` for any malformed input (non-list, wrong length,
|
|
68
|
+
non-integer elements). The placeholder pair is recognised by callers
|
|
69
|
+
that want to skip uninformative line ranges.
|
|
70
|
+
"""
|
|
71
|
+
if isinstance(value, (list, tuple)) and len(value) == 2:
|
|
72
|
+
try:
|
|
73
|
+
return (int(value[0]), int(value[1]))
|
|
74
|
+
except (TypeError, ValueError):
|
|
75
|
+
pass
|
|
76
|
+
return (0, 0)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def build_code_links(
|
|
80
|
+
edges: tuple[dict[str, Any], ...] | list[dict[str, Any]],
|
|
81
|
+
nodes_by_id: dict[str, dict[str, Any]],
|
|
82
|
+
on_missing_mirror_source: Optional[Callable[[str, str], None]] = None,
|
|
83
|
+
) -> list[CodeLinkView]:
|
|
84
|
+
"""Walk ``implements`` edges and emit one :class:`CodeLinkView` per edge.
|
|
85
|
+
|
|
86
|
+
Behaviour:
|
|
87
|
+
|
|
88
|
+
* One :class:`CodeLinkView` per edge with ``type == "implements"``.
|
|
89
|
+
* ``source_node_id`` is the edge's ``from`` endpoint.
|
|
90
|
+
* ``target`` resolves to the target node id (always set when present).
|
|
91
|
+
* ``relation`` is fixed to ``"implements"``.
|
|
92
|
+
* ``file_path`` and ``line_range`` come from the target node when the
|
|
93
|
+
target has a usable ``source_path``; otherwise the fields stay
|
|
94
|
+
``None``.
|
|
95
|
+
* When *on_missing_mirror_source* is supplied AND the target node is a
|
|
96
|
+
``code_mirror`` with a missing/sentinel ``source_path``, the callback
|
|
97
|
+
is invoked once per such edge with ``(mirror_node_id, edge_id)``.
|
|
98
|
+
The mode-level caller (``implementation_first``) passes ``None`` so
|
|
99
|
+
it can emit its own ``implementation_anchor_missing_source`` warning
|
|
100
|
+
via a separate code path.
|
|
101
|
+
|
|
102
|
+
The collector is order-stable: edges are processed in the order they
|
|
103
|
+
arrive in (assumed already sorted by the caller) and the returned list
|
|
104
|
+
preserves that order.
|
|
105
|
+
"""
|
|
106
|
+
code_links: list[CodeLinkView] = []
|
|
107
|
+
for edge in edges:
|
|
108
|
+
if edge.get("type") != "implements":
|
|
109
|
+
continue
|
|
110
|
+
|
|
111
|
+
source_id = str(edge.get("from") or "")
|
|
112
|
+
target_id = str(edge.get("to") or "")
|
|
113
|
+
edge_id = str(edge.get("edge_id") or "")
|
|
114
|
+
|
|
115
|
+
target_node = nodes_by_id.get(target_id) or {}
|
|
116
|
+
target_source_path = target_node.get("source_path")
|
|
117
|
+
line_range_raw = target_node.get("line_range")
|
|
118
|
+
|
|
119
|
+
usable_path: Optional[str] = (
|
|
120
|
+
None
|
|
121
|
+
if is_missing_source_path(target_source_path)
|
|
122
|
+
else str(target_source_path)
|
|
123
|
+
)
|
|
124
|
+
usable_line_range: Optional[tuple[int, int]] = None
|
|
125
|
+
if usable_path is not None and line_range_raw is not None:
|
|
126
|
+
coerced = coerce_line_range(line_range_raw)
|
|
127
|
+
if coerced != (0, 0):
|
|
128
|
+
usable_line_range = coerced
|
|
129
|
+
|
|
130
|
+
target_value = target_id or (usable_path or "")
|
|
131
|
+
|
|
132
|
+
code_links.append(
|
|
133
|
+
CodeLinkView(
|
|
134
|
+
node_id=source_id or target_id or edge_id,
|
|
135
|
+
source_file=usable_path or "unknown",
|
|
136
|
+
source_node_id=source_id or None,
|
|
137
|
+
target=target_value or None,
|
|
138
|
+
relation="implements",
|
|
139
|
+
file_path=usable_path,
|
|
140
|
+
line_range=usable_line_range,
|
|
141
|
+
mirror_node_id=(
|
|
142
|
+
target_id if target_node.get("kind") == "code_mirror" else None
|
|
143
|
+
),
|
|
144
|
+
)
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
if (
|
|
148
|
+
on_missing_mirror_source is not None
|
|
149
|
+
and target_node.get("kind") == "code_mirror"
|
|
150
|
+
and is_missing_source_path(target_source_path)
|
|
151
|
+
):
|
|
152
|
+
on_missing_mirror_source(target_id, edge_id)
|
|
153
|
+
|
|
154
|
+
return code_links
|