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.elements— The element source unit for Python modules (design abfc2829 (1); d26e00f9; 3e155cd6).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.elements
CodeElementclass — One element of a module, its text at depth 0.LiftedModuleclass — A module decomposed in the element regime: its elements (oneimportselement among them,binding_unionfunction — The union of a module's bindings -- the input the import block renders from.class_membersfunction — A class's members as 0-based inclusive line spans: the class's own text ends atanchor,compose_elementsfunction — Compose elements back into a module: members re-indented by depth, every seam derived.compose_modulefunction — Compose a captured module: the imports element's text is rendered from the union of everydecompose_elementsfunction — Decompose a module into elements -- top-level regions, then class members recursively. Aelement_namesfunction — The names an element's own text uses -- what claims an import binding (abfc2829 (3): a bindingimport_slotfunction — The import block's derived slot: after a leading docstring or comment preamble, else first --lift_importsfunction — Decompose a module in the element regime: lift its leading run of imports (after the modulestring_linesfunction — The lines a string literal continues onto -- their whitespace is the string's value.string_readsfunction — The names an element reads through a STRING -- a fixture string (usefixtures("db"),unresolved_namesfunction — The names a module reads that no module-level binding (an import, an assignment, a def or class,
cjm_python_decompose_core.emit
emit_module_from_nodesfunction — Reassemble a module's.pysource from its graph nodes (the round-trip): its orderednodes_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 — Render a module's canonical import block from its import bindings (the element regime'ssibling_modulesfunction — The modules a bare import inmodule_pathreaches as siblings:<dir>/<name>.pyand
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).accessor_offunction — Whether a def continues the accessor chain of the def directly before it:@<name>.setter,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).source_linesfunction — Split source where the tokenizer counts lines -- at \n, \r\n and \r only.str.splitlinesalso
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, cjm-substrate
Metadata
Release files for cjm-python-decompose-core 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cjm_python_decompose_core-0.0.8.tar.gz | 44.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cjm_python_decompose_core-0.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 80.5 kB
Release files / cjm_python_decompose_core-0.0.8.tar.gz
| Download URL | cjm_python_decompose_core-0.0.8.tar.gz |
|---|---|
| Size | 44.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7cba5ce2d17b85c28c9a8657b73cc6951325727458373d7c0c36d44bb6b685a9
|
|
BLAKE2b-256 checksum How to use checksums |
ce212e57caff72c274e4cd100755899481906ac67292eac8373b5b022c8c9fff
|
| 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.8-py3-none-any.whl
| Download URL | cjm_python_decompose_core-0.0.8-py3-none-any.whl |
|---|---|
| Size | 35.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc8437609a5e849323d42c0026f96d7127ccf55ef78f229be5ccbf2e689182a9
|
|
BLAKE2b-256 checksum How to use checksums |
7909bb441b466d5dc0caccd15878288b08cc56ce8d8f896cf9df9dfd4be432f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for cjm-python-decompose-core 0.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.