Skip to content

New loader C# bugfixes and improvements#3032

Merged
jmcouffin merged 20 commits intopyrevitlabs:developfrom
romangolev:develop
Feb 1, 2026
Merged

New loader C# bugfixes and improvements#3032
jmcouffin merged 20 commits intopyrevitlabs:developfrom
romangolev:develop

Conversation

@romangolev
Copy link
Copy Markdown
Member

New loader C# bugfixes and improvements

Description

Address #2995 Task and pursue the effort of bug elimination.

This PR fixes:
#3024
#3023

Also adds support for Help URL:
https://pyrevitlabs.notion.site/Anatomy-of-IronPython-Scripts-f11d0099667f46a28d29b028dd99ccaf#fee25dbae69b419489e2fd168fbb2876


Checklist

Before submitting your pull request, ensure the following requirements are met:

  • Code follows the PEP 8 style guide.
  • Code has been formatted with Black using the command:
    pipenv run black {source_file_or_directory}
  • Changes are tested and verified to work as expected.

Related Issues

If applicable, link the issues resolved by this pull request:

  • Resolves #[issue number]

Additional Notes

Include any additional context, screenshots, or considerations for reviewers.


Thank you for contributing to pyRevit! 🎉

Copilot AI review requested due to automatic review settings January 25, 2026 06:31
@devloai
Copy link
Copy Markdown
Contributor

devloai bot commented Jan 25, 2026

Unable to trigger custom agent "Code Reviewer"You have run out of credits 😔
Please upgrade your plan or buy additional credits from the subscription page.

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

Addresses loader/parser issues in the new C# loader by improving Python constant parsing, fixing extension root discovery from config, and adding first-class “Help URL” (F1 contextual help) support for commands.

Changes:

  • Extend Python script constant parsing to correctly ignore trailing comments and support __helpurl__ dictionaries.
  • Add helpurl / helpurls support to bundle parsing and propagate it through parsed component models; apply F1 contextual help during ribbon item post-processing.
  • Update extension root discovery to use pyRevit_config.ini parsing (UserExtensionsList) instead of manual line scanning.

Reviewed changes

Copilot reviewed 7 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
dev/pyRevitLoader/pyRevitExtensionParserTester/PanelButtonBundleTests.cs Adds a regression test ensuring trailing comments don’t pollute parsed script metadata (e.g., __title__).
dev/pyRevitLoader/pyRevitExtensionParser/ParsedComponent.cs Adds HelpUrl + localized help URL support to parsed UI components.
dev/pyRevitLoader/pyRevitExtensionParser/ParsedBundle.cs Adds HelpUrl and HelpUrls (localized) to the bundle model.
dev/pyRevitLoader/pyRevitExtensionParser/ExtensionParser.cs Updates extension root discovery and wires help URL parsing/merging from scripts + bundle.yaml; improves string constant extraction to ignore trailing comments.
dev/pyRevitLoader/pyRevitExtensionParser/BundleParser.cs Adds helpurl / helpurls parsing support in bundle.yaml.
dev/pyRevitLoader/pyRevitAssemblyBuilder/UIManager/Buttons/PanelButtonBuilder.cs Documents contextual-help behavior for dialog launcher conversion.
dev/pyRevitLoader/pyRevitAssemblyBuilder/UIManager/Buttons/ButtonPostProcessor.cs Applies contextual help (F1 URL) to created ribbon items.
bin/netfx/engines/IPY342/pyRevitExtensionParser.dll Updates the shipped parser assembly for the IPY342 engine build.
Comments suppressed due to low confidence (1)

dev/pyRevitLoader/pyRevitExtensionParser/ExtensionParser.cs:751

  • Template substitution is applied to scriptHelpUrl but not to bundleInComponent.HelpUrl nor to finalLocalizedHelpUrls. This means helpurl/helpurls values containing {{...}} templates won’t resolve (and may later fail URL validation). Apply SubstituteTemplates to the bundle HelpUrl and run SubstituteTemplatesInDict on finalLocalizedHelpUrls the same way titles/tooltips are handled.
                // Apply template substitution to string values
                title = SubstituteTemplates(title, mergedTemplates);
                doc = SubstituteTemplates(doc, mergedTemplates);
                author = SubstituteTemplates(author, mergedTemplates);
                var hyperlink = SubstituteTemplates(bundleInComponent?.Hyperlink, mergedTemplates);
                scriptHelpUrl = SubstituteTemplates(scriptHelpUrl, mergedTemplates);
                
                // Apply template substitution to localized values
                finalLocalizedTitles = SubstituteTemplatesInDict(finalLocalizedTitles, mergedTemplates);
                finalLocalizedTooltips = SubstituteTemplatesInDict(finalLocalizedTooltips, mergedTemplates);

@jmcouffin
Copy link
Copy Markdown
Contributor

@romangolev can you review the 3 comments from ghcopilot, please?

@jmcouffin
Copy link
Copy Markdown
Contributor

Test 1

This works: 🚀  🟢 
__title__ = " _ variable title _ "
__context__ = "zero-doc"
__authors__ = ["jmc", "John Doe"]
__helpurl__ = {"en_us": "https://www.nytimes.com", "fr_fr": "https://www.lemonde.fr"}
__doc__ = {"en_us": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", "fr_fr": "Lorem tooltip en francais"}
print("Complex Push Button jm")

this doesn't: helpurls = {"en_us": "https://www.nytimes.com", "fr_fr": "https://www.lemonde.fr"}

expected? @romangolev

Test 2 🟢

bundle.yaml with multiple help url per language

  • works after restart

Test 3 🟢

  1. custom local extension path added to custom extension path
  • Works as expected

Note

  • It always requires a restart of Revit, looking at the notes in the code, this is expected
  • Custom extensions language switch is not working: 🔴 @romangolev
  1. install custom extension (local)
  2. switch language
  • title is not changed after reload
  • it is changed after restart

@romangolev
Copy link
Copy Markdown
Member Author

this doesn't: helpurls = {"en_us": "https://www.nytimes.com", "fr_fr": "https://www.lemonde.fr"}

Not sure if helpurls and help_urls from bundle should be supported. Haven't found any evidence of them on notion not here nor there.

I decided to stick to the helpurl and help_url to handle both singular and multilang support

@romangolev
Copy link
Copy Markdown
Member Author

  • Custom extensions language switch is not working:

I am on this one now @jmcouffin

@jmcouffin
Copy link
Copy Markdown
Contributor

I decided to stick to the helpurl and help_url to handle both singular and multilang support

Sounds good to me!

@romangolev
Copy link
Copy Markdown
Member Author

@jmcouffin
Pushed commits addressing the issue of language not being applied to custom extensions on reload.
As a bonus fixed an issue with multiline doc is not being parsed properly.

I am on a hot streak 😀

@jmcouffin
Copy link
Copy Markdown
Contributor

hot streak

Sounds like Duolingo! 🤣😁🤭

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

Copilot reviewed 10 out of 26 changed files in this pull request and generated 6 comments.

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@tay0thman
Copy link
Copy Markdown
Contributor

got few errors, while testing the PR:
image
image

I see the naming of the scripts are fixed and the custom extensions also being fixed, Good Job @romangolev

@romangolev
Copy link
Copy Markdown
Member Author

@tay0thman thanks for review!

got few errors, while testing the PR:

Haven't noticed the same behavior on my end. Could be that the app uses old dlls. Try to wipe out all the files from AppData\Roaming\pyRevit\2025 and give it another shot

@romangolev
Copy link
Copy Markdown
Member Author

@jmcouffin I've been scouting through the docs and found that the new loader implementation lacks the inline support for some of the features. Even though most tools are bundle-driven, I had to add them to make app as backwards compatible as possible.

New Script Variables Supported

Variable Type Description
min_revit_ver String Minimum Revit version (e.g., "2021")
max_revit_ver String Maximum Revit version (e.g., "2024")
beta Boolean Mark as beta tool
cleanengine Boolean Require clean engine scope
fullframeengine Boolean Enable full-frame mode
persistentengine Boolean Enable persistent engine

A small fix and refactor for the locale module. Nothing fancy as the main locale stays in python.

@tay0thman
Copy link
Copy Markdown
Contributor

. Try to wipe out all the files from AppData\Roaming\pyRevit\2025 and give it another shot

This worked, no issues here. I'll keep testing but this seems to be a solid PR.

@tay0thman
Copy link
Copy Markdown
Contributor

Ok, I had some time to test it out:
1- Building / Editing Bundles is impossible without restarting Revit. I can unload an extension, but I cannot load / update it again without restarting.
2- Editing a script won't update the tool, Reloading pyRevit will result in the error below:
image

Both of the Items above are key features tied to pyRevit's "RAD" Mission, so these are critical.

@romangolev
Copy link
Copy Markdown
Member Author

@tay0thman you got the point!
Last commits uploaded must remedy the issues mentioned. The new loader should now be well-aligned with the RAD mission 🏃‍♂️‍➡️

@tay0thman
Copy link
Copy Markdown
Contributor

Last commits uploaded must remedy the issues mentioned. The new loader should now be well-aligned with the RAD mission 🏃‍♂️‍➡️

That Works! Awesome! Thank you @romangolev

One more Item I noticed in the Bundle Metadata, the "before: " & "after: " arguments are not supported by the new loader
image
I don't see any further issues so far.

@jmcouffin jmcouffin merged commit 59f39b5 into pyrevitlabs:develop Feb 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1738-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1743-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1829-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 5.3.1.26032+1937-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 6.0.0.26032+1956-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 6.0.0.26032+2005-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New work-in-progress (wip) builds are available for 6.0.0.26032+2008-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New public release are available for 6.0.0.26032+2040

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

📦 New public release are available for 6.0.0.26032+2040

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants