simvx.core.export¶
Export/build system – package SimVX games as distributable Python packages.
Scans a project directory, collects assets matching glob patterns,
generates a valid Python package structure (pyproject.toml, entry point,
assets), and optionally builds a wheel via uv build. Supports
multiple export modes: wheel packaging and standalone folder export.
Public API: ExportMode – enum selecting the export format ExportPreset – dataclass describing what/how to export AssetManifest – scans, hashes, and tracks project assets ProjectExporter – orchestrates the full export pipeline bundle_project() – single-call convenience wrapper
Example: from simvx.core.export import ExportMode, ExportPreset, ProjectExporter
preset = ExportPreset(
name="MyGame-Linux",
platform="linux",
entry_point="main.py",
include_patterns=["assets/**/*", "scenes/**/*.json"],
version="1.0.0",
export_mode=ExportMode.FOLDER,
)
exporter = ProjectExporter()
exporter.export("./my_game", preset, "./dist")
Module Contents¶
Classes¶
How the project should be packaged. |
|
Describes how a SimVX project should be exported. |
|
A single file to include in the export. |
|
Scans a project directory and builds a list of :class: |
|
Orchestrates the full export pipeline for a SimVX project. |
Functions¶
One-call export: build an :class: |
Data¶
API¶
- simvx.core.export.log¶
‘getLogger(…)’
- simvx.core.export.__all__¶
[‘ExportMode’, ‘ExportPreset’, ‘AssetEntry’, ‘AssetManifest’, ‘ProjectExporter’, ‘ExportError’, ‘bun…
- simvx.core.export.PLATFORMS¶
‘frozenset(…)’
- exception simvx.core.export.ExportError¶
Bases:
ExceptionRaised when export validation or execution fails.
Initialization
Initialize self. See help(type(self)) for accurate signature.
- class __cause__¶
- class __context__¶
- __delattr__()¶
- __dir__()¶
- __eq__()¶
- __format__()¶
- __ge__()¶
- __getattribute__()¶
- __getstate__()¶
- __gt__()¶
- __hash__()¶
- __le__()¶
- __lt__()¶
- __ne__()¶
- __new__()¶
- __reduce__()¶
- __reduce_ex__()¶
- __repr__()¶
- __setattr__()¶
- __setstate__()¶
- __sizeof__()¶
- __str__()¶
- __subclasshook__()¶
- class __suppress_context__¶
- class __traceback__¶
- add_note()¶
- class args¶
- with_traceback()¶
- class simvx.core.export.ExportMode¶
Bases:
enum.IntEnumHow the project should be packaged.
Initialization
Initialize self. See help(type(self)) for accurate signature.
- WHEEL¶
0
- FOLDER¶
1
- __abs__()¶
- __add__()¶
- __and__()¶
- __bool__()¶
- __ceil__()¶
- __delattr__()¶
- __dir__()¶
- __divmod__()¶
- __eq__()¶
- __float__()¶
- __floor__()¶
- __floordiv__()¶
- __format__()¶
- __ge__()¶
- __getattribute__()¶
- __getnewargs__()¶
- __getstate__()¶
- __gt__()¶
- __hash__()¶
- __index__()¶
- __int__()¶
- __invert__()¶
- __le__()¶
- __lshift__()¶
- __lt__()¶
- __mod__()¶
- __mul__()¶
- __ne__()¶
- __neg__()¶
- __new__()¶
- __or__()¶
- __pos__()¶
- __pow__()¶
- __radd__()¶
- __rand__()¶
- __rdivmod__()¶
- __reduce__()¶
- __reduce_ex__()¶
- __repr__()¶
- __rfloordiv__()¶
- __rlshift__()¶
- __rmod__()¶
- __rmul__()¶
- __ror__()¶
- __round__()¶
- __rpow__()¶
- __rrshift__()¶
- __rshift__()¶
- __rsub__()¶
- __rtruediv__()¶
- __rxor__()¶
- __setattr__()¶
- __sizeof__()¶
- __str__()¶
- __sub__()¶
- __subclasshook__()¶
- __truediv__()¶
- __trunc__()¶
- __xor__()¶
- as_integer_ratio()¶
- bit_count()¶
- bit_length()¶
- conjugate()¶
- class denominator¶
- class imag¶
- is_integer()¶
- class numerator¶
- class real¶
- to_bytes()¶
- __deepcopy__(memo)¶
- __copy__()¶
- name()¶
- value()¶
- class simvx.core.export.ExportPreset¶
Describes how a SimVX project should be exported.
Attributes: name: Human-readable preset name (also used as the package slug). platform: Target platform –
"windows","linux","macos", or"web". entry_point: Path to the main script relative to the project root. include_patterns: Glob patterns selecting files to ship (relative to project root). exclude_patterns: Glob patterns for files to skip (merged with built-in excludes). icon_path: Optional icon file (relative to project root). version: Semantic version string for the exported package. description: One-line description embedded in pyproject.toml. custom_features: Arbitrary platform-specific flags forwarded to build hooks. build_wheel: Whetherexport()should also invokeuv build(wheel mode only). export_mode: Export format – WHEEL (Python package) or FOLDER (standalone folder). create_zip: Zip the output folder (folder mode only). scene_to_code: Generate .py alongside .json scene files.- name: str¶
‘MyGame’
- platform: str¶
‘linux’
- entry_point: str¶
‘main.py’
- include_patterns: list[str]¶
‘field(…)’
- exclude_patterns: list[str]¶
‘field(…)’
- icon_path: str | None¶
None
- version: str¶
‘0.1.0’
- description: str¶
‘A SimVX game.’
- custom_features: dict[str, object]¶
‘field(…)’
- build_wheel: bool¶
False
- export_mode: simvx.core.export.ExportMode¶
None
- create_zip: bool¶
False
- scene_to_code: bool¶
False
- property package_name: str¶
Normalised package name derived from name (PEP 503).
- class simvx.core.export.AssetEntry¶
A single file to include in the export.
Attributes: relative: Path relative to project root (always forward-slash separated). size: File size in bytes. sha256: Hex-encoded SHA-256 digest.
- relative: str¶
None
- size: int¶
None
- sha256: str¶
None
- class simvx.core.export.AssetManifest¶
Scans a project directory and builds a list of :class:
AssetEntryitems.The manifest can be serialised to / loaded from JSON for incremental rebuilds and cache invalidation.
Initialization
- collect(project_dir: str | pathlib.Path, preset: simvx.core.export.ExportPreset) list[simvx.core.export.AssetEntry]¶
Walk project_dir, select files matching preset patterns, hash them.
Returns the collected :class:
AssetEntrylist (also stored inself.entries).
- write_manifest(path: str | pathlib.Path) None¶
Write the current entries to a JSON manifest file.
- classmethod load_manifest(path: str | pathlib.Path) simvx.core.export.AssetManifest¶
Load a previously-written manifest from path.
- property total_size: int¶
Sum of all entry sizes in bytes.
- diff(other: simvx.core.export.AssetManifest) tuple[list[simvx.core.export.AssetEntry], list[simvx.core.export.AssetEntry], list[simvx.core.export.AssetEntry]]¶
Compare two manifests, returning (added, removed, changed) lists.
- class simvx.core.export.ProjectExporter¶
Orchestrates the full export pipeline for a SimVX project.
- export(project_dir: str | pathlib.Path, preset: simvx.core.export.ExportPreset, output_dir: str | pathlib.Path) pathlib.Path¶
Export a project according to preset into output_dir.
Dispatches to
_export_wheel()or_export_folder()based onpreset.export_mode.Returns: The :class:
Pathto the generated package/folder root inside output_dir.
- validate_preset(preset: simvx.core.export.ExportPreset, project_dir: str | pathlib.Path | None = None) list[str]¶
Check a preset for problems. Returns a list of warning strings; raises on fatal errors.
- estimate_size(project_dir: str | pathlib.Path, preset: simvx.core.export.ExportPreset) int¶
Calculate approximate export size in bytes without copying anything.
- simvx.core.export.bundle_project(project_dir: str | pathlib.Path, output_dir: str | pathlib.Path, *, name: str | None = None, platform: str = 'linux', entry_point: str | None = None, include_patterns: list[str] | None = None, exclude_patterns: list[str] | None = None, version: str = '0.1.0', description: str = 'A SimVX game.', build_wheel: bool = False, export_mode: simvx.core.export.ExportMode = ExportMode.FOLDER, create_zip: bool = False, scene_to_code: bool = False, **custom_features: object) pathlib.Path¶
One-call export: build an :class:
ExportPresetfrom keyword args and run the export.If
project.simvxexists in project_dir, its settings are used as fallbacks for name and entry_point.Returns the path to the generated package/folder directory.