Transcrypt icon indicating copy to clipboard operation
Transcrypt copied to clipboard

API/Lib

Open Muhammad-Ayan-No1 opened this issue 1 year ago • 1 comments

Is there a way to specify libraries? like I could specify that theirs an js equivalent library for this etc... Or at least to also transcrypt the Py libraries used? for system related tasks you can just emulate it and add function where we have global variables in js side containing them so as a dev I could edit them easily as well Secondly a option for web/node for simple apis like multi threading and reading writing a file , creating a localhost (blob in web or using window.location method etc) etc... Like this is a very useful py lib I also had to use some hacks to use it programtically, is there a API for that?

Muhammad-Ayan-No1 avatar Mar 06 '25 07:03 Muhammad-Ayan-No1

I'm not completely sure exactly what you are asking, but I will answer the best I can.

If you are wanting to substitute an equivalent JS library when you run the Transcrypt'd code and be able to also run the Python source code using a Python library, you can use the skip and ecom transpiler directives to conditionally use the JS library or the Python library depending on which environment is running. So, Python-only code would go in a skip/noskip block and JS-only code would go in an ecom/noecom block.

As far as the second question, you are really only limited by whatever JavaScript can do.

As of right now, there is no external API for transcrypt. If you wanted to programatically transpile Python code to JS, you would have to use a shell command via something like Python's subprocess module, like I mentioned on another thread.

JennaSys avatar May 24 '25 02:05 JennaSys