cjm-python-decompose-core
A Python source-code decomposition core for context graphs: parses .py modules (docstrings, imports, and the symbol tree of functions/classes/methods with their calls) into provenance-carrying graph nodes and edges that co-reside with the markdown source-type. First source = the ecosystem's own code; generalizes to any Python corpus.
Modules
cjm_python_decompose_core.__init__cjm_python_decompose_core.emit— Project a module BACK out of the graph (graph -> .py) — the canonical emit leg.cjm_python_decompose_core.extract— Bind parsed Python onto dev-graph-schema code nodes (the dev-domain binding).cjm_python_decompose_core.ingest— Flatten a decomposed Python corpus into graph elements (the queue-free half).cjm_python_decompose_core.parse— Schema-free Python parsing (stdlibast).
API
cjm_python_decompose_core.emit
emit_module_from_nodesfunction — Reassemble a module's canonical.pysource from its graph nodes (the round-trip).module_used_bindingsfunction — Union of every contained symbol's import bindings + the module-level ones (+ anynodes_for_modulefunction — Filter queried region nodes down to one module (bymodule_idproperty).regions_from_nodesfunction — Collect a module's top-level regions from its nodes, ordered byorder_index.render_bindingfunction — Render one import-binding descriptor back to its canonical import statement.render_import_blockfunction — Derive a module's canonical import block from its used import bindings.synth_importfunction — A syntheticfrom <import_name> import <local_name>binding (USES-derived).
cjm_python_decompose_core.extract
DecomposedModuleclass — One module bound to schema nodes: the module + its symbols + local edges.decompose_filefunction — Read a.pyfile and decompose it (hash over the raw file bytes).decompose_packagefunction — Decompose every.pyunder a package dir (the lib's own importable source).decompose_pathsfunction — Decompose an explicit set of files; unparseable files are skipped (recorded by the caller).decompose_textfunction — Parse + bind in one step from in-memory source text.import_name_forfunction — The dotted import name a module is reachable by (drops a trailing__init__).iter_py_filesfunction — Yield.pyfile paths underroot, skipping__pycache__/build/etc.module_path_forfunction — The repo-relative POSIX path used as the module's identity input.
cjm_python_decompose_core.ingest
build_call_mapfunction — Map UNAMBIGUOUS bare symbol names to their node ids (the CALLS target table).build_import_mapfunction — Map every module's dotted import name to its node id (the IMPORTS target table).corpus_graph_elementsfunction — Collect a decomposed corpus into the node + edge wire-dict listsextend_graphexpects.resolve_importfunction — Resolve a (possibly relative) import to an absolute dotted module name.
cjm_python_decompose_core.parse
ParsedModuleclass — The structural decomposition of one Python module.ParsedSymbolclass — One definition within a module (function/class/method), with its nesting.SourceRegionclass — One ordered top-level region of a module, held verbatim (symbol or text).emit_regionsfunction — Reassemble ordered regions into canonical.pysource — the graph owns formatting.iter_symbolsfunction — Flatten the symbol tree depth-first (parent before its children).monkeypatch_assignmentsfunction — Top-level monkey-patch assignments:Class.method = func(the incremental-class idiom).parse_modulefunction — Parse Python source into module docstring + imports + the symbol tree.parse_regionsfunction — Decompose a module into ordered verbatim top-level regions (the round-trip substrate).
Dependencies
Depends on: cjm-context-graph-layer, cjm-context-graph-primitives, cjm-dev-graph-schema
Used by: cjm-context-graph-projection, cjm-notebook-decompose-core
Release files for cjm-python-decompose-core 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cjm_python_decompose_core-0.0.7.tar.gz | 34.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cjm_python_decompose_core-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 61.9 kB
Release files / cjm_python_decompose_core-0.0.7.tar.gz
| Download URL | cjm_python_decompose_core-0.0.7.tar.gz |
|---|---|
| Size | 34.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d0524a2a79c8757ebe644fee70f9d2d6e80a99d6e41d29c03b85980ef11f07f
|
|
BLAKE2b-256 checksum How to use checksums |
4414c729a8ef87b9ff74ea7acb38b6ffd16a94f47c55ddb8f443f71093ab32b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / cjm_python_decompose_core-0.0.7-py3-none-any.whl
| Download URL | cjm_python_decompose_core-0.0.7-py3-none-any.whl |
|---|---|
| Size | 27.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5283a34e59049d4cf73a997d790fffb026d1d703eafcb17e54dac8abd3c774b2
|
|
BLAKE2b-256 checksum How to use checksums |
b244c3f6a71be13bb2aabae3b790ef028acce3d2d0d1e62539fb3adaf8f81929
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|