unreal.py stubs file may become too big for Pylance / VSCode

Given a sufficient number of exposed Blueprint functions and types (from project or plugins), the generated unreal.py stubs file may grow too large for Pylance, causing errors like this in VSCode:

[error] (31052) File length of “file:///…/<ProjectDir>/Intermediate/PythonStub/unreal.py” is 52986705 which exceeds the maximum supported file size of 52428800

This effectively disables autocomplete in VSCode.

Pylance has a hard limit (or at least not configurable through any documented setting) on the maximum module file size it can process, which has been increased over time but currently sits at 50MB. Stock UE configuration will not reach this limit, but it is not out of the realms of possibility for a large project.

It would be great if the stubs file was split, perhaps by module or plugin, and just import the definitions in unreal.py (e.g. “from .plugin_module import *”). It would also probably make the stubs files more manageable for the editor. I understand this is not immediately straightforward though, as it would require sorting the definitions correctly so parent classes and type hints can be resolved.

For now, it seems that PyCharm can still deal with it in our case, and we may experiment with alternative language servers in VSCode.

Hi,

This is a known issue (UE-119549) since 2021, but the UE Python integration has only one person assigned to perform the minimum maintenance. I linked this EPS ticket to the JIRA ticket to mention your interest. Some other customers also mentioned the issue. Hopefully, at some point the problem will be addressed.

Regards,

Patrick