Skip to content

Add Rocket Mode configuration to skip non-critical startup work#3121

Merged
jmcouffin merged 8 commits intodevelopfrom
claude/loader-feature-comparison-lYDdu
Mar 2, 2026
Merged

Add Rocket Mode configuration to skip non-critical startup work#3121
jmcouffin merged 8 commits intodevelopfrom
claude/loader-feature-comparison-lYDdu

Conversation

@jmcouffin
Copy link
Copy Markdown
Contributor

@jmcouffin jmcouffin commented Feb 21, 2026

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

  1. PyRevitConfig.cs: Added a new RocketMode property that reads/writes the rocket_mode setting from the [core] section of the configuration file. The property defaults to false and supports case-insensitive boolean parsing.

  2. UIManagerService.cs:

    • Added _rocketMode field to cache the Rocket Mode setting
    • Modified constructor to load the Rocket Mode setting from config alongside the existing beta tools setting
    • Updated BuildUI() method to re-read the Rocket Mode setting on each UI rebuild (allowing settings changes to take effect on reload)
    • Conditionally skips icon pre-loading when Rocket Mode is enabled, with appropriate debug logging
  3. ScriptMetadataParsingTest.cs: Added comprehensive unit tests (TestRocketModeConfigFromIni) covering:

    • Default value behavior (false when not set)
    • Explicit true/false configuration
    • Case-insensitive parsing
    • Round-trip write/read persistence
cd dev/pyRevitLoader
dotnet test pyRevitExtensionParserTester/ --filter "TestRocketModeConfigFromIni"

Behavior

When Rocket Mode is enabled via configuration (rocket_mode = true in 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

  • Code follows project style conventions
  • Changes are tested with comprehensive unit tests
  • Existing functionality remains unchanged when Rocket Mode is disabled (default)

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

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
@jmcouffin jmcouffin self-assigned this Feb 21, 2026
@jmcouffin jmcouffin added the Enhancement Enhancement request [class->Improved #{number}: {title}] label Feb 21, 2026
@pyrevitlabs pyrevitlabs deleted a comment from devloai bot Feb 21, 2026
@jmcouffin jmcouffin marked this pull request as ready for review February 21, 2026 14:50
Copilot AI review requested due to automatic review settings February 21, 2026 14:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 RocketMode configuration property to PyRevitConfig class that reads/writes rocket_mode from the [core] section
  • Modified UIManagerService to 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

claude and others added 3 commits February 21, 2026 15:09
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
@jmcouffin

This comment was marked as outdated.

@romangolev
Copy link
Copy Markdown
Member

@jmcouffin did have a "cached engine" feature missing for the rocketmode implementation for the new loader
Added missing feature with a5ded0a , should be good to go now IMO

romangolev
romangolev previously approved these changes Feb 24, 2026
@jmcouffin jmcouffin merged commit 141d7e6 into develop Mar 2, 2026
@jmcouffin jmcouffin deleted the claude/loader-feature-comparison-lYDdu branch March 2, 2026 12:50
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 2, 2026

📦 New work-in-progress (wip) builds are available for 6.1.0.26061+1357-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 2, 2026

📦 New work-in-progress (wip) builds are available for 6.1.0.26061+1403-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26069+2130-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26071+0706-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26073+1714-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26073+2220-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26074+1648-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26076+0001-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26077+2319-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26079+2333-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26080+1314-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2031-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2042-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2045-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2048-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2106-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26083+2130-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26086+2004-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26088+1318-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26089+1231-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26090+0549-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1533-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1536-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1540-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1540-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.1.0.26090+1556-wip

@github-actions
Copy link
Copy Markdown
Contributor

📦 New public release are available for 6.2.0.26090+1754

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Enhancement request [class->Improved #{number}: {title}]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants