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.
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,1076 @@
1
+ Metadata-Version: 2.4
2
+ Name: IncludeCPP
3
+ Version: 3.7.3
4
+ Summary: Professional C++ Python bindings with type-generic templates, pystubs and native threading
5
+ Home-page: https://github.com/liliassg/IncludeCPP
6
+ Author: Lilias Hatterscheidt
7
+ Author-email: lilias@includecpp.dev
8
+ License: MIT
9
+ Project-URL: Repository, https://github.com/liliassg/IncludeCPP
10
+ Project-URL: Bug Tracker, https://github.com/liliasg/IncludeCPP/issues
11
+ Keywords: c++,python,bindings,pybind11,template,performance,threading
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: C++
21
+ Classifier: License :: OSI Approved :: MIT License
22
+ Classifier: Operating System :: OS Independent
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: pybind11>=2.11.0
27
+ Requires-Dist: click>=8.0.0
28
+ Requires-Dist: typing-extensions>=4.0.0
29
+ Requires-Dist: requests>=2.28.0
30
+ Dynamic: author-email
31
+ Dynamic: home-page
32
+ Dynamic: license-file
33
+ Dynamic: requires-python
34
+
35
+ # IncludeCPP
36
+
37
+ Write C++ code, use it in Python. Auto-generates pybind11 bindings.
38
+
39
+ ```bash
40
+ pip install IncludeCPP
41
+ ```
42
+
43
+ # First Steps
44
+
45
+ ## Project Setup
46
+
47
+ ```bash
48
+ includecpp init
49
+ ```
50
+
51
+ Creates:
52
+ - `cpp.proj` - project configuration
53
+ - `include/` - your C++ source files
54
+ - `plugins/` - generated binding definitions
55
+
56
+ ## Write C++ Code
57
+
58
+ Put your code in `namespace includecpp`:
59
+
60
+ ```cpp
61
+ // include/fast_list.cpp
62
+ #include <vector>
63
+
64
+ namespace includecpp {
65
+
66
+ class FastList {
67
+ public:
68
+ void append(int val) { data.push_back(val); }
69
+ int get(int i) { return data[i]; }
70
+ private:
71
+ std::vector<int> data;
72
+ };
73
+
74
+ int add(int a, int b) { return a + b; }
75
+
76
+ } // namespace includecpp
77
+ ```
78
+
79
+ The parser only scans code inside `namespace includecpp`. Everything else is ignored.
80
+
81
+ ## Generate Bindings
82
+
83
+ ```bash
84
+ includecpp plugin fast_list include/fast_list.cpp
85
+ ```
86
+
87
+ This runs a C++ parser that:
88
+ 1. Scans your source files for classes, methods, functions
89
+ 2. Extracts signatures, return types, parameter names
90
+ 3. Generates `plugins/fast_list.cp` with binding instructions
91
+
92
+ ## Build
93
+
94
+ ```bash
95
+ includecpp rebuild
96
+ ```
97
+
98
+ Compiles your C++ into a Python extension module (`.pyd` on Windows, `.so` on Linux/Mac).
99
+
100
+ ## Use in Python
101
+
102
+ ```python
103
+ from includecpp import fast_list
104
+
105
+ my_list = fast_list.FastList()
106
+ my_list.append(42)
107
+ print(fast_list.add(1, 2)) # 3
108
+ ```
109
+
110
+ Alternative syntax:
111
+
112
+ ```python
113
+ from includecpp import CppApi
114
+
115
+ api = CppApi()
116
+ fast_list = api.include("fast_list")
117
+ ```
118
+
119
+ # How to Start
120
+
121
+ ## Minimal Example
122
+
123
+ ```bash
124
+ # 1. Create project
125
+ mkdir myproject && cd myproject
126
+ includecpp init
127
+
128
+ # 2. Write C++ (include/math.cpp)
129
+ cat > include/math.cpp << 'EOF'
130
+ namespace includecpp {
131
+ int square(int x) { return x * x; }
132
+ }
133
+ EOF
134
+
135
+ # 3. Generate plugin
136
+ includecpp plugin math include/math.cpp
137
+
138
+ # 4. Build
139
+ includecpp rebuild
140
+
141
+ # 5. Use
142
+ python -c "from includecpp import math; print(math.square(7))"
143
+ ```
144
+
145
+ ## Development Workflow
146
+
147
+ For active development, use `auto`:
148
+
149
+ ```bash
150
+ includecpp auto math
151
+ ```
152
+
153
+ This regenerates the `.cp` file from source and rebuilds in one command.
154
+
155
+ For fastest iteration:
156
+
157
+ ```bash
158
+ includecpp rebuild --fast
159
+ ```
160
+
161
+ Skips unchanged files. ~0.4s when nothing changed.
162
+
163
+ # How IncludeCPP Works
164
+
165
+ ## Architecture
166
+
167
+ ```
168
+ Your C++ Source Plugin File (.cp) Python Module
169
+ include/math.cpp ---> plugins/math.cp ---> math.cpXXX.pyd
170
+ ^ ^ ^
171
+ | | |
172
+ C++ parser Binding config pybind11 compiled
173
+ extracts API (editable) extension
174
+ ```
175
+
176
+ ## The Parser
177
+
178
+ The C++ parser (`parser.cpp`) runs as a compiled executable. It:
179
+
180
+ 1. Tokenizes your C++ source files
181
+ 2. Identifies the `namespace includecpp` block
182
+ 3. Extracts:
183
+ - Class names and inheritance
184
+ - Method signatures (name, return type, parameters)
185
+ - Function signatures
186
+ - Template instantiations
187
+ - Const/static qualifiers
188
+ 4. Outputs structured binding instructions to `.cp` files
189
+
190
+ ## Plugin Files (.cp)
191
+
192
+ The `.cp` format is a declarative binding specification:
193
+
194
+ ```
195
+ SOURCE(math.cpp) math
196
+
197
+ PUBLIC(
198
+ math CLASS(Calculator) {
199
+ CONSTRUCTOR()
200
+ CONSTRUCTOR(int)
201
+ METHOD(add)
202
+ METHOD_CONST(getValue)
203
+ FIELD(value)
204
+ }
205
+
206
+ math FUNC(square)
207
+ math TEMPLATE_FUNC(maximum) TYPES(int, float, double)
208
+ )
209
+ ```
210
+
211
+ Key directives:
212
+ - `SOURCE(file.cpp) module_name` - links source to module
213
+ - `PUBLIC(...)` - defines public bindings
214
+ - `CLASS(Name)` - expose a class
215
+ - `STRUCT(Name)` - expose a struct
216
+ - `FUNC(name)` - expose a free function
217
+ - `METHOD(name)` - expose a class method
218
+ - `METHOD_CONST(name, signature)` - for overloaded methods
219
+ - `TEMPLATE_FUNC(name) TYPES(...)` - instantiate template
220
+ - `CONSTRUCTOR(args)` - expose constructor
221
+ - `FIELD(name)` - expose member variable
222
+ - `DEPENDS(mod1, mod2)` - declare module dependencies
223
+
224
+ ## Build System
225
+
226
+ The build manager:
227
+
228
+ 1. Reads `cpp.proj` configuration
229
+ 2. Parses all `.cp` files in `plugins/`
230
+ 3. Generates pybind11 binding code
231
+ 4. Compiles using CMake with detected compiler (MSVC, GCC, Clang)
232
+ 5. Places output in `~/.includecpp/builds/` (not in your project)
233
+ 6. Creates a registry so Python can find modules
234
+
235
+ Caching layers:
236
+ - **Object files**: Only recompile changed `.cpp` files
237
+ - **Generator cache**: Compiler/CMake detection runs once
238
+ - **SHA256 hashes**: Skip unchanged modules entirely
239
+
240
+ # CLI Reference
241
+
242
+ Use `includecpp <command> --help` for details.
243
+
244
+ | Command | Description |
245
+ |---------|-------------|
246
+ | `init` | Create project structure |
247
+ | `plugin <name> <files>` | Generate .cp from C++ sources |
248
+ | `auto <plugin>` | Regenerate .cp and rebuild |
249
+ | `auto --all` | Regenerate and rebuild all plugins |
250
+ | `auto --all -x <name>` | All plugins except specified |
251
+ | `fix <module>` | Analyze C++ code for issues |
252
+ | `fix --all` | Analyze all modules |
253
+ | `fix --undo` | Revert last fix changes |
254
+ | `fix --ai <module>` | AI-enhanced code analysis |
255
+ | `ai key <key>` | Set OpenAI API key |
256
+ | `ai enable` | Enable AI features |
257
+ | `ai disable` | Disable AI features |
258
+ | `ai model --list` | List available models |
259
+ | `ai model set <name>` | Set active model |
260
+ | `ai --info` | Show AI configuration and usage |
261
+ | `ai optimize <module>` | AI code optimization |
262
+ | `ai optimize --agent "<task>"` | Custom AI task |
263
+ | `ai ask "<question>"` | Ask about project with full context |
264
+ | `ai ask "<question>" <module>` | Ask about specific module |
265
+ | `ai edit "<task>"` | Edit code with AI assistance |
266
+ | `ai edit "<task>" --think2` | Thorough edit mode |
267
+ | `ai undo` | Restore files after AI changes |
268
+ | `rebuild` / `build` | Compile all modules |
269
+ | `get <module>` | Show module API (classes, methods, functions) |
270
+ | `install <name>` | Install community module |
271
+ | `update` | Update IncludeCPP |
272
+ | `bug` | Report an issue |
273
+ | `--doc` | Show documentation |
274
+ | `--changelog` | Show latest version changelog |
275
+ | `cppy convert <files> --cpp` | Convert Python to C++ |
276
+ | `cppy convert <files> --py` | Convert C++ to Python |
277
+ | `cppy convert <files> --cpp --no-h` | Convert without header |
278
+ | `cppy convert <files> --cpp --ai` | AI-assisted conversion |
279
+ | `cppy analyze <files>` | Analyze code structure |
280
+ | `cppy types` | Show type mapping tables |
281
+
282
+ ## Build Flags
283
+
284
+ ```bash
285
+ includecpp rebuild # Standard build
286
+ includecpp rebuild --clean # Full rebuild, clear caches
287
+ includecpp rebuild --fast # Fast incremental (~0.4s if unchanged)
288
+ includecpp rebuild --verbose # Show compiler output
289
+ includecpp rebuild -m crypto # Build specific module only
290
+ includecpp rebuild -j 8 # Use 8 parallel jobs
291
+ includecpp rebuild --keep # Keep generator between builds
292
+ includecpp rebuild --no-incremental # Force full recompilation
293
+ includecpp rebuild --this # Build current directory as module
294
+ ```
295
+
296
+ ## Fast Mode
297
+
298
+ `--fast` enables object file caching:
299
+
300
+ | Scenario | Time |
301
+ |----------|------|
302
+ | No changes | ~0.4s |
303
+ | Source changed | ~5-10s |
304
+ | Full rebuild | ~30s |
305
+
306
+ Clear caches with `--clean`.
307
+
308
+ ## Incompatible Flag Combinations
309
+
310
+ | Flags | Reason |
311
+ |-------|--------|
312
+ | `--fast` + `--no-incremental` | Fast mode requires incremental |
313
+ | `--fast` + `--clean` | Fast uses caches, clean deletes them |
314
+ | `--fast` + `--this` | Not supported together |
315
+ | `--incremental` + `--no-incremental` | Contradictory |
316
+
317
+ # Advanced Features
318
+
319
+ ## AI Integration
320
+
321
+ IncludeCPP integrates with OpenAI for intelligent code analysis and optimization.
322
+
323
+ ### Setup
324
+
325
+ ```bash
326
+ includecpp ai key sk-your-api-key-here
327
+ includecpp ai enable
328
+ ```
329
+
330
+ ### Available Models
331
+
332
+ ```bash
333
+ includecpp ai model --list
334
+ ```
335
+
336
+ - `gpt-5` (default) - 256k context
337
+ - `gpt-5-nano` - 32k context, fast
338
+ - `gpt-4o` - 128k context
339
+ - `gpt-4-turbo` - 128k context
340
+ - `gpt-3.5-turbo` - 16k context
341
+
342
+ ### AI-Enhanced Fix
343
+
344
+ ```bash
345
+ includecpp fix --ai mymodule
346
+ includecpp fix --ai --all
347
+ ```
348
+
349
+ Sends source files to AI for analysis, suggests improvements while preserving all existing functions.
350
+
351
+ ### AI Optimize
352
+
353
+ ```bash
354
+ includecpp ai optimize mymodule # Optimize module sources
355
+ includecpp ai optimize --file src/utils.cpp # Optimize specific files
356
+ includecpp ai optimize --agent mymodule "add SIMD" # Custom task
357
+ ```
358
+
359
+ ### AI Ask
360
+
361
+ Ask questions about your project with full context awareness:
362
+
363
+ ```bash
364
+ includecpp ai ask "where is collision detection?" # Search all modules
365
+ includecpp ai ask "how does chunk generation work?" chunk_utils # Specific module
366
+ includecpp ai ask "explain the biome system" --file include/biomes.cpp
367
+ includecpp ai ask "list all public methods" --all -x tests # All except tests
368
+ ```
369
+
370
+ Supports: module name, --file, --all, -x/--exclude
371
+
372
+ ### AI Edit
373
+
374
+ Edit code with AI assistance:
375
+
376
+ ```bash
377
+ includecpp ai edit "add logging to all methods" collision
378
+ includecpp ai edit "optimize the loop" --file include/utils.cpp
379
+ includecpp ai edit "add error handling" --all --think2 # Thorough mode
380
+ ```
381
+
382
+ Flags:
383
+ - `--file` - specific files
384
+ - `--all` - all modules
385
+ - `-x/--exclude` - exclude modules
386
+ - `--think2` - thorough analysis (more tokens)
387
+
388
+ ### AI Generate (Super Assistant)
389
+
390
+ The most powerful AI command - a full assistant with file operations and command execution.
391
+
392
+ ```bash
393
+ # Basic usage
394
+ includecpp ai generate "add error handling to all functions" --file mymodule.cp
395
+
396
+ # Create new module from scratch
397
+ includecpp ai generate "fast SIMD math library" --t-new-module simd_math
398
+
399
+ # Planning mode (search, analyze, then execute)
400
+ includecpp ai generate "refactor for better performance" --t-plan --think2
401
+
402
+ # With Python file (auto-detect module usage)
403
+ includecpp ai generate "update api methods" --file mymod.cp --python main.py
404
+
405
+ # Full context mode
406
+ includecpp ai generate "comprehensive optimization" --t-max-context --think3
407
+ ```
408
+
409
+ **Flags:**
410
+ | Flag | Description |
411
+ |------|-------------|
412
+ | `--file <path>` | Add files (multiple allowed). .cp files auto-resolve to source |
413
+ | `--think/2/3` | Extended context and planning |
414
+ | `--websearch` | Enable web research |
415
+ | `--t-max-context` | No context reduction |
416
+ | `--t-plan` | Search/grep before executing |
417
+ | `--t-new-module <name>` | Create new module (cpp + plugin + build) |
418
+ | `--python <file.py>` | Include Python file, auto-detect modules |
419
+ | `--confirm` | Skip confirmations |
420
+
421
+ ### AI Tools
422
+
423
+ List available tools for the generate command:
424
+
425
+ ```bash
426
+ includecpp ai tools
427
+ ```
428
+
429
+ Available tools: READ_FILE, WRITE_FILE, EDIT_FILE, DELETE_FILE, CREATE_FOLDER, LIST_FOLDER, SEARCH_FILES, GREP, RUN_CMD, INCLUDECPP_CMD
430
+
431
+ ### Build Error Analysis
432
+
433
+ When AI is enabled and `rebuild` fails, the build error is automatically analyzed:
434
+ - Root cause identification
435
+ - Code fix suggestions
436
+ - Prevention tips
437
+
438
+ ### Configuration
439
+
440
+ ```bash
441
+ includecpp ai --info # Show status, model, usage stats
442
+ includecpp ai disable # Disable without removing key
443
+ ```
444
+
445
+ API key stored in `~/.includecpp/.secret`.
446
+
447
+ ## Overloaded Methods
448
+
449
+ Specify the signature to disambiguate:
450
+
451
+ ```
452
+ MODULE CLASS(Circle) {
453
+ METHOD_CONST(intersects, const Circle&)
454
+ METHOD_CONST(intersects, const Rect&)
455
+ }
456
+ ```
457
+
458
+ ## Template Instantiation
459
+
460
+ ```
461
+ MODULE TEMPLATE_FUNC(maximum) TYPES(int, float, double)
462
+
463
+ MODULE STRUCT(Point) TYPES(int, float) {
464
+ FIELD(x)
465
+ FIELD(y)
466
+ }
467
+ ```
468
+
469
+ Generates `maximum_int`, `maximum_float`, `maximum_double` and `Point_int`, `Point_float`.
470
+
471
+ ## Module Dependencies
472
+
473
+ ```
474
+ DEPENDS(math_utils, geometry)
475
+ ```
476
+
477
+ Ensures dependent modules build first.
478
+
479
+ ## VSCode IntelliSense
480
+
481
+ Generates `.pyi` stub files for autocomplete. Enable in `cpp.proj`:
482
+
483
+ ```json
484
+ {
485
+ "CPI-IntelliSense": true
486
+ }
487
+ ```
488
+
489
+ ## CPPY Code Conversion
490
+
491
+ Convert code between Python and C++ with full support for classes, functions, and type hints.
492
+
493
+ ### Python to C++
494
+
495
+ ```bash
496
+ includecpp cppy convert math_utils.py --cpp
497
+ includecpp cppy convert data.py --cpp --no-h # Skip header
498
+ includecpp cppy convert src/*.py --cpp -o include/
499
+ ```
500
+
501
+ Converts Python code to optimized C++ with:
502
+ - Type hints mapped to C++ types (int, str -> std::string, List -> std::vector)
503
+ - Classes with constructors, methods, fields
504
+ - Functions with proper signatures
505
+ - List comprehensions to STL algorithms
506
+ - Exception handling to try/catch
507
+
508
+ ### C++ to Python
509
+
510
+ ```bash
511
+ includecpp cppy convert utils.cpp --py
512
+ includecpp cppy convert mymodule.cp --py # Auto-resolve SOURCE()
513
+ ```
514
+
515
+ Converts C++ to Python with:
516
+ - STL types mapped to Python equivalents
517
+ - Classes with type hints
518
+ - Methods become class methods with self
519
+ - Structs become dataclasses
520
+
521
+ ### AI-Assisted Conversion
522
+
523
+ ```bash
524
+ includecpp cppy convert complex_lib.py --cpp --ai
525
+ includecpp cppy convert advanced.cpp --py --ai -v
526
+ ```
527
+
528
+ The `--ai` flag enables intelligent conversion with:
529
+ - Section-by-section analysis and processing
530
+ - Automatic `--think2` context level
531
+ - Comprehensive rulebase for precise conversions
532
+ - pybind11 wrappers for Python features without C++ equivalents:
533
+ - Generators -> callback pattern / py::iterator
534
+ - Async/await -> std::async / std::future
535
+ - Context managers -> RAII pattern
536
+ - Duck typing -> templates with concepts
537
+ - Reports API changes to user
538
+ - Fallback to standard conversion if AI unavailable
539
+
540
+ **Workaround Examples:**
541
+ | Python Feature | C++ Workaround |
542
+ |----------------|----------------|
543
+ | `yield` | Callback pattern or py::iterator |
544
+ | `async/await` | std::async + std::future |
545
+ | `with` context | RAII ScopedResource class |
546
+ | List comprehension | transform_to_vector template |
547
+ | Dict comprehension | transform_to_map template |
548
+ | Dynamic attributes | py::object |
549
+
550
+ ### Analyze Code
551
+
552
+ ```bash
553
+ includecpp cppy analyze math.py # View structure
554
+ includecpp cppy analyze utils.cpp --json # JSON output
555
+ ```
556
+
557
+ ### Type Mapping
558
+
559
+ ```bash
560
+ includecpp cppy types # Show conversion tables
561
+ ```
562
+
563
+ | Python | C++ |
564
+ |--------|-----|
565
+ | int | int |
566
+ | float | double |
567
+ | str | std::string |
568
+ | bool | bool |
569
+ | List[T] | std::vector<T> |
570
+ | Dict[K,V] | std::unordered_map<K,V> |
571
+ | Optional[T] | std::optional<T> |
572
+ | Tuple[...] | std::tuple<...> |
573
+
574
+ # Configuration
575
+
576
+ ## cpp.proj
577
+
578
+ ```json
579
+ {
580
+ "project": "MyProject",
581
+ "include": "/include",
582
+ "plugins": "/plugins",
583
+ "compiler": {
584
+ "standard": "c++17",
585
+ "optimization": "O3"
586
+ }
587
+ }
588
+ ```
589
+
590
+ Options:
591
+ - `project` - project name
592
+ - `include` - C++ source directory
593
+ - `plugins` - plugin file directory
594
+ - `compiler.standard` - C++ standard (c++11, c++14, c++17, c++20)
595
+ - `compiler.optimization` - optimization level (O0, O1, O2, O3)
596
+
597
+ # Requirements
598
+
599
+ - Python 3.8+
600
+ - C++ compiler (g++, clang++, MSVC)
601
+ - pybind11 (installed automatically)
602
+ - CMake (for build generation)
603
+
604
+ # Experimental Features
605
+
606
+ The following features are **experimental** and may contain bugs:
607
+
608
+ - `includecpp ai` - AI-powered code assistance
609
+ - `includecpp cppy` - Python to C++ code conversion
610
+
611
+ These commands are **hidden by default**. To enable them:
612
+
613
+ ```bash
614
+ includecpp settings
615
+ ```
616
+
617
+ Then check **"Enable Experimental Features"** and save.
618
+
619
+ **Warning:** Experimental features are under active development and may:
620
+ - Produce incorrect output
621
+ - Have breaking changes between versions
622
+ - Be removed or significantly changed
623
+
624
+ Use at your own discretion. Report issues at: https://github.com/liliassg/IncludeCPP/issues
625
+
626
+ # CSSL - CSO Service Script Language
627
+
628
+ IncludeCPP includes CSSL, a scripting language with advanced data manipulation features.
629
+
630
+ ## Basic Usage
631
+
632
+ ```python
633
+ from includecpp import CSSL
634
+
635
+ # Execute CSSL code
636
+ CSSL.exec('''
637
+ printl("Hello from CSSL!");
638
+
639
+ int x = 10;
640
+ for (i in range(0, 5)) {
641
+ x = x + i;
642
+ }
643
+ printl(x);
644
+ ''')
645
+
646
+ # Execute with arguments
647
+ result = CSSL.exec('''
648
+ int a = parameter.get(0);
649
+ int b = parameter.get(1);
650
+ parameter.return(a + b);
651
+ ''', 5, 3)
652
+ print(result) # 8
653
+ ```
654
+
655
+ ## Live Object Sharing
656
+
657
+ Share Python objects with CSSL scripts. Changes in CSSL reflect back to Python:
658
+
659
+ ```python
660
+ from includecpp import CSSL
661
+
662
+ class Counter:
663
+ def __init__(self):
664
+ self.value = 100
665
+
666
+ counter = Counter()
667
+ cssl = CSSL.CsslLang()
668
+ cssl.share(counter, "cnt")
669
+
670
+ # Modify in CSSL - changes reflect in Python!
671
+ cssl.exec('''
672
+ $cnt.value = $cnt.value - 10;
673
+ printl($cnt.value); // 90
674
+ ''')
675
+
676
+ print(counter.value) # 90 - Changed!
677
+ ```
678
+
679
+ ### Shared Object Syntax
680
+
681
+ - `$name` - Access shared object
682
+ - `$name.property` - Access/modify properties
683
+ - `$name.method()` - Call methods
684
+ - `delete("name")` - Remove shared object
685
+
686
+ ## Data Types
687
+
688
+ ```cssl
689
+ // Basic types
690
+ int x = 42;
691
+ float pi = 3.14;
692
+ string name = "CSSL";
693
+ bool active = true;
694
+
695
+ // Collections
696
+ array<int> arr;
697
+ arr.push(1);
698
+ arr.push(2);
699
+ printl(arr.length()); // 2
700
+
701
+ vector<string> vec;
702
+ vec.push("A");
703
+ vec.push("B");
704
+
705
+ stack<int> s;
706
+ s.push(10);
707
+ s.pop();
708
+ ```
709
+
710
+ ## Control Flow
711
+
712
+ ```cssl
713
+ // If/elif/else
714
+ if (x > 10) {
715
+ printl("big");
716
+ } elif (x > 5) {
717
+ printl("medium");
718
+ } else {
719
+ printl("small");
720
+ }
721
+
722
+ // For loops
723
+ for (i in range(0, 10)) {
724
+ printl(i);
725
+ }
726
+
727
+ for (i in range(0, 10, 2)) { // with step
728
+ printl(i); // 0, 2, 4, 6, 8
729
+ }
730
+
731
+ // Foreach
732
+ array<string> items;
733
+ items.push("A");
734
+ items.push("B");
735
+ foreach (item in items) {
736
+ printl(item);
737
+ }
738
+
739
+ // While
740
+ int count = 0;
741
+ while (count < 5) {
742
+ printl(count);
743
+ count = count + 1;
744
+ }
745
+ ```
746
+
747
+ ## Functions
748
+
749
+ ```cssl
750
+ // Basic function
751
+ void greet(string name) {
752
+ printl("Hello, " + name + "!");
753
+ }
754
+
755
+ // Return value
756
+ int add(int a, int b) {
757
+ return a + b;
758
+ }
759
+
760
+ // Global variables
761
+ global version = "1.0.0";
762
+ printl(@version);
763
+
764
+ // r@ syntax for global declaration
765
+ r@myGlobal = "value";
766
+ printl(@myGlobal);
767
+ ```
768
+
769
+ ## BruteForce Injection System
770
+
771
+ CSSL's unique injection operators for data manipulation:
772
+
773
+ ```cssl
774
+ // <== Move data (replaces target)
775
+ target <== source;
776
+
777
+ // +<== Copy & add to target
778
+ target +<== source;
779
+
780
+ // -<== Move & remove from source
781
+ target -<== source;
782
+
783
+ // <<== Code infusion into functions
784
+ myFunc() <<== {
785
+ printl("Injected code!");
786
+ };
787
+
788
+ // +<<== Add code without replacing
789
+ myFunc() +<<== {
790
+ printl("Additional code!");
791
+ };
792
+ ```
793
+
794
+ ## String Methods
795
+
796
+ ```cssl
797
+ string s = "Hello World";
798
+
799
+ // Methods
800
+ s.length(); // 11
801
+ s.toUpper(); // "HELLO WORLD"
802
+ s.toLower(); // "hello world"
803
+ s.contains("World"); // true
804
+ s.startsWith("Hello"); // true
805
+ s.endsWith("World"); // true
806
+ s.replace("World", "CSSL");
807
+ s.split(" "); // ["Hello", "World"]
808
+ s.trim(); // Remove whitespace
809
+ s.substring(0, 5); // "Hello"
810
+ ```
811
+
812
+ ## CSSL Modules
813
+
814
+ ```python
815
+ # Create callable module
816
+ module = CSSL.module('''
817
+ string name = parameter.get(0);
818
+ printl("Hello, " + name + "!");
819
+ ''')
820
+ module("World") # Prints: Hello, World!
821
+
822
+ # Create module with functions
823
+ math_mod = CSSL.makemodule('''
824
+ int add(int a, int b) {
825
+ return a + b;
826
+ }
827
+
828
+ int multiply(int a, int b) {
829
+ return a * b;
830
+ }
831
+ ''')
832
+ print(math_mod.add(2, 3)) # 5
833
+ print(math_mod.multiply(4, 5)) # 20
834
+ ```
835
+
836
+ ## Inline Payloads
837
+
838
+ ```python
839
+ cssl = CSSL.CsslLang()
840
+
841
+ # Register code as payload
842
+ cssl.code("helpers", '''
843
+ global version = "1.0.0";
844
+ void log(string msg) {
845
+ printl("[LOG] " + msg);
846
+ }
847
+ ''')
848
+
849
+ # Use in CSSL
850
+ cssl.exec('''
851
+ payload("helpers");
852
+ @log("Application started");
853
+ printl(@version);
854
+ ''')
855
+ ```
856
+
857
+ # Changelog
858
+
859
+ ## v3.4.20
860
+ - **Documentation:**
861
+ - Added complete CSSL language documentation
862
+ - Live object sharing with `$name` syntax
863
+ - Data types, control flow, functions, injection system
864
+ - String methods, modules, and inline payloads
865
+
866
+ ## v3.4.19
867
+ - **Critical Bug Fixes:**
868
+ - Fixed generator raw string literal in parser.cpp (regex pattern with `)"` prematurely terminated)
869
+ - Fixed shared object property writes inside loops not persisting to Python
870
+ - Added member_access handling in flow operations for shared objects
871
+
872
+ ## v3.4.18
873
+ - **Bug Fix:**
874
+ - Attempted fix for shared object loop writes (partially fixed)
875
+
876
+ ## v3.4.17
877
+ - **New Feature: Live Object Sharing**
878
+ - `cssl.share(instance, name)` - Share Python objects with CSSL
879
+ - `$name` syntax for accessing shared objects
880
+ - Live bidirectional updates - changes in CSSL reflect in Python
881
+ - `delete("name")` builtin for removing shared objects
882
+ - Shared object metadata stored in `%APPDATA%/IncludeCPP/shared_objects/`
883
+
884
+ ## v3.4.16
885
+ - **CSSL Bug Fixes:**
886
+ - Fixed `startsWith()` and `endsWith()` parser errors
887
+
888
+ ## v3.4.15
889
+ - **CSSL Enhancements:**
890
+ - Added `elif` keyword support
891
+ - Added `range(start, end, step)` with step parameter
892
+ - Added `begin()` and `end()` methods to all collection types
893
+ - Added `cssl.code(name, code)` for inline payload registration
894
+
895
+ ## v3.4.2
896
+ - **New Feature: `exec` Command**
897
+ - Interactive REPL for quick code testing without creating files
898
+ - `includecpp exec py` - Python REPL with IncludeCPP support
899
+ - `includecpp exec cpp` - C++ REPL with auto-compilation
900
+ - Auto-import modules: `includecpp exec py mymodule`
901
+ - Auto-import from plugins: `includecpp exec py plugins/math.cp`
902
+ - Import all modules: `includecpp exec py --all`
903
+ - Enter code line by line, press ENTER on empty line to execute
904
+
905
+ ## v3.4.1
906
+ - **Bug Fixes:**
907
+ - fix command: Fixed false positives for unused variables (sum, memory_) using word-boundary matching
908
+ - CPPY: C++ reserved words (double, int, void, etc.) now properly escaped as Python identifiers
909
+ - CPPY: C++ STL functions (accumulate, find, sort, reverse) properly converted to Python equivalents
910
+ - CPPY: Member variables with trailing underscore (memory_) now get self. prefix
911
+ - CPPY: Private class members now detected for self. prefix conversion
912
+ - Plugin: Auto-detect header files from #include directives in source files
913
+
914
+ ## v3.4.0
915
+ - **CodeMaker Major Update:**
916
+ - New Source node type with 8 connection ports for code generation
917
+ - Smart code generation: Source nodes generate Python/Plugin files with all connected nodes included
918
+ - Right-click on Source node: "Create Python" creates .py in project root
919
+ - Right-click on Source node: "Create Plugin" creates .cp, .h, .cpp in plugins/ and include/
920
+ - Code options hidden after file generation (prevents duplicates)
921
+ - Enhanced description display with background rect in node body
922
+ - Arrow key navigation to pan the canvas
923
+ - New toolbar buttons: Align H, Align V, Auto-Arrange
924
+ - Quick-add buttons: +Source, +Class, +Function
925
+ - Properties Panel on the right side for editing selected nodes
926
+ - Auto-arrange algorithm for grid layout
927
+ - Align horizontal/vertical for selected nodes
928
+ - **Bug Fixes:**
929
+ - Changelog encoding fixes for Windows console
930
+ - CPPY C++ keyword escaping (double, int, etc.)
931
+ - CPPY C++ to Python syntax conversion improvements
932
+ - CPPY self. prefix for member variables
933
+ - Plugin auto-header detection from #include
934
+
935
+ ## v3.3.21
936
+ - **Encoding Fixes:**
937
+ - Replaced Unicode arrow characters with ASCII in changelog (Windows console compatibility)
938
+
939
+ ## v3.3.20
940
+ - **Bug Fixes:**
941
+ - Fixed `QPoint.toPoint()` AttributeError in rubber band selection
942
+ - Added UTF-8 encoding to all file read/write operations for cross-platform compatibility
943
+ - Fixed bare `except:` clauses to proper `except Exception:` in settings_ui.py
944
+
945
+ ## v3.3.19
946
+ - **PyQt6 Import Fix:**
947
+ - Fixed silent import failure that caused "PyQt6 not installed" error even when installed
948
+ - Moved `QUndoStack`, `QUndoCommand`, `QShortcut` from QtWidgets to QtGui (correct location in PyQt6)
949
+
950
+ ## v3.3.18
951
+ - **CodeMaker Visual Editor (Experimental):**
952
+ - Complete rewrite of `project` command with professional-grade UI
953
+ - 24 node types across 5 categories (Code Structures, Functions, Data, Organization, Flow)
954
+ - Undo/redo system with full command history
955
+ - Multi-selection with rubber band and Ctrl+Click
956
+ - Copy/paste/duplicate with Ctrl+C/V/D shortcuts
957
+ - Node grouping with Ctrl+G
958
+ - Code generation for C++ (header/source) and Python
959
+ - Search and filter nodes by name and type
960
+ - Export to PNG/SVG with transparency support
961
+ - Categorized right-click context menus
962
+ - Toolbar with common actions
963
+ - Cross-platform font detection (Windows/macOS/Linux)
964
+ - DPI-aware scaling for high-resolution displays
965
+ - **Experimental Feature Gating:**
966
+ - `project` command now requires "Enable Experimental Features" in settings
967
+ - Consistent gating with `ai` and `cppy` commands
968
+
969
+ ## v3.3.16-3.3.17
970
+ - **QPen Bug Fixes:**
971
+ - Fixed 3 instances of `setPen(Qt.PenStyle.NoPen)` to `setPen(QPen(Qt.PenStyle.NoPen))`
972
+ - Proper QPen construction for PyQt6 compatibility
973
+
974
+ ## v3.3.15
975
+ - **CPPY Converter Major Fixes:**
976
+ - Functions returning container now get `std::vector<T>` return type (e.g., shuffle_list)
977
+ - `max(items)` / `min(items)` now correctly uses `std::max_element` / `std::min_element`
978
+ - Template element parameters (`value`, `item`) now use `const T&` instead of `double`
979
+ - Explicit template instantiations now include correct return types and all parameters
980
+ - Python docstrings now become C++ comments instead of dangling string literals
981
+ - **Unicode Fallback System:**
982
+ - AI progress indicators use ASCII fallbacks on Windows terminals
983
+ - Fixed encoding errors in changelog display
984
+
985
+ ## v3.3.14
986
+ - **Experimental Features System:**
987
+ - AI and CPPY commands now hidden by default
988
+ - Enable via Settings UI: "Enable Experimental Features" checkbox
989
+ - Warning about potential bugs documented in README
990
+ - **Settings UI Improvements:**
991
+ - Added scrollable content area to prevent layout squashing
992
+ - New "Experimental" section with orange header
993
+ - Better spacing and styling for all elements
994
+ - Preserved existing config values on save
995
+
996
+ ## v3.3.13
997
+ - **Template Support for Generic Functions:**
998
+ - Generic container parameters now generate proper C++ templates
999
+ - `template<typename T> T getChoice(const std::vector<T>& choices)` instead of invalid `std::vector<auto>`
1000
+ - Automatic explicit template instantiations for int, double, std::string
1001
+ - **AI Conversion - No pybind11:**
1002
+ - AI no longer generates pybind11 code - IncludeCPP handles bindings automatically
1003
+ - Clean C++ output in `namespace includecpp`
1004
+ - User runs `includecpp plugin` separately to generate bindings
1005
+ - **AI Context - Dynamic README:**
1006
+ - AI now loads README.md dynamically for accurate IncludeCPP documentation
1007
+ - Better understanding of IncludeCPP workflow and patterns
1008
+
1009
+ ## v3.3.12
1010
+ - **Smart Type Inference:**
1011
+ - Parameter types now inferred from common naming patterns (start/end -> int, name/path -> string, etc.)
1012
+ - Variable type tracking throughout conversion for accurate string detection
1013
+ - Loop variable types inferred from iterables (enumerate, for loops)
1014
+ - **String Conversion Fix:**
1015
+ - No more `std::to_string()` on already-string variables in f-strings
1016
+ - `_is_string_expr()` method for comprehensive string type detection
1017
+ - String variables detected by name, type tracking, and method calls
1018
+ - **AI Conversion Improvements:**
1019
+ - Explicit file extension enforcement (.cpp NOT .cp, .h NOT .hpp)
1020
+ - Better --no-h flag handling with clear AI instructions
1021
+ - AI can request clarification on unconvertible modules (tkinter, pygame, etc.)
1022
+ - User prompted for input when AI needs guidance
1023
+
1024
+ ## v3.3.11
1025
+ - **CPPY Converter Improvements:**
1026
+ - Added `_safe_arg()` and `_safe_get()` for robust bounds checking on all args
1027
+ - Added comprehensive try-except handling in `_convert_expr()` with warnings
1028
+ - Improved type inference with empty container handling and exception safety
1029
+ - Complete string escaping: `\0`, `\f`, `\b`, `\a`, `\v` now properly escaped
1030
+ - **New Python Constructs:**
1031
+ - Dict comprehensions: `{k: v for k, v in items}` now converts to C++
1032
+ - Set comprehensions: `{x for x in items}` now converts to C++
1033
+ - Generator expressions: `(x for x in items)` now converts to vector
1034
+ - Tuple unpacking: `a, b = func()` now uses C++17 structured bindings
1035
+ - **AI Conversion Flags:**
1036
+ - New `--think` flag for less context mode
1037
+ - New `--think3` flag for maximum context mode
1038
+ - New `--websearch` flag for web search in AI conversion
1039
+ - Default: `--think2` mode (unchanged behavior)
1040
+
1041
+ ## v3.3.10
1042
+ - **CPPY Converter seeded RNG fixes:**
1043
+ - Fixed `rng = random.Random(seed)` then `rng.randint()` - now properly tracks seeded RNG variables
1044
+ - Fixed `random.choices(...)[0]` subscript - returns single element directly without `[0]`
1045
+ - Seeded RNG methods (randint, uniform, choice, random) now use the tracked variable with proper C++ distributions
1046
+
1047
+ ## v3.3.9
1048
+ - **CPPY Converter fixes:**
1049
+ - Added f-string (JoinedStr) support - f"text {expr}" now converts to string concatenation
1050
+ - Fixed `random.Random(seed).method()` chained calls - now generates proper inline lambda with seeded RNG
1051
+ - Fixed `random.choices(items, weights=weights)` keyword argument handling
1052
+ - Improved string type detection in f-string expressions
1053
+
1054
+ ## v3.3.8
1055
+ - **Major rulebased converter improvements:**
1056
+ - Added Python `random` module support (randint, uniform, choice, sample, shuffle, gauss, etc.)
1057
+ - Added `os` module support (getcwd, path.join, path.exists, listdir, mkdir, etc.)
1058
+ - Added `time` module support (sleep, time, perf_counter, monotonic)
1059
+ - Added `sys` module support (exit, platform)
1060
+ - Added `math` module support (sqrt, pow, sin, cos, log, etc.)
1061
+ - Added `re` (regex) module support (match, search, sub, findall)
1062
+ - Added `threading` module support (Thread, Lock, Semaphore, etc.)
1063
+ - Added `collections` module support (deque, defaultdict, Counter)
1064
+ - Added `pathlib.Path` support
1065
+ - **Unconvertible code detection:**
1066
+ - Automatically detects GUI frameworks (tkinter, PyQt, PySide, pygame) and other unconvertible modules
1067
+ - Shows red warning with line numbers when unconvertible code is found
1068
+ - New `--force` flag to convert anyway (with `/* UNCONVERTIBLE */` comments)
1069
+ - Supports 30+ modules in detection (numpy, pandas, flask, django, etc.)
1070
+ - Fixed duplicate file output in `cppy convert --ai`
1071
+ - Plugin command now skips inline and underscore-prefixed functions
1072
+
1073
+
1074
+ ---
1075
+
1076
+ MIT License | v3.4.20 | [GitHub](https://github.com/liliassg/IncludeCPP)