Python Generator

34 views
Skip to first unread message

Stuart Barclay

unread,
Jul 17, 2024, 1:10:54 PM (5 days ago) Jul 17
to Blockly
I am writing a python workspace where with blockly in typescript. The workspace has several custom blocks and requires imports (either of other custom blocks or external python libraries), however I am getting a type warning when using `pythonGenerator.definitions_` as defintions_ is protected.

Is there a way to add to the definitions_ without getting this warning?

Beka Westberg

unread,
Jul 18, 2024, 12:52:12 PM (4 days ago) Jul 18
to Blockly
Currently not :/ We have issue 7600 and issue 7326 tracking fixing this, but for now we just cast to `any` in core. I've put 7326 back into the triage queue since you're running into it =)

Sorry I don't have a better answer for you at the moment! Best of luck with your project,
--Beka

Christopher Allen

unread,
7:45 AM (11 hours ago) 7:45 AM
to blo...@googlegroups.com
Hi Stuart,

Is there a way to add to the definitions_ without getting this warning?

As Beka noted, we don't really have a good solution to this at the moment, and even the Python generator functions for the library blocks have to work around this problem—but that same workaround should work for you too for the time being—just beware that it might stop working at some point in the future (by which time, hopefully, we will have a better solution).

Sorry about that.


Christopher

Reply all
Reply to author
Forward
0 new messages