Skip to content

winrt.microsoft.windows.applicationmodel.dynamicdependency.bootstrap module

APIs for bootstrapping the Windows App runtime.

initialize

initialize(version: str = RELEASE_VERSION, min_version: str = RUNTIME_VERSION, options: InitializeOptions = InitializeOptions.NONE) -> Shutdown

Initialize the Windows App SDK runtime.

Parameter Type Description
version str The Windows App SDK product release version to load, e.g. “1.5” or “1.5-preview”.
min_version str The minimum version of the Windows App SDK runtime to load, e.g. “5001.70.1338.0”.
options InitializeOptions Initialization option flags.

Returns: A Shutdown that will shut down the Windows App SDK runtime when exited as a context manager or called.

Raises: OSError – if the initialization fails.

Added in version 2.1

Example:

with initialize(options=InitializeOptions.ON_NO_MATCH_SHOW_UI):
    # main code here
    ...

RELEASE_VERSION

RELEASE_VERSION: str

The package release version of the Windows App SDK used at compile time.

Added in version 2.1

RUNTIME_VERSION

RUNTIME_VERSION: str

The runtime version of the Windows App SDK used at compile time.

Added in version 2.1

Shutdown

class Shutdown

What initialize() returns. Leaving a with block that it was entered by, or calling it, shuts down the Windows App SDK runtime, and doing either again does nothing. One that is garbage collected before either shuts the runtime down with a RuntimeWarning.

Added in version 2.1

InitializeOptions

class InitializeOptions(enum.IntFlag)

Bases: enum.IntFlag

Initialization option flags for initialize().

NONE

Default behavior

ON_ERROR_DEBUG_BREAK

If not successful call DebugBreak()

ON_ERROR_DEBUG_BREAK_IF_DEBUGGER_ATTACHED

If not successful call DebugBreak() if a debugger is attached to the process

ON_ERROR_FAIL_FAST

If not successful perform a fail-fast

ON_NO_MATCH_SHOW_UI

If a compatible Windows App Runtime framework package is not found show UI

ON_PACKAGE_IDENTITY_NOOP

Do nothing (do not error) if the process has package identity

Added in version 2.1