Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
Merge dev into evidence/python-tooling
JustVugg9e96637810df
diff --cc c/tests/test_pack_python.pyindex d5e544e0,dc0aaacc..fee5a4fd--- a/c/tests/test_pack_python.py+++ b/c/tests/test_pack_python.py@@@ -131,15 -149,105 +149,115 @@@ class PackPythonNeededTests(unittest.Tefound = PACK.invoked_scripts(path)self.assertEqual(found, {"real_one.py"})+ def test_the_real_tree_carries_the_case_that_started_this(self):+ """Every other test above builds a disposable fixture; this is the one+ real-tree assertion, run against this checkout's own c/ directory so a+ future tool import the fixtures cannot see is still caught here.++ It asserts the two files #1359 was actually about, rather than a name+ invented for the test: coli launches tools/convert_fp8_to_int4.py as a+ subprocess, that script imports iq3_pack inside quant_e8(), and+ iq3_pack opens iq3xxs_grid.json next to itself. Both were absent from+ every published archive. Assert the real pair and the test dies with+ the real bug if either edge is ever dropped again."""+ paths = PACK.needed(HERE.parent)+ self.assertIn(TOOLS / "iq3_pack.py", paths,+ "reached only through a subprocess-launched script's import")+ self.assertIn(TOOLS / "iq3xxs_grid.json", paths,+ "reached only as a data file opened next to iq3_pack.py")++ def test_engine_evidence_is_needed_by_the_real_tree(self):- """Every other test in this module builds a disposable fixture; this- is the one real-tree assertion, run against this checkout's own- c/ directory so a future tool import that the fixture-based tests- cannot see (because they never touch the real tree) is still- caught here."""++ """This branch's own new tool, asserted the same way and for the same++ reason: eval_glm.py is launched by coli as a subprocess and imports++ engine_evidence, so the module is reachable only across the boundary++ this suite exists to defend. It is a second real-tree case rather than++ a replacement for the one above -- that one pins the historical bug,++ this one pins the edge the branch adds."""+ paths = PACK.needed(HERE.parent)+ self.assertIn(TOOLS / "engine_evidence.py", paths)++ class PackPythonDataFileTests(unittest.TestCase):+ """#1359 left a second edge open after the import one was closed: packaging+ iq3_pack.py still does not make `--xbits e8` work from an archive, because+ iq3_pack.py opens a sibling JSON and the packer copied only .py files."""++ def make_tree(self, root, data_name="grid.json"):+ root = pathlib.Path(root)+ (root / "tools").mkdir()+ (root / "coli").write_text(+ "import os\nimport reader\n"+ "TOOLS = os.path.join(os.path.dirname(__file__), 'tools')\n")+ (root / "reader.py").write_text(+ "import os, json\n"+ "def load():\n"+ " p = os.path.join(os.path.dirname(__file__), %r)\n"+ " return json.load(open(p))\n" % data_name)+ (root / data_name).write_text("[1, 2, 3]\n")+ return root++ def test_a_data_file_opened_next_to_a_module_is_packaged(self):+ with tempfile.TemporaryDirectory() as tmp:+ root = self.make_tree(tmp)+ names = {path.name for path in PACK.needed(root)}+ self.assertIn("reader.py", names)+ self.assertIn("grid.json", names,+ "a module's sibling data file is part of what the "+ "archive must contain, not an optional extra")++ def test_without_data_files_the_module_ships_but_cannot_run(self):+ # Negative control: replay the pre-fix shape (walk the same graph, but+ # never collect data siblings) against the identical fixture. If this+ # ever stops dropping grid.json, the fixture no longer isolates the fix.+ with tempfile.TemporaryDirectory() as tmp:+ root = self.make_tree(tmp)+ original, PACK.data_files = PACK.data_files, lambda path: set()+ try:+ names = {path.name for path in PACK.needed(root)}+ finally:+ PACK.data_files = original+ self.assertIn("reader.py", names)+ self.assertNotIn("grid.json", names)++ def test_a_source_file_named_in_a_message_is_not_packaged(self):+ """The allowlist earns its keep here. coli names colibri.c and+ family_registry.py names five engine sources, none of which belong in+ a release archive; a rule of "any existing sibling that is not .py"+ would have shipped all of them."""+ with tempfile.TemporaryDirectory() as tmp:+ root = pathlib.Path(tmp)+ (root / "engine.c").write_text("int main(void){return 0;}\n")+ (root / "talker.py").write_text(+ 'MSG = "build it first: cc engine.c"\n'+ 'NAME = "engine.c"\n')+ found = PACK.data_files(root / "talker.py")+ self.assertEqual(found, set())++ def test_a_name_that_is_not_a_real_sibling_is_ignored(self):+ with tempfile.TemporaryDirectory() as tmp:+ root = pathlib.Path(tmp)+ (root / "talker.py").write_text(+ 'A = "absent.json"\n' # nothing of that name exists+ 'B = "sub/dir/real.json"\n') # a path, not a plain sibling+ (root / "sub").mkdir()+ (root / "sub" / "dir").mkdir()+ (root / "sub" / "dir" / "real.json").write_text("{}\n")+ found = PACK.data_files(root / "talker.py")+ self.assertEqual(found, set())++ def test_the_summary_line_counts_data_files_separately(self):+ """A display derived from a set whose meaning changed is how #856 hid+ for a release: the engine's own self-report agreed with the bug."""+ with tempfile.TemporaryDirectory() as tmp:+ root = self.make_tree(tmp)+ dist = pathlib.Path(tmp) / "dist"+ buf = io.StringIO()+ with contextlib.redirect_stdout(buf):+ PACK.main(["pack_python.py", str(root), str(dist)])+ # coli is the walk's root and is copied by the workflow, not by+ # needed(), so the fixture's one packaged module is reader.py.+ self.assertIn("1 Python files and 1 data files", buf.getvalue())++if __name__ == "__main__":unittest.main()