Add Rocket Mode configuration to skip non-critical startup work#3121
Add Rocket Mode configuration to skip non-critical startup work#3121
Conversation
Read the rocket_mode INI key in PyRevitConfig and expose it via a new RocketMode property, matching the existing LoadBeta/NewLoader pattern. UIManagerService picks up the value at startup and on every BuildUI (so a reload applies the change without restarting Revit) and skips the parallel icon pre-load when rocket mode is active, reducing startup latency in line with the IPY loader behaviour. A unit test (TestRocketModeConfigFromIni) covers default, explicit true/false, case-insensitive, and round-trip write/read cases. https://claude.ai/code/session_013HpJtXCz4WQuSaNxY2gSxK
There was a problem hiding this comment.
Pull request overview
This pull request introduces a "Rocket Mode" configuration option that allows pyRevit to skip non-critical startup work (specifically icon pre-loading) to reduce session load time. The implementation follows the existing "Load Beta Tools" pattern for consistency, with the setting defaulting to false to preserve existing behavior.
Changes:
- Added
RocketModeconfiguration property toPyRevitConfigclass that reads/writesrocket_modefrom the[core]section - Modified
UIManagerServiceto conditionally skip icon pre-loading when Rocket Mode is enabled, with appropriate debug logging - Added comprehensive unit tests covering default behavior, explicit values, case-insensitivity, and round-trip persistence
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| dev/pyRevitLoader/pyRevitExtensionParser/PyRevitConfig.cs | Added RocketMode property with getter/setter following established boolean config pattern |
| dev/pyRevitLoader/pyRevitAssemblyBuilder/UIManager/UIManagerService.cs | Added _rocketMode field, constructor initialization, BuildUI re-reading, and conditional icon pre-loading logic |
| dev/pyRevitLoader/pyRevitExtensionParserTester/ScriptMetadataParsingTest.cs | Added TestRocketModeConfigFromIni with comprehensive test cases for configuration behavior |
The C# loader never seeded the PYREVITEnvVarsDict AppDomain key, so all pyrevit.sessioninfo / telemetry / logger APIs in scripts were crashing with NullReferenceException when EnvDictionary() tried to cast null to PythonDictionary. Changes: - EnvVariables.cs (Runtime): add static EnvDictionary.Seed() that accepts a plain Dictionary<string, object>, creates/gets the PythonDictionary internally, populates it, and stores it in AppDomain. Keeping PythonDictionary creation inside the Runtime avoids a compile-time IronPython reference in the loader (UseIronPython=false). - PyRevitConfig.cs: add 12 missing config properties read from the same INI sections as PyRevitConsts in the CLI library: LoggingLevel (verbose/debug → 0/1/2), FileLogging, AutoUpdate, OutputStyleSheet [core]; TelemetryState, TelemetryUTCTimeStamps, TelemetryFilePath, TelemetryServerUrl, TelemetryIncludeHooks, AppTelemetryState, AppTelemetryServerUrl, AppTelemetryEventFlags [telemetry]. - EnvDictionarySeeder.cs (new): builds the values dict from PyRevitConfig and UIApplication, resolves pyRevit version from the version file and IronPython version from the engine DLL, then calls EnvDictionary.Seed() via reflection (same pattern as ScriptExecutor.Initialize/ExecuteScript). - SessionManagerService.cs: call SeedEnvironmentDictionary() immediately after InitializeScriptExecutor() (which loads _runtimeAssembly) and before any extension startup script runs. Failure is logged as a warning rather than thrown to preserve graceful degradation. - ScriptMetadataParsingTest.cs: add TestLoggingLevelConfigFromIni, TestTelemetryConfigFromIni, TestFileLoggingAndAutoUpdateConfigFromIni. https://claude.ai/code/session_013HpJtXCz4WQuSaNxY2gSxK
This reverts commit 8eac2f1.
This comment was marked as outdated.
This comment was marked as outdated.
|
@jmcouffin did have a "cached engine" feature missing for the rocketmode implementation for the new loader |
… claude/loader-feature-comparison-lYDdu
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26061+1357-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26061+1403-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26069+2130-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26071+0706-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26073+1714-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26073+2220-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26074+1648-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26076+0001-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26077+2319-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26079+2333-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26080+1314-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2031-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2042-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2045-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2048-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2106-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2130-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26086+2004-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26088+1318-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26089+1231-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+0549-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1533-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1536-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1540-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1540-wip |
|
📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1556-wip |
|
📦 New public release are available for 6.2.0.26090+1754 |
Description
This pull request introduces a new "Rocket Mode" configuration option to pyRevit that allows users to skip non-critical startup work (such as icon pre-loading) to reduce session load time.
Changes Made
PyRevitConfig.cs: Added a new
RocketModeproperty that reads/writes therocket_modesetting from the[core]section of the configuration file. The property defaults tofalseand supports case-insensitive boolean parsing.UIManagerService.cs:
_rocketModefield to cache the Rocket Mode settingBuildUI()method to re-read the Rocket Mode setting on each UI rebuild (allowing settings changes to take effect on reload)ScriptMetadataParsingTest.cs: Added comprehensive unit tests (
TestRocketModeConfigFromIni) covering:Behavior
When Rocket Mode is enabled via configuration (
rocket_mode = truein the[core]section), pyRevit will skip the icon pre-loading step during UI building, reducing initial load time. The setting is re-evaluated on each UI rebuild, allowing users to toggle it without restarting Revit.Checklist
Related Issues
Related to performance optimization efforts for faster pyRevit session startup.
Additional Notes
The implementation mirrors the existing "Load Beta Tools" pattern for consistency. Debug logging has been added to help users understand when Rocket Mode is active and what optimizations are being applied.
https://claude.ai/code/session_013HpJtXCz4WQuSaNxY2gSxK