API documentation

Options module

This exposes the choices made by the user. Defaults will be applied here, and some handling of defaults.

nuitka.Options.isVerbose()
Returns:

bool derived from --verbose

nuitka.Options.shallTraceExecution()
Returns:

bool derived from --trace-execution

nuitka.Options.shallExecuteImmediately()
Returns:

bool derived from --run

nuitka.Options.shallRunInDebugger()
Returns:

bool derived from --debug

nuitka.Options.getXMLDumpOutputFilename()
Returns:

str derived from --xml

nuitka.Options.shallOnlyExecCCompilerCall()
Returns:

bool derived from --recompile-c-only

nuitka.Options.shallNotDoExecCCompilerCall()
Returns:

bool derived from --generate-c-only

nuitka.Options.getFileReferenceMode()

str, one of “runtime”, “original”, “frozen”, coming from --file-reference-choice

Notes:

Defaults to runtime for modules and packages, as well as standalone binaries, otherwise original is kept.

nuitka.Options.getModuleNameMode()

str, one of “runtime”, “original”, coming from --module-name-choice

Notes:

Defaults to runtime for modules and packages, otherwise original is kept.

nuitka.Options.shallMakeModule()
Returns:

bool derived from --module

nuitka.Options.shallCreatePyiFile()

bool = not --no-pyi-file

nuitka.Options.shallCreatePyiFileContainStubs()

bool = not --no-pyi-stubs

nuitka.Options.isAllowedToReexecute()

bool = not --must-not-re-execute

nuitka.Options.shallFollowStandardLibrary()
Returns:

bool derived from --follow-stdlib

nuitka.Options.shallFollowNoImports()
Returns:

bool derived from --nofollow-imports

nuitka.Options.shallFollowAllImports()
Returns:

bool derived from --follow-imports

nuitka.Options.getShallFollowInNoCase()

list, items of --nofollow-import-to=

nuitka.Options.getShallFollowModules()

list, items of --follow-import-to= amended with what --include-module and --include-package got

nuitka.Options.getShallFollowExtra()

list, items of --include-plugin-directory=

nuitka.Options.getShallFollowExtraFilePatterns()

list, items of --include-plugin-files=

nuitka.Options.getMustIncludeModules()

list, items of --include-module=

nuitka.Options.getMustIncludePackages()

list, items of --include-package=

nuitka.Options.getShallIncludeDistributionMetadata()

list, items of --include-distribution-metadata=

nuitka.Options.getShallIncludePackageData()

iterable of (module name, filename pattern), derived from --include-package-data=

The filename pattern can be None if not given. Empty values give None too.

nuitka.Options.getShallIncludeDataFiles()

list, items of --include-data-files=

nuitka.Options.getShallIncludeDataDirs()

list, items of --include-data-dir=

nuitka.Options.getShallIncludeRawDirs()

list, items of --include-raw-dir=

nuitka.Options.getShallNotIncludeDataFilePatterns()

list, items of --noinclude-data-files=

nuitka.Options.getShallIncludeExternallyDataFilePatterns()

list, items of --include-onefile-external-data=

nuitka.Options.getShallNotIncludeDllFilePatterns()

list, items of --noinclude-dlls=

nuitka.Options.shallWarnImplicitRaises()
Returns:

bool derived from --warn-implicit-exceptions

nuitka.Options.shallWarnUnusualCode()
Returns:

bool derived from --warn-unusual-code

nuitka.Options.assumeYesForDownloads()
Returns:

bool derived from --assume-yes-for-downloads

nuitka.Options.shallUsePythonDebug()
Returns:

bool derived from --python-debug or sys.flags.debug

Passed to Scons as python_debug so it can consider it when picking link libraries to choose the correct variant. Also enables the define Py_DEBUG for C headers. Reference counting checks and other debug asserts of Python will happen in this mode.

nuitka.Options.isUnstripped()
Returns:

bool derived from --unstripped or --profile

A binary is called stripped when debug information is not present, an unstripped when it is present. For profiling and debugging it will be necessary, but it doesn’t enable debug checks like --debug does.

Passed to Scons as unstripped_mode to it can ask the linker to include symbol information.

nuitka.Options.isProfile()
Returns:

bool derived from --profile

nuitka.Options.shallCreateGraph()
Returns:

bool derived from --internal-graph

nuitka.Options.getOutputFilename()

str, value of “-o”

nuitka.Options.getOutputPath(path)

Return output pathname of a given path (filename).

nuitka.Options.getOutputDir()

str, value of --output-dir or “.”

nuitka.Options.getPositionalArgs()

tuple, command line positional arguments

nuitka.Options.getMainArgs()

tuple, arguments following the optional arguments

nuitka.Options.getMainEntryPointFilenames()

tuple, main programs, none, one or more

nuitka.Options.shallOptimizeStringExec()

Inactive yet

nuitka.Options.shallUseStaticLibPython()
Returns:

bool derived from --static-libpython=yes|auto and not module mode

Notes:

Currently only Anaconda on non-Windows can do this and MSYS2.

nuitka.Options.shallTreatUninstalledPython()

bool = derived from Python installation and modes

Notes:

Not done for standalone mode obviously. The Python DLL will be a dependency of the executable and treated that way.

Also not done for extension modules, they are loaded with a Python runtime available.

Most often uninstalled Python versions are self compiled or from Anaconda.

nuitka.Options.shallCreateCmdFileForExecution()

bool = derived from Python installation and modes

Notes: Mostly for accelerated mode on Windows with uninstalled python, to make sure they find their Python DLL.

nuitka.Options.isShowScons()
Returns:

bool derived from --show-scons

nuitka.Options.getJobLimit()

int, value of --jobs / “-j” or number of CPU kernels

nuitka.Options.getLtoMode()
Returns:

bool derived from --lto

nuitka.Options.isClang()
Returns:

bool derived from --clang or enforced by platform, e.g. macOS or FreeBSD some targets.

nuitka.Options.isMingw64()
Returns:

bool derived from --mingw64, available only on Windows, otherwise false

nuitka.Options.getMsvcVersion()
Returns:

str derived from --msvc on Windows, otherwise None

nuitka.Options.shallCleanCache(cache_name)
Returns:

bool derived from --clean-cache

nuitka.Options.shallDisableCacheUsage(cache_name)
Returns:

bool derived from --disable-cache

nuitka.Options.shallDisableCCacheUsage()
Returns:

bool derived from --disable-ccache or --disable--cache=ccache

nuitka.Options.shallDisableBytecodeCacheUsage()
Returns:

bool derived from --disable-bytecode-cache

nuitka.Options.shallDisableCompressionCacheUsage()
Returns:

bool derived from --disable-cache=compression

nuitka.Options.getWindowsConsoleMode()
Returns:

str from --windows-console-mode

nuitka.Options.isShowProgress()
Returns:

bool derived from --show-progress

nuitka.Options.isShowMemory()
Returns:

bool derived from --show-memory

nuitka.Options.isShowInclusion()
Returns:

bool derived from --show-modules

nuitka.Options.isRemoveBuildDir()
Returns:

bool derived from --remove-output

nuitka.Options.isDeploymentMode()
Returns:

bool derived from --deployment

nuitka.Options.getNoDeploymentIndications()
Returns:

list derived from --no-deployment-flag

nuitka.Options.isExperimental(indication)

Check whether a given experimental feature is enabled.

Args:

indication: (str) feature name

Returns:

bool

nuitka.Options.getExperimentalIndications()

tuple, items of --experimental=

nuitka.Options.shallExplainImports()
Returns:

bool derived from --explain-imports

nuitka.Options.isStandaloneMode()
Returns:

bool derived from --standalone

nuitka.Options.isOnefileMode()
Returns:

bool derived from --onefile

nuitka.Options.isAcceleratedMode()
Returns:

bool derived from --standalone and –module

nuitka.Options.isOnefileTempDirMode()
Returns:

bool derived from --onefile-tempdir-spec

Notes:

Using cached onefile execution when the spec doesn’t contain volatile things.

nuitka.Options.isCPgoMode()
Returns:

bool derived from --pgo-c

nuitka.Options.isPythonPgoMode()
Returns:

bool derived from --pgo-python

nuitka.Options.getPythonPgoInput()
Returns:

str derived from --pgo-python-input

nuitka.Options.getPgoArgs()

list = --pgo-args

nuitka.Options.getPgoExecutable()

str = --pgo-args

nuitka.Options.getPythonPgoUnseenModulePolicy()

str = --python-pgo-unused-module-policy

nuitka.Options.getOnefileTempDirSpec()

str = --onefile-tempdir-spec

nuitka.Options.getOnefileChildGraceTime()

int = --onefile-child-grace-time

nuitka.Options.shallNotCompressOnefile()

bool = --onefile-no-compression

nuitka.Options.shallOnefileAsArchive()

bool = --onefile-as-archive

nuitka.Options.getWindowsIconPaths()

list of str, values of --windows-icon-from-ico

nuitka.Options.getLinuxIconPaths()

list of str, values of --linux-icon

nuitka.Options.getMacOSIconPaths()

list of str, values of --macos-app-icon

nuitka.Options.getWindowsIconExecutablePath()

str or None if not given, value of --windows-icon-from-exe

nuitka.Options.shallAskForWindowsAdminRights()

bool, value of --windows-uac-admin or --windows-uac-uiaccess

nuitka.Options.shallAskForWindowsUIAccessRights()

bool, value of --windows-uac-uiaccess

nuitka.Options.getLegalCopyright()

str name of the product to use derived from --copyright

nuitka.Options.getLegalTrademarks()

str name of the product to use derived from --trademarks

nuitka.Options.getWindowsVersionInfoStrings()

dict of str, values of .

nuitka.Options.getProductVersion()
Returns:

str, derived from --product-version

nuitka.Options.getProductVersionTuple()
Returns:

tuple of 4 ints or None, derived from --product-version

nuitka.Options.getFileVersion()

:returns str, derived from --file-version

nuitka.Options.getFileVersionTuple()

:returns tuple of 4 ints or None, derived from --file-version

nuitka.Options.getWindowsSplashScreen()
Returns:

bool derived from --onefile-windows-splash-screen-image

nuitka.Options.getCompanyName()

str name of the company to use derived from --company-name

nuitka.Options.getProductName()

str name of the product to use derived from --product-name

nuitka.Options.getMacOSTargetArch()
Returns:

str enum (“universal”, “arm64”, “x86_64”) derived from --macos-target-arch value

nuitka.Options.shallCreateAppBundle()

bool shall create an application bundle, derived from --macos-create-app-bundle value

nuitka.Options.getMacOSSigningIdentity()

str value to use as identity for codesign, derived from --macos-sign-identity value

nuitka.Options.shallUseSigningForNotarization()

bool flag to use for codesign, derived from --macos-sign-notarization value

nuitka.Options.getMacOSAppName()

str name of the app to use bundle

nuitka.Options.getMacOSSignedAppName()

str name of the app to use during signing

nuitka.Options.getMacOSAppVersion()

str version of the app to use for bundle

nuitka.Options.getMacOSAppProtectedResourcesAccesses()

list key, value for protected resources of the app to use for bundle

nuitka.Options.isMacOSBackgroundApp()

bool, derived from --macos-app-mode

nuitka.Options.isMacOSUiElementApp()

bool, derived from --macos-app-mode

nuitka.Options.hasPythonFlagNoSite()

bool = “no_site” in python flags given

nuitka.Options.hasPythonFlagNoAnnotations()

bool = “no_annotations” in python flags given

nuitka.Options.hasPythonFlagNoAsserts()

bool = “no_asserts” in python flags given

nuitka.Options.hasPythonFlagNoDocStrings()

bool = “no_docstrings” in python flags given

nuitka.Options.hasPythonFlagNoWarnings()

bool = “no_warnings” in python flags given

nuitka.Options.hasPythonFlagIsolated()

bool = “isolated” in python flags given

nuitka.Options.hasPythonFlagTraceImports()

bool = “trace_imports”, “-v” in python flags given

nuitka.Options.hasPythonFlagNoRandomization()

bool = “no_randomization”, “-R”, “static_hashes” in python flags given

nuitka.Options.hasPythonFlagNoBytecodeRuntimeCache()

bool = “dontwritebytecode”, “-u” in python flags given

nuitka.Options.hasPythonFlagUnbuffered()

bool = “unbuffered”, “-u” in python flags given

nuitka.Options.hasPythonFlagPackageMode()

bool = “package_mode”, “-m” in python flags given

nuitka.Options.shallNotUseDependsExeCachedResults()
Returns:

bool derived from --disable-dll-dependency-cache or --force-dll-dependency-cache-update

nuitka.Options.shallNotStoreDependsExeCachedResults()
Returns:

bool derived from --disable-dll-dependency-cache

nuitka.Options.getPluginNameConsideringRenames(plugin_name)

Name of the plugin with renames considered.

nuitka.Options.getPluginsEnabled()

tuple, user enabled (standard) plugins (not including user plugins)

Note:

Do not use this outside of main binary, as plugins are allowed to activate plugins themselves and that will not be visible here.

nuitka.Options.getPluginsDisabled()

tuple, user disabled (standard) plugins.

Note:

Do not use this outside of main binary, as other plugins, e.g. hinted compilation will activate plugins themselves and this will not be visible here.

nuitka.Options.getUserPlugins()

tuple, items user provided of --user-plugin=

nuitka.Options.shallDetectMissingPlugins()

bool = not --plugin-no-detection

nuitka.Options.getPythonPathForScons()

str, value of --python-for-scons

nuitka.Options.shallCompileWithoutBuildDirectory()

bool currently hard coded, not when using debugger.

When this is used, compilation is executed in a fashion that it runs inside the build folder, hiding it, attempting to make results more reproducible across builds of different programs.

TODO: Make this not hardcoded, but possible to disable via an options.

nuitka.Options.shallPreferSourceCodeOverExtensionModules()

bool prefer source code over extension modules if both are there

nuitka.Options.shallUseProgressBar()

bool prefer source code over extension modules if both are there

nuitka.Options.getForcedStdoutPath()

str force program stdout output into that filename

nuitka.Options.getForcedStderrPath()

str force program stderr output into that filename

nuitka.Options.shallShowSourceModifications(module_name)

bool display plugin source changes derived from –show-source-changes

nuitka.Options.isLowMemory()

bool low memory usage requested

nuitka.Options.getCompilationReportFilename()

str filename to write XML report of compilation to

nuitka.Options.getCompilationReportTemplates()

tuple of str,str template and output filenames to write reports to

nuitka.Options.shallCreateDiffableCompilationReport()

bool” derived from –report-diffable

nuitka.Options.getUserProvidedYamlFiles()

list files with user provided Yaml files

nuitka.Options.shallDisplayWarningMnemonic(mnemonic)

bool” derived from –nowarn-mnemonic

nuitka.Options.getTargetPythonDescription()
Returns:

tuple(python_version,OS/arch) string derived from --target

nuitka.Options.getFcfProtectionMode()
Returns:

string derived from --fcf-protection

nuitka.Options.getModuleParameter(module_name, parameter_name)
Returns:

string derived from --module-parameter

nuitka.Options.getForcedRuntimeEnvironmentVariableValues()
Returns:

iterable (string, string) derived from ----force-runtime-environment-variable