Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visibly transpile files feature [PLANNING ISSUE] #7

Open
2 tasks
icarito opened this issue May 6, 2018 · 6 comments
Open
2 tasks

Visibly transpile files feature [PLANNING ISSUE] #7

icarito opened this issue May 6, 2018 · 6 comments

Comments

@icarito
Copy link
Member

icarito commented May 6, 2018

Currently Jappy compiles .pyj files tranparently and puts them in .index.html.

We should:

  • Agree to put .pyj files under /src
  • Document replicable compilation rules that work in browser and cli
@icarito
Copy link
Member Author

icarito commented Jun 8, 2018

Looks like others have thought of layers on top of RapydScript-NG. It would be wise to align with them!

https://github.com/jonschull/Lyte @jonschull I'm reading thru your project and got interested enough to install Python3.6!

@jonschull
Copy link

jonschull commented Jun 11, 2018 via email

@icarito
Copy link
Member Author

icarito commented Jun 14, 2018

Hi @jonschull sorry I took so long to respond. I am humbled others find the project useful.

I didn't really solve the importing issue, what I do is directly manipulate the file_data object within Rapydscript: https://github.com/somosazucar/Jappy/blob/master/webapp/js/code_editor.tag.html#L1187 - This solution is inadequate because it only works at the moment with files already open in the editor (not the ones in the filesystem).

Jappy has a way to access the local filesystem by exposing it over WebDAV. But it only exposes directories under ~/Workspace/ (if you add #somename to your URL, you'll be editing ~/Workspace/somename/ and the Folder icon will display a drop down menu with the files in the directory.

Currently this is limited in that we have not implemented a way to browse subdirectories and subtleties regarding URL base paths for relative links.

I did ask Kovid about how I should implement it and he provided a response at kovidgoyal/rapydscript-ng#114 . But I have'nt dug into this yet. Perhaps his pointer could help us have a universal import mechanism?

How are you exposing the filesystem? I really like the interface wsgidav offers.
Thanks again, glad to share enthusiasm!

@jonschull
Copy link

jonschull commented Jun 14, 2018 via email

@icarito
Copy link
Member Author

icarito commented Jun 16, 2018

Hi @jonschull I had a read at your source code at https://glitch.com/edit/#!/lyte-0-1 and I am not sure.
I'm passing options to the create_embedded_compiler method and then just passing code to the resulting compiler object. I think compile(code, options) should be the function signature, from trying to understand Rapydscript source code. (tools/embedded_compiler.js).

With regard to importing I think this __stdlib__ mechanism is flexible but limited.
I'd like to try using a bundler such as https://github.com/CompuIves/codesandbox-client/tree/master/packages/sandpack or https://medium.com/@ericsimons/introducing-turbo-5x-faster-than-yarn-npm-and-runs-natively-in-browser-cc2c39715403 to import javascript modules. A preconfigured version of such bundler could take care of importing (loading/transpiling) the RapydScript code. This would simplify Jappy.

Do note that a key difference of RapydScript vs Python is that imports happen at compile time in RS, whereas Python does them dynamically.

I do think differences between .pyj and .py languages are too big to mask so I keep the two filenames different to avoid confusion.

There are other even more Pythonic transpilers, check out Transcrypt or Javascripthon (my favorite). Jappy uses RapydScript because we're interested in having the browser do the compilation. Both Transcrypt and Javascripthon have Python do the parsing and transpiling.

@jonschull
Copy link

jonschull commented Jun 16, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants