IncludeCPP 4.6.8__tar.gz → 4.7.0__tar.gz
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-4.6.8 → includecpp-4.7.0}/IncludeCPP.egg-info/PKG-INFO +1 -1
- {includecpp-4.6.8 → includecpp-4.7.0}/PKG-INFO +1 -1
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/__init__.py +32 -1
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/cli/commands.py +43 -9
- {includecpp-4.6.8 → includecpp-4.7.0}/pyproject.toml +1 -1
- {includecpp-4.6.8 → includecpp-4.7.0}/IncludeCPP.egg-info/SOURCES.txt +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/IncludeCPP.egg-info/dependency_links.txt +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/IncludeCPP.egg-info/entry_points.txt +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/IncludeCPP.egg-info/requires.txt +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/IncludeCPP.egg-info/top_level.txt +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/LICENSE +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/MANIFEST.in +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/README.md +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/CHANGELOG.md +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/DOCUMENTATION.md +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/__init__.pyi +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/__main__.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/cli/__init__.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/cli/config_parser.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/__init__.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/ai_integration.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/build_manager.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cpp_api.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cpp_api.pyi +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cpp_api_extensions.pyi +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cppy_converter.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/CSSL_DOCUMENTATION.md +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/CSSL_DOCUMENTATION_NEW.md +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/__init__.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cpp/build/api.pyd +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cpp/build/cssl_core.pyi +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cpp/build/libgcc_s_seh-1.dll +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cpp/build/libstdc++-6.dll +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cpp/build/libwinpthread-1.dll +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cpp/cssl_core.cp +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cpp/cssl_lexer.hpp +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cssl_builtins.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cssl_builtins.pyi +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cssl_compiler.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cssl_events.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cssl_languages.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cssl_modules.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cssl_optimizer.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cssl_parser.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cssl_runtime.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cssl_syntax.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl/cssl_types.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl_bridge.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/cssl_bridge.pyi +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/error_catalog.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/error_formatter.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/exceptions.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/homeserver.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/path_discovery.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/project_ui.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/core/settings_ui.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/generator/__init__.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/generator/parser.cpp +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/generator/parser.h +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/generator/type_resolver.cpp +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/generator/type_resolver.h +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/py.typed +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/templates/cpp.proj.template +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/vscode/__init__.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/vscode/cssl/__init__.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/vscode/cssl/extension.js +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/vscode/cssl/images/cssl.png +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/vscode/cssl/images/cssl_pl.png +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/vscode/cssl/language-configuration.json +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/vscode/cssl/package.json +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/vscode/cssl/snippets/cssl.snippets.json +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/requirements.txt +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/setup.cfg +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/setup.py +0 -0
- {includecpp-4.6.8 → includecpp-4.7.0}/tests/test_multilang.py +0 -0
|
@@ -2,14 +2,31 @@ from .core.cpp_api import CppApi
|
|
|
2
2
|
from .core import cssl_bridge as CSSL
|
|
3
3
|
import warnings
|
|
4
4
|
import os
|
|
5
|
+
import sys
|
|
5
6
|
from pathlib import Path
|
|
6
7
|
|
|
7
|
-
__version__ = "4.
|
|
8
|
+
__version__ = "4.7.0"
|
|
8
9
|
__all__ = ["CppApi", "CSSL"]
|
|
9
10
|
|
|
10
11
|
# Module-level cache for C++ modules
|
|
11
12
|
_api_instance = None
|
|
12
13
|
_loaded_modules = {}
|
|
14
|
+
_frozen_api = None # Cached API module for frozen (PyInstaller) mode
|
|
15
|
+
|
|
16
|
+
def _is_frozen():
|
|
17
|
+
"""Check if running in a frozen PyInstaller bundle."""
|
|
18
|
+
return getattr(sys, 'frozen', False)
|
|
19
|
+
|
|
20
|
+
def _get_frozen_api():
|
|
21
|
+
"""Get the bundled API module when running frozen."""
|
|
22
|
+
global _frozen_api
|
|
23
|
+
if _frozen_api is None:
|
|
24
|
+
try:
|
|
25
|
+
import api
|
|
26
|
+
_frozen_api = api
|
|
27
|
+
except ImportError:
|
|
28
|
+
_frozen_api = False # Mark as not available
|
|
29
|
+
return _frozen_api if _frozen_api else None
|
|
13
30
|
|
|
14
31
|
def _get_api():
|
|
15
32
|
"""Get or create singleton CppApi instance.
|
|
@@ -43,6 +60,20 @@ def __getattr__(name: str):
|
|
|
43
60
|
if name in _loaded_modules:
|
|
44
61
|
return _loaded_modules[name]
|
|
45
62
|
|
|
63
|
+
# In frozen mode (PyInstaller), try to get module from bundled api
|
|
64
|
+
if _is_frozen():
|
|
65
|
+
frozen_api = _get_frozen_api()
|
|
66
|
+
if frozen_api and hasattr(frozen_api, name):
|
|
67
|
+
module = getattr(frozen_api, name)
|
|
68
|
+
_loaded_modules[name] = module
|
|
69
|
+
return module
|
|
70
|
+
# If not found in frozen api, raise helpful error
|
|
71
|
+
raise AttributeError(
|
|
72
|
+
f"Module '{name}' not found in bundled executable. "
|
|
73
|
+
f"Ensure it was included during build with 'includecpp --make-exe'."
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
# Normal mode: use CppApi
|
|
46
77
|
api = _get_api()
|
|
47
78
|
|
|
48
79
|
if name not in api.registry:
|
|
@@ -430,10 +430,17 @@ def _show_doc(search_term: str = None):
|
|
|
430
430
|
_safe_echo("=" * 70)
|
|
431
431
|
|
|
432
432
|
|
|
433
|
-
def _make_executable(script_path: str, onefile: bool = True, console: bool = True, icon: str = None):
|
|
433
|
+
def _make_executable(script_path: str, output_name: str = None, onefile: bool = True, console: bool = True, icon: str = None):
|
|
434
434
|
"""Build .exe from Python script using PyInstaller.
|
|
435
435
|
|
|
436
436
|
Auto-detects dependencies, rebuilds includecpp if needed, and cleans up.
|
|
437
|
+
|
|
438
|
+
Args:
|
|
439
|
+
script_path: Path to the Python script
|
|
440
|
+
output_name: Optional custom name for output executable (without .exe)
|
|
441
|
+
onefile: Build as single file (True) or directory (False)
|
|
442
|
+
console: Show console window (True) or windowed mode (False)
|
|
443
|
+
icon: Path to icon file (.ico)
|
|
437
444
|
"""
|
|
438
445
|
import re
|
|
439
446
|
import shutil
|
|
@@ -449,10 +456,12 @@ def _make_executable(script_path: str, onefile: bool = True, console: bool = Tru
|
|
|
449
456
|
return
|
|
450
457
|
|
|
451
458
|
script_dir = script_path.parent
|
|
452
|
-
script_name = script_path.stem
|
|
459
|
+
script_name = output_name if output_name else script_path.stem
|
|
453
460
|
|
|
454
461
|
click.echo()
|
|
455
462
|
click.secho(f"Building executable from: {script_path.name}", fg='cyan', bold=True)
|
|
463
|
+
if output_name:
|
|
464
|
+
click.echo(f" Output name: {output_name}.exe")
|
|
456
465
|
click.echo("=" * 50)
|
|
457
466
|
|
|
458
467
|
# Check if PyInstaller is installed
|
|
@@ -511,6 +520,7 @@ def _make_executable(script_path: str, onefile: bool = True, console: bool = Tru
|
|
|
511
520
|
|
|
512
521
|
# Build data files list for PyInstaller
|
|
513
522
|
datas = []
|
|
523
|
+
binaries = [] # For .pyd/.so files
|
|
514
524
|
hidden_imports = []
|
|
515
525
|
|
|
516
526
|
# If includecpp is used, rebuild and include the compiled modules
|
|
@@ -544,9 +554,23 @@ def _make_executable(script_path: str, onefile: bool = True, console: bool = Tru
|
|
|
544
554
|
# Rebuild the modules
|
|
545
555
|
click.echo(" Rebuilding C++ modules...")
|
|
546
556
|
try:
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
557
|
+
from ..core.build_manager import BuildManager
|
|
558
|
+
from .config_parser import CppProjectConfig
|
|
559
|
+
from .compiler_detect import detect_compiler
|
|
560
|
+
|
|
561
|
+
config = CppProjectConfig(config_path=cpp_proj_path)
|
|
562
|
+
project_root = cpp_proj_path.parent
|
|
563
|
+
compiler = detect_compiler()
|
|
564
|
+
build_dir_path = config.get_build_dir(compiler)
|
|
565
|
+
build_dir_path.mkdir(parents=True, exist_ok=True)
|
|
566
|
+
|
|
567
|
+
builder = BuildManager(project_root, build_dir_path, config)
|
|
568
|
+
success = builder.rebuild(incremental=True)
|
|
569
|
+
|
|
570
|
+
if success:
|
|
571
|
+
click.secho(" Rebuild complete!", fg='green')
|
|
572
|
+
else:
|
|
573
|
+
click.secho(" Warning: Rebuild had errors", fg='yellow')
|
|
550
574
|
except Exception as e:
|
|
551
575
|
click.secho(f" Warning: Rebuild failed: {e}", fg='yellow')
|
|
552
576
|
|
|
@@ -561,8 +585,8 @@ def _make_executable(script_path: str, onefile: bool = True, console: bool = Tru
|
|
|
561
585
|
|
|
562
586
|
for pyd_file in pyd_files:
|
|
563
587
|
click.echo(f" Including: {pyd_file.name}")
|
|
564
|
-
# Add to
|
|
565
|
-
|
|
588
|
+
# Add as binary to root (importable as 'api')
|
|
589
|
+
binaries.append((str(pyd_file), '.'))
|
|
566
590
|
|
|
567
591
|
if pyd_files:
|
|
568
592
|
click.secho(f" Added {len(pyd_files)} compiled module(s)", fg='green')
|
|
@@ -575,6 +599,7 @@ def _make_executable(script_path: str, onefile: bool = True, console: bool = Tru
|
|
|
575
599
|
click.secho(" Warning: cpp.proj not found. C++ modules may not be included.", fg='yellow')
|
|
576
600
|
|
|
577
601
|
hidden_imports.append('includecpp')
|
|
602
|
+
hidden_imports.append('api') # The compiled module
|
|
578
603
|
|
|
579
604
|
# Add GUI-specific settings
|
|
580
605
|
if uses_pyqt6:
|
|
@@ -613,10 +638,18 @@ def _make_executable(script_path: str, onefile: bool = True, console: bool = Tru
|
|
|
613
638
|
if icon:
|
|
614
639
|
cmd.extend(['--icon', str(Path(icon).resolve())])
|
|
615
640
|
|
|
641
|
+
# Set output name if specified
|
|
642
|
+
if output_name:
|
|
643
|
+
cmd.extend(['--name', output_name])
|
|
644
|
+
|
|
616
645
|
# Add data files
|
|
617
646
|
for src, dest in datas:
|
|
618
647
|
cmd.extend(['--add-data', f'{src}{os.pathsep}{dest}'])
|
|
619
648
|
|
|
649
|
+
# Add binary files (.pyd/.so)
|
|
650
|
+
for src, dest in binaries:
|
|
651
|
+
cmd.extend(['--add-binary', f'{src}{os.pathsep}{dest}'])
|
|
652
|
+
|
|
620
653
|
# Add hidden imports
|
|
621
654
|
for imp in hidden_imports:
|
|
622
655
|
cmd.extend(['--hidden-import', imp])
|
|
@@ -706,6 +739,7 @@ def _make_executable(script_path: str, onefile: bool = True, console: bool = Tru
|
|
|
706
739
|
@click.option('--changelog', 'show_changelog', is_flag=True, help='Show changelog (last 2 releases by default)')
|
|
707
740
|
@click.option('--all', 'changelog_all', is_flag=True, help='Show all changelog entries (use with --changelog)')
|
|
708
741
|
@click.option('--make-exe', 'make_exe_path', type=click.Path(exists=True), help='Build .exe from Python script')
|
|
742
|
+
@click.option('--exe-name', 'exe_name', type=str, help='Output executable name (without .exe)')
|
|
709
743
|
@click.option('--onefile/--onedir', 'onefile', default=True, help='Build as single file or directory (default: onefile)')
|
|
710
744
|
@click.option('--console/--windowed', 'console', default=True, help='Show console window or not (default: console)')
|
|
711
745
|
@click.option('--icon', type=click.Path(exists=True), help='Icon file for executable (.ico)')
|
|
@@ -720,7 +754,7 @@ def _make_executable(script_path: str, onefile: bool = True, console: bool = Tru
|
|
|
720
754
|
@click.option('--9', 'changelog_9', is_flag=True, hidden=True)
|
|
721
755
|
@click.option('--10', 'changelog_10', is_flag=True, hidden=True)
|
|
722
756
|
@click.pass_context
|
|
723
|
-
def cli(ctx, doc_search, doc_flag, show_changelog, changelog_all, make_exe_path, onefile, console, icon,
|
|
757
|
+
def cli(ctx, doc_search, doc_flag, show_changelog, changelog_all, make_exe_path, exe_name, onefile, console, icon,
|
|
724
758
|
changelog_1, changelog_2, changelog_3, changelog_4, changelog_5, changelog_6, changelog_7,
|
|
725
759
|
changelog_8, changelog_9, changelog_10):
|
|
726
760
|
"""IncludeCPP - C++ Performance in Python, Zero Hassle
|
|
@@ -766,7 +800,7 @@ def cli(ctx, doc_search, doc_flag, show_changelog, changelog_all, make_exe_path,
|
|
|
766
800
|
|
|
767
801
|
# Handle --make-exe
|
|
768
802
|
if make_exe_path:
|
|
769
|
-
_make_executable(make_exe_path, onefile=onefile, console=console, icon=icon)
|
|
803
|
+
_make_executable(make_exe_path, output_name=exe_name, onefile=onefile, console=console, icon=icon)
|
|
770
804
|
ctx.exit(0)
|
|
771
805
|
|
|
772
806
|
# If no subcommand is given, show help
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "IncludeCPP"
|
|
7
|
-
version = "4.
|
|
7
|
+
version = "4.7.0"
|
|
8
8
|
description = "Professional C++ Python bindings with type-generic templates, pystubs and native threading"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|