-
Notifications
You must be signed in to change notification settings - Fork 46
Describe your feature request here.
Hi , I have beeb working with this library for a while
https://pypi.org/project/javascript/
it is stable and wide open functional project
Is there anyone else who knows about it, and what are the ways in which this project surpasses or adds to the functions of the other already established project?
Thanks in advance
Code example
No response
All reactions
Hey @GabCores,
JsPyBridge (or "javascript" on pypi) is a similar project to PythonMonkey but has several differences in its implementation and API:
Most notably, under the hood JsPyBridge runs a separate nodejs process which communicates with the user's Python process. This comes with a severe performance penalty as data is copied whenever passed. PythonMonkey passes data by reference whenever possible meaning the cost of transferring information between Python and JavaScript is almost zero. Since references are copied, modifying data passed from Python into JavaScript (or vice versa) will not change the original reference in JsPyBridge but will as expected in JavaScript.
Here is a snippe...
Replies: 2 comments 3 replies
Hey @GabCores,
JsPyBridge (or "javascript" on pypi) is a similar project to PythonMonkey but has several differences in its implementation and API:
Most notably, under the hood JsPyBridge runs a separate nodejs process which communicates with the user's Python process. This comes with a severe performance penalty as data is copied whenever passed. PythonMonkey passes data by reference whenever possible meaning the cost of transferring information between Python and JavaScript is almost zero. Since references are copied, modifying data passed from Python into JavaScript (or vice versa) will not change the original reference in JsPyBridge but will as expected in JavaScript.
Here is a snippet relating to the interprocess communication from their README for reference:
On the bridge to call JavaScript from Python, due to the limiatations of Python and cross-platform IPC, we currently communicate over standard error which means that JSON output in JS standard error can interfere with the bridge. The same issue exists on Windows with python. You are however very unlikely to have issues with this.
Regarding API, PythonMonkey works nicely with Python's asyncio library for running JavaScript promises giving developers a familiar experience using async and await keyword in Python whereas JsPyBridge implements its own method for this by decorating functions.
JsPyBridge is an impressive project but PythonMonkey takes a different approach and therefore has different pros and cons. For instance, at the moment PythonMonkey lacks the Node.js support JsPyBridge has out of the box (but that will change in the future as it is just in Alpha at the moment)!
Hope this helps! Thanks for checking our our project and asking this question!!! (:
All reactions
Any scope of bringing fetch api in PythonMonkey ?
All reactions
Hey @almahdi404 , adding fetch to PythonMonkey is a good idea and very doable - I created a feature request to track it #161
I'll leave the ticket open now for external contributors but we might not get to it for some time. That being said if you're looking for alternatives, you should be able to use the requests from Python library in JavaScript using PythonMonkey
All reactions
great, i am actually building a ssr framework using solidjs and django.
am currently using JSPyBridge, trying to migrate to PythonMonkey.
I really appreciate this project. ❤️
All reactions
-
❤️ 1
XHR is in active development right now and even be in the mainline by the time you read this. There are fetch polyfills implemented in terms of XHR, so if you need this, it's probably pretty close to being ready.