auryn-python 0.1.0__py3-none-any.whl
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.
- auryn/ingestors/pyframework/__init__.py +11 -0
- auryn/ingestors/pyframework/schema.py +20 -0
- auryn/ingestors/pyframework/synthesize.py +130 -0
- auryn/ingestors/python/GRAPH_MODEL.md +175 -0
- auryn/ingestors/python/LIMITATIONS.md +95 -0
- auryn/ingestors/python/__init__.py +5 -0
- auryn/ingestors/python/file_parser.py +385 -0
- auryn/ingestors/python/git_sync.py +419 -0
- auryn/ingestors/python/ids.py +160 -0
- auryn/ingestors/python/incremental.py +206 -0
- auryn/ingestors/python/jedi_engine.py +203 -0
- auryn/ingestors/python/plugin.py +49 -0
- auryn/ingestors/python/raw_model.py +110 -0
- auryn/ingestors/python/resolution.py +760 -0
- auryn/ingestors/python/schema.py +78 -0
- auryn_python-0.1.0.dist-info/METADATA +10 -0
- auryn_python-0.1.0.dist-info/RECORD +20 -0
- auryn_python-0.1.0.dist-info/WHEEL +4 -0
- auryn_python-0.1.0.dist-info/entry_points.txt +5 -0
- auryn_python-0.1.0.dist-info/licenses/LICENSE +557 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""Graph schema (node/edge labels) the Python ingestor writes.
|
|
2
|
+
|
|
3
|
+
Mirrors ingestors/csharp/schema.py: both Python engines (`jedi` and `ast`) emit only
|
|
4
|
+
these labels/edges, and git_sync passes this list to setup_schema()/read_fingerprints()
|
|
5
|
+
so the delta-sync pipeline (core/graph_sync.py) can index and diff this project's subgraph.
|
|
6
|
+
|
|
7
|
+
The Python model differs from C# where the language does (see GRAPH_MODEL.md for the full
|
|
8
|
+
rationale and the per-label property model):
|
|
9
|
+
|
|
10
|
+
- No Namespace/File split -- a Python module *is* a file, so `Module` (per .py) and
|
|
11
|
+
`Package` (per package dir) replace C#'s Namespace + File.
|
|
12
|
+
- `Function` (module-level def) exists alongside `Method` (class member), because
|
|
13
|
+
Python has free functions and C# doesn't.
|
|
14
|
+
- `EXTENDS` is multi-valued (multiple inheritance) and the resolved `mro` rides on the
|
|
15
|
+
Class node; `IMPLEMENTS` is emitted only when a base is an abc.ABC / typing.Protocol.
|
|
16
|
+
- Types are dynamic, so every type-bearing property is paired with a provenance marker
|
|
17
|
+
(`type_source` on nodes, `resolution` on edges) -- see GRAPH_MODEL.md.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
from auryn.core.graph_model import EdgeSchema, NodeSchema
|
|
23
|
+
|
|
24
|
+
NODE_SCHEMAS = [
|
|
25
|
+
NodeSchema(label="Project", indexed_properties=("name",)),
|
|
26
|
+
# `linkage` (ADR 0004): the project-independent key on every externally-visible node, indexed
|
|
27
|
+
# so cross-repo reconciliation resolves a placeholder<->definer by targeted `linkage IN [...]`
|
|
28
|
+
# seeks (never a scan).
|
|
29
|
+
NodeSchema(label="Package", indexed_properties=("name", "linkage_key")),
|
|
30
|
+
NodeSchema(label="Module", indexed_properties=("name", "linkage_key")),
|
|
31
|
+
NodeSchema(label="Class", indexed_properties=("name", "linkage_key")),
|
|
32
|
+
NodeSchema(label="Function", indexed_properties=("name", "linkage_key")),
|
|
33
|
+
NodeSchema(label="Method", indexed_properties=("name", "linkage_key")),
|
|
34
|
+
NodeSchema(label="Attribute", indexed_properties=("name",)),
|
|
35
|
+
NodeSchema(label="Parameter", indexed_properties=("name",)),
|
|
36
|
+
# Deferred (see GRAPH_MODEL.md): a `DTO` classification for @dataclass /
|
|
37
|
+
# pydantic BaseModel / TypedDict / NamedTuple, mirroring C#'s DTO label. Not emitted
|
|
38
|
+
# by the first cut -- until then the `is_dataclass` flag on Class carries the signal.
|
|
39
|
+
# NodeSchema(label="DTO", indexed_properties=("name",)),
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
EDGE_SCHEMAS = [
|
|
43
|
+
# Containment backbone -- no properties, pure structure (as in C#).
|
|
44
|
+
EdgeSchema(rel_type="HAS_PACKAGE"), # Project -> Package
|
|
45
|
+
EdgeSchema(rel_type="HAS_SUBPACKAGE"), # Package -> Package
|
|
46
|
+
EdgeSchema(rel_type="HAS_MODULE"), # Project|Package -> Module
|
|
47
|
+
EdgeSchema(rel_type="HAS_CLASS"), # Module|Package -> Class (Package for __init__.py symbols)
|
|
48
|
+
EdgeSchema(rel_type="HAS_FUNCTION"), # Module|Package -> Function
|
|
49
|
+
EdgeSchema(rel_type="HAS_METHOD"), # Class -> Method
|
|
50
|
+
EdgeSchema(rel_type="HAS_ATTRIBUTE"), # Class -> Attribute
|
|
51
|
+
EdgeSchema(rel_type="HAS_PARAMETER"), # Function|Method -> Parameter
|
|
52
|
+
EdgeSchema(rel_type="HAS_NESTED_CLASS"), # Class -> Class
|
|
53
|
+
# Semantic layer -- every one carries a provenance property (see contract).
|
|
54
|
+
EdgeSchema(rel_type="EXTENDS"), # Class -> Class (local base); {resolution, mro_index}
|
|
55
|
+
EdgeSchema(rel_type="IMPLEMENTS"), # Class -> Class (local ABC/Protocol base); {resolution}
|
|
56
|
+
# Function|Method -> Function|Method, PLUS Module|Package -> Function|Method for a script's
|
|
57
|
+
# top-level (module-scope) call statements: the Module/Package node is the one non-callable
|
|
58
|
+
# that can originate a CALLS edge (Python-specific; `main()` under `if __name__ ...` et al.).
|
|
59
|
+
# {resolution, receiver_type, argument_types, type_arguments}
|
|
60
|
+
EdgeSchema(rel_type="CALLS"),
|
|
61
|
+
EdgeSchema(rel_type="RETURNS"), # Function|Method -> Class (only when the return type resolves to a local class); {resolution}
|
|
62
|
+
# Module|Package -> Module|Package, one per source module aggregating its imports of a
|
|
63
|
+
# given project module; {names, resolution}. This is the module-level dependency
|
|
64
|
+
# breadcrumb the incremental resync closure needs (ADR 0002): when a module changes,
|
|
65
|
+
# its importers are found by walking IMPORTS in reverse -- catching a reference that
|
|
66
|
+
# only now resolves because the imported module gained a name, which the symbol-level
|
|
67
|
+
# CALLS/EXTENDS reverse-deps can't see (a not-yet-existing name has no node to point at).
|
|
68
|
+
EdgeSchema(rel_type="IMPORTS"),
|
|
69
|
+
# Deliberately NOT emitted:
|
|
70
|
+
# DECORATED_BY -- decorators ride as a `decorators` string list on the node; the
|
|
71
|
+
# edge form is what a later framework-enrichment pass (Django/FastAPI/Celery) adds.
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
# Every label that can be an EXTENDS/IMPLEMENTS/HAS_CLASS/HAS_NESTED_CLASS endpoint --
|
|
75
|
+
# i.e. every "class-like" declaration kind. Only `Class` today (`DTO` joins it if/when
|
|
76
|
+
# the classification label above is enabled). Kept as a named tuple for parity with the
|
|
77
|
+
# C# ingestor's TYPE_LABELS, which read_fingerprints()-style scans iterate over.
|
|
78
|
+
TYPE_LABELS = ("Class",)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: auryn-python
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python language plugin for Auryn: fast `ast` + deep Jedi (in-process) engines, plus the web-framework route enrichment.
|
|
5
|
+
Author-email: Roi Lipman <roi.lipman@falkordb.com>
|
|
6
|
+
License: SSPL-1.0
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.12
|
|
9
|
+
Requires-Dist: auryn-core
|
|
10
|
+
Requires-Dist: jedi>=0.20.0
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
auryn/ingestors/pyframework/__init__.py,sha256=mrpdwLGwDUlc-43tJPJyRnh2HOUQra2kXD6TF-K3PiQ,558
|
|
2
|
+
auryn/ingestors/pyframework/schema.py,sha256=l2m86LwNvp_r3tuKRw2fgcrbAaZOnZzqOQzlJA8dPyc,763
|
|
3
|
+
auryn/ingestors/pyframework/synthesize.py,sha256=wbElGtDmRcMVtmHv3GXUSuGnh2bRn8H3SEUbj2RSEQU,5349
|
|
4
|
+
auryn/ingestors/python/GRAPH_MODEL.md,sha256=7edJEYFCqIGiAVPQLjHcRUOe2qUuv_a-uqC1AES3KZk,9528
|
|
5
|
+
auryn/ingestors/python/LIMITATIONS.md,sha256=Whc3ry4GT4JB7eXiHpIgBH-vBrTUj9H17R5kSg3KIUk,6481
|
|
6
|
+
auryn/ingestors/python/__init__.py,sha256=QV8TUigsG--MULvyXbiX0GG7v0t9ExaOFRu0RlrzlUU,318
|
|
7
|
+
auryn/ingestors/python/file_parser.py,sha256=wNXUwMLCuNn2SqiBvRQedgCEok08wg_hSEixxNA_6OY,16483
|
|
8
|
+
auryn/ingestors/python/git_sync.py,sha256=a_bQG8zxJKVPRObjp5HG5JPwUi_S9H3JoCz2NCyHgRQ,21223
|
|
9
|
+
auryn/ingestors/python/ids.py,sha256=NzLiE8v-qN0f3zBMbDwsYn9UdjzcVgASxJR9ibnK9EA,7328
|
|
10
|
+
auryn/ingestors/python/incremental.py,sha256=90rEpsSWnnT7BZrNQSuHmfSz-6wWqH_Y8kP1OTIh8B0,8937
|
|
11
|
+
auryn/ingestors/python/jedi_engine.py,sha256=LSUIH08MPOQupuvsNv9tOCY_w-CKsveGkYSznx5NmK0,8721
|
|
12
|
+
auryn/ingestors/python/plugin.py,sha256=6Hp4Y3Ur2kiSfdJ5D3EBNL-BQGc-wnqoH1fnF15qr9Y,1772
|
|
13
|
+
auryn/ingestors/python/raw_model.py,sha256=DPxEYD1PuopvoTzArGnkVKk7xA1a1MyLnSnG_8N2av8,4506
|
|
14
|
+
auryn/ingestors/python/resolution.py,sha256=wYloHn0tcRT_yV3QM5IEXbXGqyK454Df_pMouBkuxvg,35605
|
|
15
|
+
auryn/ingestors/python/schema.py,sha256=G7_89XhMn2FtWv-6gzwXvamVXRXJjogLilwYveReFqk,4968
|
|
16
|
+
auryn_python-0.1.0.dist-info/METADATA,sha256=wkg8Y81heHxXMU7QTBgJit4BAE-0aOcb2uRDXebfdL8,354
|
|
17
|
+
auryn_python-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
18
|
+
auryn_python-0.1.0.dist-info/entry_points.txt,sha256=uVXRgFJAL6QPeR3Xxu_AB_ZYvRIwqO_ElKY8tWuBySg,120
|
|
19
|
+
auryn_python-0.1.0.dist-info/licenses/LICENSE,sha256=NOlMUIe6bp-zTzWucd9eZTPF_Hy79sRBhqcegoBraeE,30582
|
|
20
|
+
auryn_python-0.1.0.dist-info/RECORD,,
|