-
Notifications
You must be signed in to change notification settings - Fork 0
Execution StubGeneration
Truong Giang Vu edited this page May 31, 2026
·
1 revision
Python stubs help IDEs understand .NET and Revit API types so autocomplete and type hints are more useful while writing Python scripts.
- VSCode/Pylance cannot infer Revit API types;
- you want better autocomplete for .NET assemblies;
- you are writing larger Python scripts and need safer navigation;
- you want type hints for APIs that Python normally sees dynamically.
| Need | How stubs help |
|---|---|
| Discover Revit API members | IDE autocomplete can list known members |
| Reduce typo errors | Pylance can flag missing names earlier |
| Read unfamiliar APIs | signatures are easier to inspect |
| Navigate large scripts | type hints improve jump-to-definition behavior |
Stub generation is an IDE productivity feature. It does not change how a script runs inside RevitDevTool.
For runtime behavior, start with:
- Generated stubs can lag behind the exact API version you use.
- Some dynamic PythonNet behavior cannot be represented perfectly as static type hints.
- If a stub disagrees with runtime behavior, trust the runtime and Revit API documentation.
- Run Code Overview
- Modern Python Scripting
- Python Debugging
- Python Ecosystems
- RevitDevTool And pyRevit
- Python Stub Generation
- Run .NET Add-ins
- Scripting Runtimes