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.

Potentially problematic release.


This version of IncludeCPP might be problematic. Click here for more details.

Files changed (49) hide show
  1. includecpp/__init__.py +59 -0
  2. includecpp/__init__.pyi +255 -0
  3. includecpp/__main__.py +4 -0
  4. includecpp/cli/__init__.py +4 -0
  5. includecpp/cli/commands.py +8270 -0
  6. includecpp/cli/config_parser.py +127 -0
  7. includecpp/core/__init__.py +19 -0
  8. includecpp/core/ai_integration.py +2132 -0
  9. includecpp/core/build_manager.py +2416 -0
  10. includecpp/core/cpp_api.py +376 -0
  11. includecpp/core/cpp_api.pyi +95 -0
  12. includecpp/core/cppy_converter.py +3448 -0
  13. includecpp/core/cssl/CSSL_DOCUMENTATION.md +2075 -0
  14. includecpp/core/cssl/__init__.py +42 -0
  15. includecpp/core/cssl/cssl_builtins.py +2271 -0
  16. includecpp/core/cssl/cssl_builtins.pyi +1393 -0
  17. includecpp/core/cssl/cssl_events.py +621 -0
  18. includecpp/core/cssl/cssl_modules.py +2803 -0
  19. includecpp/core/cssl/cssl_parser.py +2575 -0
  20. includecpp/core/cssl/cssl_runtime.py +3051 -0
  21. includecpp/core/cssl/cssl_syntax.py +488 -0
  22. includecpp/core/cssl/cssl_types.py +1512 -0
  23. includecpp/core/cssl_bridge.py +882 -0
  24. includecpp/core/cssl_bridge.pyi +488 -0
  25. includecpp/core/error_catalog.py +802 -0
  26. includecpp/core/error_formatter.py +1016 -0
  27. includecpp/core/exceptions.py +97 -0
  28. includecpp/core/path_discovery.py +77 -0
  29. includecpp/core/project_ui.py +3370 -0
  30. includecpp/core/settings_ui.py +326 -0
  31. includecpp/generator/__init__.py +1 -0
  32. includecpp/generator/parser.cpp +1903 -0
  33. includecpp/generator/parser.h +281 -0
  34. includecpp/generator/type_resolver.cpp +363 -0
  35. includecpp/generator/type_resolver.h +68 -0
  36. includecpp/py.typed +0 -0
  37. includecpp/templates/cpp.proj.template +18 -0
  38. includecpp/vscode/__init__.py +1 -0
  39. includecpp/vscode/cssl/__init__.py +1 -0
  40. includecpp/vscode/cssl/language-configuration.json +38 -0
  41. includecpp/vscode/cssl/package.json +50 -0
  42. includecpp/vscode/cssl/snippets/cssl.snippets.json +1080 -0
  43. includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +341 -0
  44. includecpp-3.7.3.dist-info/METADATA +1076 -0
  45. includecpp-3.7.3.dist-info/RECORD +49 -0
  46. includecpp-3.7.3.dist-info/WHEEL +5 -0
  47. includecpp-3.7.3.dist-info/entry_points.txt +2 -0
  48. includecpp-3.7.3.dist-info/licenses/LICENSE +21 -0
  49. includecpp-3.7.3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,127 @@
1
+ from pathlib import Path
2
+ import json
3
+ import platform
4
+ import os
5
+ from typing import Dict, Any
6
+
7
+ class CppProjectConfig:
8
+ def __init__(self, config_path: Path = None):
9
+ self.config_path = config_path or Path.cwd() / "cpp.proj"
10
+ self.project_root = self.config_path.parent
11
+ self.config = self._load_config()
12
+
13
+ def _load_config(self) -> Dict[str, Any]:
14
+ if not self.config_path.exists():
15
+ return self._default_config()
16
+ try:
17
+ with open(self.config_path, encoding='utf-8') as f:
18
+ content = f.read().strip()
19
+ if not content:
20
+ print(f"[WARNING] {self.config_path} is empty, using default config")
21
+ return self._default_config()
22
+ return json.loads(content)
23
+ except json.JSONDecodeError as e:
24
+ print(f"[ERROR] Invalid JSON in {self.config_path}: {e}")
25
+ print("[INFO] Using default configuration")
26
+ return self._default_config()
27
+
28
+ def _default_config(self) -> Dict[str, Any]:
29
+ project_name = self.project_root.name if self.project_root else "MyProject"
30
+ return {
31
+ "project": project_name,
32
+ "version": "1.0.0",
33
+ "include": "/include",
34
+ "plugins": "/plugins",
35
+ "compiler": {
36
+ "standard": "c++17",
37
+ "optimization": "O3",
38
+ "flags": ["-Wall", "-pthread"]
39
+ },
40
+ "types": {
41
+ "common": ["int", "float", "double", "string"]
42
+ },
43
+ "threading": {
44
+ "enabled": True,
45
+ "max_workers": 8
46
+ },
47
+ "intellisense": {
48
+ "enabled": True,
49
+ "extract_signatures": True,
50
+ "include_docs": True
51
+ }
52
+ }
53
+
54
+ @staticmethod
55
+ def create_default(path: str):
56
+ config = CppProjectConfig()._default_config()
57
+ with open(path, 'w', encoding='utf-8') as f:
58
+ json.dump(config, f, indent=2)
59
+
60
+ Path("include").mkdir(exist_ok=True)
61
+ Path("plugins").mkdir(exist_ok=True)
62
+
63
+ def _get_appdata_path(self) -> Path:
64
+ if platform.system() == "Windows":
65
+ base = Path(os.getenv('APPDATA', ''))
66
+ else:
67
+ base = Path.home() / ".local" / "share" / "includecpp"
68
+ return base
69
+
70
+ def get_build_dir(self, compiler: str) -> Path:
71
+ project_name = self.config.get('project', 'unnamed')
72
+ build_dir_name = f"{project_name}-{compiler}-build-proj"
73
+ build_dir = self._get_appdata_path() / build_dir_name
74
+ build_dir.mkdir(parents=True, exist_ok=True)
75
+ return build_dir
76
+
77
+ def update_base_dir(self, base_dir: Path):
78
+ self.config['BaseDir'] = str(base_dir)
79
+ with open(self.config_path, 'w', encoding='utf-8') as f:
80
+ json.dump(self.config, f, indent=2)
81
+
82
+ def resolve_path(self, path: str) -> Path:
83
+ r"""Resolve path relative to project root.
84
+
85
+ Paths like '/plugins' or '/include' are treated as relative to project_root.
86
+ True absolute paths like '/home/user/...' or 'C:\...' are kept absolute.
87
+ """
88
+ path_obj = Path(path)
89
+
90
+ # Simple heuristic: If path starts with '/' but has only one component (like /plugins),
91
+ # treat as project-relative. Multi-component paths like /home/user/... are absolute.
92
+ if path.startswith('/'):
93
+ stripped = path.lstrip('/')
94
+
95
+ # Single component like "plugins" or "include" -> project-relative
96
+ if '/' not in stripped:
97
+ return (self.project_root / stripped).resolve()
98
+
99
+ # Multi-component like "home/user/project" -> check if it's truly absolute
100
+ # On Linux, /home/user/... is absolute. On Windows in config, it shouldn't happen.
101
+ # If the absolute path exists, use it. Otherwise treat as project-relative.
102
+ if path_obj.exists():
103
+ return path_obj
104
+ else:
105
+ # Doesn't exist as absolute, treat as project-relative
106
+ return (self.project_root / stripped).resolve()
107
+
108
+ # Windows absolute paths (has drive letter like C:\)
109
+ if path_obj.is_absolute() and path_obj.drive:
110
+ return path_obj
111
+
112
+ # Relative path (no leading slash)
113
+ return (self.project_root / path).resolve()
114
+
115
+ @property
116
+ def include_dir(self) -> Path:
117
+ return self.resolve_path(self.config['include'])
118
+
119
+ @property
120
+ def plugins_dir(self) -> Path:
121
+ return self.resolve_path(self.config['plugins'])
122
+
123
+ @property
124
+ def base_dir(self) -> Path:
125
+ if 'BaseDir' in self.config:
126
+ return Path(self.config['BaseDir'])
127
+ return self.get_build_dir('gcc')
@@ -0,0 +1,19 @@
1
+ from .cpp_api import CppApi
2
+ from .exceptions import (
3
+ CppApiError,
4
+ CppBuildError,
5
+ CppModuleNotFoundError,
6
+ CppModuleOutdatedError,
7
+ CppReloadWarning,
8
+ CppValidationError
9
+ )
10
+
11
+ __all__ = [
12
+ "CppApi",
13
+ "CppApiError",
14
+ "CppBuildError",
15
+ "CppModuleNotFoundError",
16
+ "CppModuleOutdatedError",
17
+ "CppReloadWarning",
18
+ "CppValidationError"
19
+ ]