codegraphcontext-rust 0.5.5__cp311-cp311-win_amd64.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.
- codegraphcontext/__init__.py +2 -0
- codegraphcontext/__main__.py +5 -0
- codegraphcontext/_cgc_rust.cp311-win_amd64.pyd +0 -0
- codegraphcontext/cli/__init__.py +1 -0
- codegraphcontext/cli/cli_helpers.py +774 -0
- codegraphcontext/cli/config_manager.py +1051 -0
- codegraphcontext/cli/main.py +2386 -0
- codegraphcontext/cli/registry_commands.py +404 -0
- codegraphcontext/cli/setup_macos.py +93 -0
- codegraphcontext/cli/setup_wizard.py +991 -0
- codegraphcontext/cli/visualizer.py +50 -0
- codegraphcontext/core/__init__.py +165 -0
- codegraphcontext/core/bundle_registry.py +181 -0
- codegraphcontext/core/cgc_bundle.py +858 -0
- codegraphcontext/core/cgcignore.py +118 -0
- codegraphcontext/core/database.py +273 -0
- codegraphcontext/core/database_falkordb.py +480 -0
- codegraphcontext/core/database_falkordb_remote.py +199 -0
- codegraphcontext/core/database_kuzu.py +636 -0
- codegraphcontext/core/falkor_worker.py +132 -0
- codegraphcontext/core/jobs.py +132 -0
- codegraphcontext/core/watcher.py +260 -0
- codegraphcontext/prompts.py +125 -0
- codegraphcontext/server.py +471 -0
- codegraphcontext/tool_definitions.py +220 -0
- codegraphcontext/tools/__init__.py +0 -0
- codegraphcontext/tools/advanced_language_query_tool.py +103 -0
- codegraphcontext/tools/code_finder.py +1160 -0
- codegraphcontext/tools/graph_builder.py +337 -0
- codegraphcontext/tools/handlers/analysis_handlers.py +114 -0
- codegraphcontext/tools/handlers/indexing_handlers.py +116 -0
- codegraphcontext/tools/handlers/management_handlers.py +339 -0
- codegraphcontext/tools/handlers/query_handlers.py +83 -0
- codegraphcontext/tools/handlers/watcher_handlers.py +83 -0
- codegraphcontext/tools/indexing/__init__.py +1 -0
- codegraphcontext/tools/indexing/constants.py +25 -0
- codegraphcontext/tools/indexing/discovery.py +64 -0
- codegraphcontext/tools/indexing/engine.py +109 -0
- codegraphcontext/tools/indexing/persistence/__init__.py +3 -0
- codegraphcontext/tools/indexing/persistence/parquet_loader.py +643 -0
- codegraphcontext/tools/indexing/persistence/writer.py +1114 -0
- codegraphcontext/tools/indexing/pipeline.py +171 -0
- codegraphcontext/tools/indexing/pre_scan.py +105 -0
- codegraphcontext/tools/indexing/resolution/__init__.py +8 -0
- codegraphcontext/tools/indexing/resolution/calls.py +253 -0
- codegraphcontext/tools/indexing/resolution/inheritance.py +91 -0
- codegraphcontext/tools/indexing/sanitize.py +41 -0
- codegraphcontext/tools/indexing/schema.py +79 -0
- codegraphcontext/tools/indexing/schema_contract.py +44 -0
- codegraphcontext/tools/indexing/scip_pipeline.py +140 -0
- codegraphcontext/tools/languages/c.py +563 -0
- codegraphcontext/tools/languages/cpp.py +616 -0
- codegraphcontext/tools/languages/csharp.py +551 -0
- codegraphcontext/tools/languages/dart.py +378 -0
- codegraphcontext/tools/languages/elixir.py +460 -0
- codegraphcontext/tools/languages/go.py +499 -0
- codegraphcontext/tools/languages/haskell.py +426 -0
- codegraphcontext/tools/languages/java.py +500 -0
- codegraphcontext/tools/languages/javascript.py +589 -0
- codegraphcontext/tools/languages/kotlin.py +640 -0
- codegraphcontext/tools/languages/perl.py +260 -0
- codegraphcontext/tools/languages/php.py +519 -0
- codegraphcontext/tools/languages/python.py +576 -0
- codegraphcontext/tools/languages/ruby.py +537 -0
- codegraphcontext/tools/languages/rust.py +295 -0
- codegraphcontext/tools/languages/scala.py +519 -0
- codegraphcontext/tools/languages/swift.py +491 -0
- codegraphcontext/tools/languages/typescript.py +575 -0
- codegraphcontext/tools/languages/typescriptjsx.py +151 -0
- codegraphcontext/tools/package_resolver.py +472 -0
- codegraphcontext/tools/query_tool_languages/c_toolkit.py +5 -0
- codegraphcontext/tools/query_tool_languages/cpp_toolkit.py +87 -0
- codegraphcontext/tools/query_tool_languages/csharp_toolkit.py +5 -0
- codegraphcontext/tools/query_tool_languages/dart_toolkit.py +5 -0
- codegraphcontext/tools/query_tool_languages/go_toolkit.py +5 -0
- codegraphcontext/tools/query_tool_languages/haskell_toolkit.py +5 -0
- codegraphcontext/tools/query_tool_languages/java_toolkit.py +5 -0
- codegraphcontext/tools/query_tool_languages/javascript_toolkit.py +5 -0
- codegraphcontext/tools/query_tool_languages/perl_toolkit.py +5 -0
- codegraphcontext/tools/query_tool_languages/python_toolkit.py +5 -0
- codegraphcontext/tools/query_tool_languages/ruby_toolkit.py +5 -0
- codegraphcontext/tools/query_tool_languages/rust_toolkit.py +5 -0
- codegraphcontext/tools/query_tool_languages/scala_toolkit.py +5 -0
- codegraphcontext/tools/query_tool_languages/swift_toolkit.py +5 -0
- codegraphcontext/tools/query_tool_languages/typescript_toolkit.py +5 -0
- codegraphcontext/tools/scip_indexer.py +467 -0
- codegraphcontext/tools/scip_pb2.py +2455 -0
- codegraphcontext/tools/system.py +133 -0
- codegraphcontext/tools/tree_sitter_parser.py +103 -0
- codegraphcontext/utils/debug_log.py +90 -0
- codegraphcontext/utils/path_ignore.py +55 -0
- codegraphcontext/utils/repo_path.py +27 -0
- codegraphcontext/utils/tree_sitter_manager.py +285 -0
- codegraphcontext/utils/visualize_graph.py +0 -0
- codegraphcontext/viz/server.py +282 -0
- codegraphcontext_rust-0.5.5.dist-info/METADATA +537 -0
- codegraphcontext_rust-0.5.5.dist-info/RECORD +101 -0
- codegraphcontext_rust-0.5.5.dist-info/WHEEL +4 -0
- codegraphcontext_rust-0.5.5.dist-info/entry_points.txt +3 -0
- codegraphcontext_rust-0.5.5.dist-info/licenses/LICENSE +21 -0
- codegraphcontext_rust-0.5.5.dist-info/sboms/cgc-python.cyclonedx.json +2333 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Engine adapter: selects Rust or Python backend for parsing + resolution.
|
|
3
|
+
|
|
4
|
+
The Rust backend (_cgc_rust) provides significant performance improvements
|
|
5
|
+
for file parsing and parallel processing. If unavailable, falls back to
|
|
6
|
+
the existing Python implementation transparently.
|
|
7
|
+
|
|
8
|
+
Set CGC_USE_PYTHON_PARSER=1 to force Python backend for debugging.
|
|
9
|
+
"""
|
|
10
|
+
import os
|
|
11
|
+
import logging
|
|
12
|
+
|
|
13
|
+
logger = logging.getLogger(__name__)
|
|
14
|
+
|
|
15
|
+
RUST_AVAILABLE = False
|
|
16
|
+
|
|
17
|
+
if not os.environ.get("CGC_USE_PYTHON_PARSER"):
|
|
18
|
+
try:
|
|
19
|
+
from codegraphcontext._cgc_rust import (
|
|
20
|
+
parse_file as _rust_parse_file,
|
|
21
|
+
parse_files_parallel as _rust_parse_files_parallel,
|
|
22
|
+
pre_scan_for_imports as _rust_pre_scan,
|
|
23
|
+
parse_and_prescan as _rust_parse_and_prescan,
|
|
24
|
+
resolve_call_groups as _rust_resolve_calls,
|
|
25
|
+
resolve_inheritance as _rust_resolve_inheritance,
|
|
26
|
+
sanitize_props as _rust_sanitize_props,
|
|
27
|
+
)
|
|
28
|
+
RUST_AVAILABLE = True
|
|
29
|
+
logger.info("Rust parsing engine loaded successfully")
|
|
30
|
+
except ImportError:
|
|
31
|
+
logger.debug("Rust parsing engine not available, using Python fallback")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def parse_file(path, lang, is_dependency=False, index_source=False,
|
|
35
|
+
parser_wrapper=None, **kwargs):
|
|
36
|
+
"""Parse a single file. Uses Rust if available, else Python."""
|
|
37
|
+
if RUST_AVAILABLE and lang in _RUST_SUPPORTED_LANGS:
|
|
38
|
+
return _rust_parse_file(str(path), lang, is_dependency, index_source)
|
|
39
|
+
|
|
40
|
+
# Python fallback
|
|
41
|
+
if parser_wrapper is None:
|
|
42
|
+
raise ValueError("parser_wrapper required for Python fallback")
|
|
43
|
+
return parser_wrapper.parse(path, is_dependency, index_source=index_source, **kwargs)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def parse_files_parallel(file_specs, num_threads=None):
|
|
47
|
+
"""Parse multiple files in parallel using Rust.
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
file_specs: list of (path_str, lang, is_dependency) tuples
|
|
51
|
+
num_threads: optional thread count (0 = auto)
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
list of file_data dicts
|
|
55
|
+
|
|
56
|
+
Raises:
|
|
57
|
+
RuntimeError if Rust engine not available
|
|
58
|
+
"""
|
|
59
|
+
if not RUST_AVAILABLE:
|
|
60
|
+
raise RuntimeError("Rust engine required for parallel parsing")
|
|
61
|
+
|
|
62
|
+
return _rust_parse_files_parallel(file_specs, num_threads)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def pre_scan_for_imports(file_specs):
|
|
66
|
+
"""Pre-scan files to build imports_map.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
file_specs: list of (path_str, extension) tuples
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
dict {symbol_name: [file_path, ...]}
|
|
73
|
+
|
|
74
|
+
Raises:
|
|
75
|
+
RuntimeError if Rust engine not available
|
|
76
|
+
"""
|
|
77
|
+
if not RUST_AVAILABLE:
|
|
78
|
+
raise RuntimeError("Rust engine required for pre_scan_for_imports")
|
|
79
|
+
|
|
80
|
+
return _rust_pre_scan(file_specs)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def resolve_call_groups(all_file_data, imports_map, skip_external=False):
|
|
84
|
+
"""Resolve function calls into 6-category groups using Rust."""
|
|
85
|
+
if not RUST_AVAILABLE:
|
|
86
|
+
raise RuntimeError("Rust engine required for resolve_call_groups")
|
|
87
|
+
return _rust_resolve_calls(all_file_data, imports_map, skip_external)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def resolve_inheritance(all_file_data, imports_map):
|
|
91
|
+
"""Resolve inheritance links using Rust."""
|
|
92
|
+
if not RUST_AVAILABLE:
|
|
93
|
+
raise RuntimeError("Rust engine required for resolve_inheritance")
|
|
94
|
+
return _rust_resolve_inheritance(all_file_data, imports_map)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def sanitize_props(props):
|
|
98
|
+
"""Sanitize properties for graph DB storage using Rust."""
|
|
99
|
+
if not RUST_AVAILABLE:
|
|
100
|
+
raise RuntimeError("Rust engine required for sanitize_props")
|
|
101
|
+
return _rust_sanitize_props(props)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
# All 19 languages supported by the Rust engine
|
|
105
|
+
_RUST_SUPPORTED_LANGS = {
|
|
106
|
+
"python", "javascript", "typescript", "tsx", "go", "java", "cpp",
|
|
107
|
+
"c", "rust", "ruby", "c_sharp", "php", "kotlin", "perl",
|
|
108
|
+
"scala", "swift", "haskell", "dart", "elixir",
|
|
109
|
+
}
|