py-editor lacking pyscript module #1997
Replies: 5 comments 22 replies
-
For the sake of posterity... x-posting from our discord channel, and hoping to nurture some discussion here, and so we can reach a concordance about how things are expected to work: @JeffersGlass said:
@WebReflection responded:
My 2c is... as @WebReflection mentions in the OP, making the I'd love to hear more from @WebReflection (#webyoda) about the possible technical approaches, pros/cons etc we might take to move forward on this. Ultimately (and I think resonating with Jeff), I'd like to use the As always folks, thoughts, ideas and constructive critique are most welcome and gratefully received. 🚀 |
Beta Was this translation helpful? Give feedback.
-
edit folks, you know what? after all this "faffing around" (in Nicholas words 🤣) it looks like I can bring in once the whole stdlib as that's already exposed by core and it requires 3 LOC changes ... I think my concerns might be premature and I rather have concrete failing cases than re-implementing a branching logic for the sake of few utilities needed in the py-editor itself. The only missing bit would be then to implement the This way I've found doesn't require any special treatment to anything and it bootstraps our stdlib once and never again, it feels like a win-win to me. I am leaving in here my previous comment but it looks like nothing in there, except the My after thoughts: this is to me the cleanest solution I can come up with:
<script type="mpy-editor" config="./mpy.toml" setup></script>
<script type="mpy-editor">
from pyscript.js_modules import thing
from pyscript import ffi, fetch, window, document
# ... users' code in here ...
</script>
<!-- same with a specific env name -->
<script type="mpy-editor" config="./mpy.toml" env="task1" setup></script>
<script type="mpy-editor" env="task1">
# ... users' code in here ...
</script> If this is agreed I would be happy to find a way to bring those things in ... after all, beside the If we instead want the whole pyscript namespace there's much more to consider and test, but I am not strictly opposed to it, it just doesn't feel right in most occasions and I don't think editors need the whole module exposed API ... but maybe I am wrong here. |
Beta Was this translation helpful? Give feedback.
-
For context - I ran across the desire for the using the I think your proposed solution @WebReflection would work well for me - having access to At this point, I don't see the need to add the entirety of the pyscript namespace... I could see an argument for having |
Beta Was this translation helpful? Give feedback.
-
@ntoll @JeffersGlass I think we can have the cake and eat it too #2010 the port was actually way easier than anticipated because I forgot we already have the whole Bear in mind my concerns around |
Beta Was this translation helpful? Give feedback.
-
This discussion can be closed as the feature landed via #2010 |
Beta Was this translation helpful? Give feedback.
-
It's been brought up that it's desired to eventually import
pyscript
module within apy-editor
and that's not currently the case.Hooks are super clean on
py-editor
but it meansimport pyscript
fails big time.Apparently with latest
setup
feature users are happy anyway, but I think it's reasonable to expect our own namespace/module out of the editor our own code creates.This requires some investigation and it's not as trivial as it sounds, but if everyone else agrees that's a nice thing to do, I'd be happy to dig further and make it happen.
Agreed rule of thumb in short
setup
editor tag, be sure that config is in there before any other editor with the same env lands on the page.MR #2010
Beta Was this translation helpful? Give feedback.
All reactions