IncludeCPP 3.7.3__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.
- includecpp/__init__.py +59 -0
- includecpp/__init__.pyi +255 -0
- includecpp/__main__.py +4 -0
- includecpp/cli/__init__.py +4 -0
- includecpp/cli/commands.py +8270 -0
- includecpp/cli/config_parser.py +127 -0
- includecpp/core/__init__.py +19 -0
- includecpp/core/ai_integration.py +2132 -0
- includecpp/core/build_manager.py +2416 -0
- includecpp/core/cpp_api.py +376 -0
- includecpp/core/cpp_api.pyi +95 -0
- includecpp/core/cppy_converter.py +3448 -0
- includecpp/core/cssl/CSSL_DOCUMENTATION.md +2075 -0
- includecpp/core/cssl/__init__.py +42 -0
- includecpp/core/cssl/cssl_builtins.py +2271 -0
- includecpp/core/cssl/cssl_builtins.pyi +1393 -0
- includecpp/core/cssl/cssl_events.py +621 -0
- includecpp/core/cssl/cssl_modules.py +2803 -0
- includecpp/core/cssl/cssl_parser.py +2575 -0
- includecpp/core/cssl/cssl_runtime.py +3051 -0
- includecpp/core/cssl/cssl_syntax.py +488 -0
- includecpp/core/cssl/cssl_types.py +1512 -0
- includecpp/core/cssl_bridge.py +882 -0
- includecpp/core/cssl_bridge.pyi +488 -0
- includecpp/core/error_catalog.py +802 -0
- includecpp/core/error_formatter.py +1016 -0
- includecpp/core/exceptions.py +97 -0
- includecpp/core/path_discovery.py +77 -0
- includecpp/core/project_ui.py +3370 -0
- includecpp/core/settings_ui.py +326 -0
- includecpp/generator/__init__.py +1 -0
- includecpp/generator/parser.cpp +1903 -0
- includecpp/generator/parser.h +281 -0
- includecpp/generator/type_resolver.cpp +363 -0
- includecpp/generator/type_resolver.h +68 -0
- includecpp/py.typed +0 -0
- includecpp/templates/cpp.proj.template +18 -0
- includecpp/vscode/__init__.py +1 -0
- includecpp/vscode/cssl/__init__.py +1 -0
- includecpp/vscode/cssl/language-configuration.json +38 -0
- includecpp/vscode/cssl/package.json +50 -0
- includecpp/vscode/cssl/snippets/cssl.snippets.json +1080 -0
- includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +341 -0
- includecpp-3.7.3.dist-info/METADATA +1076 -0
- includecpp-3.7.3.dist-info/RECORD +49 -0
- includecpp-3.7.3.dist-info/WHEEL +5 -0
- includecpp-3.7.3.dist-info/entry_points.txt +2 -0
- includecpp-3.7.3.dist-info/licenses/LICENSE +21 -0
- includecpp-3.7.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"""Exception hierarchy for C++ API system.
|
|
2
|
+
|
|
3
|
+
This module defines all custom exceptions used by the C++ API dynamic module system.
|
|
4
|
+
All exceptions inherit from CppApiError for easy catching of all API-related errors.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CppApiError(Exception):
|
|
9
|
+
"""Base exception for all C++ API errors.
|
|
10
|
+
|
|
11
|
+
All custom exceptions in the C++ API system inherit from this base class,
|
|
12
|
+
allowing users to catch all API-related errors with a single except clause.
|
|
13
|
+
"""
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class CppBuildError(CppApiError):
|
|
18
|
+
"""Build or compilation failed.
|
|
19
|
+
|
|
20
|
+
Raised when:
|
|
21
|
+
- CMake configuration fails
|
|
22
|
+
- C++ compilation fails
|
|
23
|
+
- Plugin generator compilation fails
|
|
24
|
+
- Build process times out
|
|
25
|
+
- Build script not found
|
|
26
|
+
"""
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class CppModuleNotFoundError(CppApiError):
|
|
31
|
+
"""Requested module not found in registry.
|
|
32
|
+
|
|
33
|
+
Raised when:
|
|
34
|
+
- include() called with non-existent module name
|
|
35
|
+
- Module not registered in .module_registry.json
|
|
36
|
+
- .cp file missing for requested module
|
|
37
|
+
"""
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class CppModuleOutdatedError(CppApiError):
|
|
42
|
+
"""Module source files changed since last build.
|
|
43
|
+
|
|
44
|
+
Raised when:
|
|
45
|
+
- Source file hash mismatch detected
|
|
46
|
+
- Header file hash mismatch detected
|
|
47
|
+
- .cp file hash mismatch detected
|
|
48
|
+
- auto_update=False and module is outdated
|
|
49
|
+
"""
|
|
50
|
+
pass
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class CppReloadWarning(UserWarning):
|
|
54
|
+
"""Warning about unsafe C extension reload.
|
|
55
|
+
|
|
56
|
+
This warning is issued when:
|
|
57
|
+
- rebuild() called but api module already loaded
|
|
58
|
+
- User needs to restart Python to use new version
|
|
59
|
+
- C extension hot-reload attempted (unsafe)
|
|
60
|
+
"""
|
|
61
|
+
pass
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class CppValidationError(CppApiError):
|
|
65
|
+
"""Generated code validation failed.
|
|
66
|
+
|
|
67
|
+
Raised when:
|
|
68
|
+
- Generated pybind11 code has syntax errors
|
|
69
|
+
- Unbalanced braces detected
|
|
70
|
+
- Missing required includes
|
|
71
|
+
- Invalid generated code structure
|
|
72
|
+
"""
|
|
73
|
+
pass
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class CppParseError(CppApiError):
|
|
77
|
+
""".cp file parsing failed.
|
|
78
|
+
|
|
79
|
+
Raised when:
|
|
80
|
+
- Malformed .cp file syntax
|
|
81
|
+
- Invalid module name
|
|
82
|
+
- Missing parentheses in FUNC/CLASS/VAR
|
|
83
|
+
- Invalid syntax in PUBLIC() block
|
|
84
|
+
"""
|
|
85
|
+
pass
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class CppGeneratorError(CppApiError):
|
|
89
|
+
"""Plugin generator failed.
|
|
90
|
+
|
|
91
|
+
Raised when:
|
|
92
|
+
- Generator executable not found
|
|
93
|
+
- Generator process crashed
|
|
94
|
+
- Generator output invalid
|
|
95
|
+
- Generator version mismatch
|
|
96
|
+
"""
|
|
97
|
+
pass
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""Path discovery module for finding C++ modules in specific directories."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import List, Set
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class PathDiscovery:
|
|
9
|
+
"""Discover C++ modules (.cp files) in specific paths."""
|
|
10
|
+
|
|
11
|
+
def __init__(self, project_root: Path, config):
|
|
12
|
+
self.project_root = project_root
|
|
13
|
+
self.config = config
|
|
14
|
+
self.plugins_dir = config.resolve_path(config.config.get('plugins', '/plugins'))
|
|
15
|
+
|
|
16
|
+
def discover_modules_in_path(self, search_path: Path) -> List[str]:
|
|
17
|
+
"""Discover module names from .cp files in given path.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
search_path: Directory or file path to search
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
List of module names (without .cp extension)
|
|
24
|
+
"""
|
|
25
|
+
modules = []
|
|
26
|
+
|
|
27
|
+
if not search_path.is_absolute():
|
|
28
|
+
search_path = (self.project_root / search_path).resolve()
|
|
29
|
+
|
|
30
|
+
if search_path.is_file():
|
|
31
|
+
if search_path.suffix == '.cp':
|
|
32
|
+
module_name = search_path.stem
|
|
33
|
+
modules.append(module_name)
|
|
34
|
+
return modules
|
|
35
|
+
|
|
36
|
+
if search_path.is_dir():
|
|
37
|
+
for cp_file in search_path.glob('*.cp'):
|
|
38
|
+
module_name = cp_file.stem
|
|
39
|
+
modules.append(module_name)
|
|
40
|
+
|
|
41
|
+
cpp_files = list(search_path.glob('*.cpp'))
|
|
42
|
+
h_files = list(search_path.glob('*.h'))
|
|
43
|
+
|
|
44
|
+
for cpp_file in cpp_files:
|
|
45
|
+
potential_cp = self.plugins_dir / f"{cpp_file.stem}.cp"
|
|
46
|
+
if potential_cp.exists() and cpp_file.stem not in modules:
|
|
47
|
+
modules.append(cpp_file.stem)
|
|
48
|
+
|
|
49
|
+
for h_file in h_files:
|
|
50
|
+
potential_cp = self.plugins_dir / f"{h_file.stem}.cp"
|
|
51
|
+
if potential_cp.exists() and h_file.stem not in modules:
|
|
52
|
+
modules.append(h_file.stem)
|
|
53
|
+
|
|
54
|
+
return modules
|
|
55
|
+
|
|
56
|
+
def find_cp_files_in_paths(self, paths: List[Path]) -> Set[Path]:
|
|
57
|
+
"""Find all .cp files in given paths.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
paths: List of directories or files to search
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
Set of .cp file paths
|
|
64
|
+
"""
|
|
65
|
+
cp_files = set()
|
|
66
|
+
|
|
67
|
+
for path in paths:
|
|
68
|
+
if not path.is_absolute():
|
|
69
|
+
path = (self.project_root / path).resolve()
|
|
70
|
+
|
|
71
|
+
if path.is_file() and path.suffix == '.cp':
|
|
72
|
+
cp_files.add(path)
|
|
73
|
+
elif path.is_dir():
|
|
74
|
+
for cp_file in path.glob('*.cp'):
|
|
75
|
+
cp_files.add(cp_file)
|
|
76
|
+
|
|
77
|
+
return cp_files
|