Document packaging with Nuitka - #6010
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
|
@falkoschindler looks correct. Do you want to YOLO this or want Windows testing on my side? |
Contributor
Author
|
@evnchn Let's YOLO and improve on demand. |
falkoschindler
enabled auto-merge
April 29, 2026 10:00
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
NiceGUI's
nicegui/ui.pyresolves submodules lazily via a module-level__getattr__(PEP 562). Nuitka's static analyzer can't traceimportlib.import_module(module_path, ...)whenmodule_pathcomes from a dict lookup, so submodules likenicegui.ui_run,nicegui.functions.style, and mostnicegui.elements.*get pruned from Nuitka builds. PyInstaller side-steps this becausenicegui-packalready passes--add-data <nicegui dir>.Users have been hitting this for a while:
ModuleNotFoundError: No module named 'nicegui.ui_run'after Nuitka buildBoth are unblocked by passing
--include-package=nicegui --include-package-data=nicegui. This PR documents that.Implementation
Adds a "Packaging with Nuitka" section to the deployment docs, between the existing PyInstaller block and the generic "Packaging with Native Mode" notes. Same structure as the PyInstaller demo: intro paragraph with flag rationale, 2-column
python_window/bash_windowpair with a working example, and a tips list covering--standalonevs--onefile, optional packages with their own data files, native-mode flags per platform, and build-time / cache notes.The recommended invocation was verified locally — clean venv on Python 3.11.7 with Nuitka 4.0.8 + this branch's
niceguiproduced a 191 MB onefile binary that successfully resolves all lazy imports (ui.label,ui.add_css) used in #6009's repro.Progress