Reference#
crazyhusk#
Initializes the crazyhusk package on import.
crazyhusk.build#
Wrapper objects for Unreal Engine builds.
- class crazyhusk.build.Buildable[source]#
Abstract base class for objects buildable by Unreal’s build tools.
- default_build_configuration()[source]#
Get the default build configuration for this Buildable.
- Return type
str
- default_local_platform()[source]#
Get the default build platform for the local system.
- Return type
str
- abstract property engine: Optional[UnrealEngine]#
Get the associated UnrealEngine object for this Buildable.
- abstract get_build_command(target=None, configuration=None, platform=None, *extra_switches, **extra_parameters)[source]#
Iterate strings of subprocess arguments to execute the build.
- Parameters
target (Optional[str]) –
configuration (Optional[str]) –
platform (Optional[str]) –
extra_switches (str) –
extra_parameters (str) –
- Return type
Iterable[str]
- abstract is_buildable()[source]#
Get whether this object is buildable in its current configuration.
- Return type
bool
- is_valid_build_configuration(configuration)[source]#
Get whether a given build configuration is valid for this Buildable.
- Parameters
configuration (str) –
- Return type
bool
- is_valid_build_platform(platform)[source]#
Get whether a given platform is valid for this Buildable.
- Parameters
platform (str) –
- Return type
bool
- class crazyhusk.build.UnrealBuild(buildable, target=None, configuration=None, build_platform=None, static_analyzer=None)[source]#
Object wrapper for composing and running an Unreal build subroutine.
- Parameters
buildable (crazyhusk.build.Buildable) –
target (Optional[str]) –
configuration (Optional[str]) –
build_platform (Optional[str]) –
static_analyzer (Optional[str]) –
- Return type
None
- property configuration: str#
Get the build configuration for this UnrealBuild.
- property platform: str#
Get the build platform for this UnrealBuild.
- run(*extra_switches, **extra_parameters)[source]#
Execute the currently configured build subprocess for this UnrealBuild.
- Parameters
extra_switches (str) –
extra_parameters (str) –
- Return type
int
- property static_analyzer: Optional[str]#
Get the c++ static analyzer platform for this UnrealBuild.
- property target: str#
Get the build target for this UnrealBuild.
crazyhusk.cli#
Expose crazyhusk functionality to the commandline.
- exception crazyhusk.cli.CommandError[source]#
Custom exception representing errors encountered with CLI.
- crazyhusk.cli.parse_cli_args(args)[source]#
Parse crazyhusk CLI arguments.
- Parameters
args (List[str]) –
- Return type
argparse.Namespace
crazyhusk.code#
Wrapper objects for Unreal code templates.
- class crazyhusk.code.CodeTemplate(name, template_string='')[source]#
Object wrapper for working with Unreal’s code templating system for C++.
- Parameters
name (str) –
template_string (str) –
- Return type
None
- make_instance(**tokens)[source]#
Create a templated string using the supplied tokens with this CodeTemplate.
- Parameters
tokens (str) –
- Return type
str
- property tokens: Set[str]#
Get the set of string replacement tokens expressed by this CodeTemplate.
crazyhusk.config#
Object wrappers for working with Unreal Engine config files.
crazyhusk.engine#
Object wrappers for working with Unreal Engine installations.
- class crazyhusk.engine.UnrealEngine(base_dir, association_name=None)[source]#
Object wrapper representing an Unreal Engine.
- Parameters
base_dir (str) –
association_name (Optional[str]) –
- Return type
None
- property build_dir: str#
Path to this Engine’s Build directory.
- property build_targets: Dict[str, str]#
Get a mapping of this UnrealEngine’s available build targets.
- property build_type: Optional[str]#
Type of build available for this Engine.
- property code_templates: Dict[str, crazyhusk.code.CodeTemplate]#
Get a mapping of this UnrealEngine’s available C++ code templates.
- config(config_category=None, platform=None)[source]#
Create a configuration object associated with this engine by category and platform.
- Parameters
config_category (Optional[str]) –
platform (Optional[str]) –
- Return type
- property config_dir: str#
Path to this Engine’s Config directory.
- config_files(config_category=None, platform=None)[source]#
Iterate configuration file paths associated with this engine by category and platform.
- Parameters
config_category (Optional[str]) –
platform (Optional[str]) –
- Return type
Iterable[str]
- property content_dir: str#
Path to this Engine’s Content directory.
- property engine: Optional[crazyhusk.engine.UnrealEngine]#
Get the associated UnrealEngine object for this Buildable.
- property engine_dir: str#
Path to this Engine’s Engine directory.
- static engine_dir_exists(engine)[source]#
Raise exception if this instance is not available on disk.
- Parameters
engine (crazyhusk.engine.UnrealEngine) –
- Return type
None
- static engine_exe_common_path(engine, executable, *args)[source]#
Raise exception if the executable does not resolve to a path owned by the given engine.
- Parameters
engine (crazyhusk.engine.UnrealEngine) –
executable (str) –
args (str) –
- Return type
None
- static engine_exe_exists(engine, executable, *args)[source]#
Raise exception if the executable is not available on disk.
- Parameters
engine (crazyhusk.engine.UnrealEngine) –
executable (str) –
args (str) –
- Return type
None
- executable_path(executable_name)[source]#
Resolve an expected real path for an executable member of this engine for a given executable name.
- Parameters
executable_name (str) –
- Return type
Optional[str]
- property feature_packs_dir: str#
Path to this Engine’s FeaturePacks directory.
- static find_engine(association)[source]#
Find an engine distribution from EngineAssociation string.
- Parameters
association (str) –
- Return type
Optional[crazyhusk.engine.UnrealEngine]
- static format_commandline_options(*switches, **parameters)[source]#
Convert input arguments from Pythonic expansions to commandline strings.
- Parameters
switches (str) –
parameters (str) –
- Return type
Iterable[str]
- get_build_command(target=None, configuration=None, platform=None, *extra_switches, **extra_parameters)[source]#
Get the default build configuration for this Buildable.
- Parameters
target (Optional[str]) –
configuration (Optional[str]) –
platform (Optional[str]) –
extra_switches (str) –
extra_parameters (str) –
- Return type
Iterable[str]
- is_buildable()[source]#
Get whether this object is buildable in its current configuration.
- Return type
bool
- is_installed_build()[source]#
Determine if this engine is an Installed distribution.
- Return type
bool
- is_valid_build_target(target)[source]#
Get whether a given build target is valid for this Buildable.
- Parameters
target (str) –
- Return type
bool
- static list_all_engines()[source]#
List all available engine installations.
- Return type
Iterable[crazyhusk.engine.UnrealEngine]
- static list_engine_code_templates(engine)[source]#
Iterate over a given UnrealEngine’s available C++ code templates.
- Parameters
engine (crazyhusk.engine.UnrealEngine) –
- Return type
Iterable[crazyhusk.code.CodeTemplate]
- property plugins: Optional[Dict[str, UnrealPlugin]]#
Get a mapping of the available plugins installed with this Engine.
- property plugins_dir: str#
Path to this Engine’s Plugins directory.
- run(executable, *args, expected_retcodes=None)[source]#
Run an associated Unreal executable in a subprocess, and process output line by line.
- Parameters
executable (str) –
args (str) –
expected_retcodes (Optional[Set[int]]) –
- Return type
int
- property samples_dir: str#
Path to this Engine’s Samples directory.
- sanitize_commandline(executable, *args)[source]#
Raise exceptions if we are about to run unsafe commands in the subprocess.
- Parameters
executable (str) –
args (str) –
- Return type
List[str]
- property source_dir: str#
Path to this Engine’s Source directory.
- property templates_dir: str#
Path to this Engine’s Templates directory.
- unreal_path_from_file_path(file_path)[source]#
Convert a file path to an appropriate Unreal object path for use with this engine.
- Parameters
file_path (str) –
- Return type
str
- unreal_path_to_file_path(unreal_path, ext='.uasset')[source]#
Convert an Unreal object path to a file path relative to this engine.
- Parameters
unreal_path (str) –
ext (str) –
- Return type
Optional[str]
- property version: Optional[crazyhusk.engine.UnrealVersion]#
Engine version, as UnrealVersion.
crazyhusk.logs#
Logging utilities for crazyhusk Unreal Engine object wrappers.
- class crazyhusk.logs.FilterEngineRun(executable, *args)[source]#
Filter to enhance log records when using UnrealEngine.run().
- Parameters
executable (str) –
args (str) –
- Return type
None
crazyhusk.module#
Wrapper objects for Unreal code modules.
- class crazyhusk.module.ModuleDescriptor[source]#
Object wrapper representation of Unreal code module, equivalent to FModuleDescriptor.
https://docs.unrealengine.com/en-US/API/Runtime/Projects/FModuleDescriptor/index.html
- Return type
None
- to_dict()[source]#
Format this ModuleDescriptor as a dictionary for JSON.
- Return type
Dict[str, Any]
- static to_object(dct)[source]#
Convert a dictionary to an instance of ModuleDescriptor.
- Parameters
dct (Dict[str, Any]) –
- Return type
Union[crazyhusk.module.ModuleDescriptor, Dict[str, Any]]
crazyhusk.plugin#
Wrapper objects for Unreal plugins.
- class crazyhusk.plugin.UnrealPlugin(plugin_file)[source]#
Object wrapper representation of an Unreal Engine plugin.
- Parameters
plugin_file (str) –
- Return type
None
- property code_templates: Dict[str, crazyhusk.code.CodeTemplate]#
Get a mapping of this UnrealPlugin’s available C++ code templates.
- property config_dir: str#
Directory path of this plugin’s Config.
- property content_dir: str#
Directory path of this plugin’s Content.
- property descriptor: crazyhusk.plugin.PluginDescriptor#
Get an instance of this UnrealPlugin’s associated PluginDescriptor.
- property engine: Optional[crazyhusk.engine.UnrealEngine]#
Get the associated UnrealEngine object for this Buildable.
- get_build_command(target=None, configuration=None, platform=None, *extra_switches, **extra_parameters)[source]#
Iterate strings of subprocess arguments to execute the build.
- Parameters
target (Optional[str]) –
configuration (Optional[str]) –
platform (Optional[str]) –
extra_switches (str) –
extra_parameters (str) –
- Return type
Iterable[str]
- is_buildable()[source]#
Get whether this object is buildable in its current configuration.
- Return type
bool
- static list_plugin_code_templates(plugin)[source]#
Iterate over a given UnrealPlugin’s available C++ code templates.
- Parameters
plugin (crazyhusk.plugin.UnrealPlugin) –
- Return type
Iterable[crazyhusk.code.CodeTemplate]
- property modules: Dict[str, crazyhusk.module.ModuleDescriptor]#
Get a mapping of this UnrealPlugin’s associated ModuleDescriptors.
- property name: str#
Get the name of this UnrealPlugin.
- property plugin_dir: str#
Directory path of this plugin.
- static plugin_file_exists(plugin)[source]#
Raise exception if UnrealPlugin instance is not available on disk.
- Parameters
plugin (crazyhusk.plugin.UnrealPlugin) –
- Return type
None
- property plugin_refs: Dict[str, crazyhusk.plugin.PluginReferenceDescriptor]#
Get a mapping of PluginReferenceDescriptors for this UnrealPlugin.
- unreal_path_from_file_path(file_path)[source]#
Convert a file path to an appropriate Unreal object path for use with this plugin.
- Parameters
file_path (str) –
- Return type
Optional[str]
- unreal_path_to_file_path(unreal_path, ext='.uasset')[source]#
Convert an Unreal object path to a file path relative to this plugin.
- Parameters
unreal_path (str) –
ext (str) –
- Return type
Optional[str]
- static valid_plugin_file_extension(plugin)[source]#
Raise exception if UnrealPlugin instance does not have the correct file extension.
- Parameters
plugin (crazyhusk.plugin.UnrealPlugin) –
- Return type
None
crazyhusk.project#
Object wrappers for Unreal projects.
- class crazyhusk.project.UnrealProject(project_file)[source]#
Object wrapper representation of an Unreal Engine project.
- Parameters
project_file (str) –
- Return type
None
- property code_templates: Dict[str, crazyhusk.code.CodeTemplate]#
Get a mapping of this UnrealProject’s available C++ code templates.
- config(config_category=None, platform=None)[source]#
Create a configuration object associated with this project by category and platform.
- Parameters
config_category (Optional[str]) –
platform (Optional[str]) –
- Return type
- property config_dir: str#
Get the project’s Config directory.
- config_files(config_category=None, platform=None)[source]#
Iterate configuration file paths associated with this project by category and platform.
- Parameters
config_category (Optional[str]) –
platform (Optional[str]) –
- Return type
Iterable[str]
- property content_dir: str#
Get the project’s Content directory.
- property descriptor: Optional[crazyhusk.project.ProjectDescriptor]#
Get an instance of this UnrealProject’s associated ProjectDescriptor.
- property engine: Optional[crazyhusk.engine.UnrealEngine]#
Get the associated UnrealEngine object for this Buildable.
- get_build_command(target=None, configuration=None, platform=None, *extra_switches, **extra_parameters)[source]#
Iterate strings of subprocess arguments to execute the build.
- Parameters
target (Optional[str]) –
configuration (Optional[str]) –
platform (Optional[str]) –
extra_switches (str) –
extra_parameters (str) –
- Return type
Iterable[str]
- is_buildable()[source]#
Get whether this object is buildable in its current configuration.
- Return type
bool
- static list_project_code_templates(project)[source]#
Iterate over a given UnrealProject’s available C++ code templates.
- Parameters
project (crazyhusk.project.UnrealProject) –
- Return type
Iterable[crazyhusk.code.CodeTemplate]
- list_tests(editor=True, *extra_switches, **extra_parameters)[source]#
List available automation tests for this project.
- Parameters
editor (bool) –
extra_switches (str) –
extra_parameters (str) –
- Return type
int
- property modules: Optional[Dict[str, crazyhusk.module.ModuleDescriptor]]#
Get a mapping of this UnrealProject’s associated ModuleDescriptors.
- property plugins: Optional[Dict[str, crazyhusk.plugin.UnrealPlugin]]#
Get a mapping of the available plugins installed with this UnrealProject.
- property plugins_dir: str#
Get the project’s Plugins directory.
- property project_dir: str#
Get the base directory for .uproject file.
- static project_file_exists(project)[source]#
Raise exception if UnrealProject instance is not available on disk.
- Parameters
project (crazyhusk.project.UnrealProject) –
- Return type
None
- render(map_path, LevelSequence, vsync=False, *extra_switches, **extra_parameters)[source]#
Run this project in movie scene capture mode.
- Parameters
map_path (str) –
LevelSequence (str) –
vsync (bool) –
extra_switches (str) –
extra_parameters (str) –
- Return type
int
- property reports_dir: str#
Get the project’s default Reports directory.
- run_tests(tests, report_path=None, editor=True, rhi='nullrhi', *extra_switches, **extra_parameters)[source]#
Run named automation tests for this project.
- Parameters
tests (List[str]) –
report_path (Optional[str]) –
editor (bool) –
rhi (str) –
extra_switches (str) –
extra_parameters (str) –
- Return type
int
- property saved_dir: str#
Get the project’s Saved directory.
- unreal_path_from_file_path(file_path)[source]#
Convert a file path to an appropriate Unreal object path for use with this project.
- Parameters
file_path (str) –
- Return type
Optional[str]
- unreal_path_to_file_path(unreal_path, ext='.uasset')[source]#
Convert an Unreal object path to a file path relative to this project.
- Parameters
unreal_path (str) –
ext (str) –
- Return type
Optional[str]
- static valid_project_file_extension(project)[source]#
Raise exception if UnrealProject instance does not have the correct file extension.
- Parameters
project (crazyhusk.project.UnrealProject) –
- Return type
None
crazyhusk.reports#
Utilities for working with report formats generated by Unreal Engine.
- crazyhusk.reports.json_report_to_dict(report_file)[source]#
Deserialize Unreal JSON report file into a dictionary.
- Parameters
report_file (str) –
- Return type
Dict[str, Any]
- crazyhusk.reports.json_reports_to_junit_xml(junit_file, *json_reports)[source]#
Convert a JSON report from Unreal automation to jUnit XML format.
- Parameters
junit_file (str) –
json_reports (str) –
- Return type
None
- crazyhusk.reports.report_entry_to_entry_xml(entry)[source]#
Convert Unreal JSON report entry into jUnit failure XML.
- Parameters
entry (Dict[str, Any]) –
- Return type
xml.etree.ElementTree.Element
- crazyhusk.reports.report_object_to_testsuite_xml(report)[source]#
Convert Unreal JSON report into jUnit testsuite.
- Parameters
report (Dict[str, Any]) –
- Return type
xml.etree.ElementTree.Element
- crazyhusk.reports.report_test_to_testcase_xml(test)[source]#
Convert Unreal JSON report test into jUnit testcase.
- Parameters
test (Dict[str, Any]) –
- Return type
xml.etree.ElementTree.Element