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

wrapper script for standalone use ? #43

Closed
UniqueFool opened this issue May 16, 2016 · 8 comments
Closed

wrapper script for standalone use ? #43

UniqueFool opened this issue May 16, 2016 · 8 comments

Comments

@UniqueFool
Copy link

Hi, is there some kind of mode (or wrapper script) to use js2py as a standalone tool ?
Specifically, I want to port a bunch of existing javascript unit tests to Python, including the unit testing framework itself - I noticed, that you already have a import_js() API - would that be something that can be exposed for standalone use ?

Thank you

@PiotrDabkowski
Copy link
Owner

Hey, I am not sure what you mean. What do you mean by standalone tool?

@UniqueFool
Copy link
Author

Hi, thanks for getting back in touch so quickly.
I was referring to the use of js2py in a scripted fashion, i.e. in a shell environment.
The import_js() API seems to be suitable for using it that way, what do you think ?

Thanks

@Lexcon
Copy link
Contributor

Lexcon commented May 16, 2016

What do you need this for?

It's no so hard to envision a python program that expects an input file
as a parameter, then runs it as a javascript.

Or do you mean more like an interactive prompt, in which case the
examples already provide for that?

Robert

On 16-5-2016 20:34, UniqueFool wrote:

Hi, thanks for getting back in touch so quickly.
I was referring to the use of js2py in a scripted fashion, i.e. in a
shell environment.
The import_js() API seems to be suitable for using it that way, what
do you think ?

Thanks


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#43 (comment)

@UniqueFool
Copy link
Author

yes, non-interactively like you say - it is for converting a bunch of unit tests to Python, to test the converted unit testing framework

@PiotrDabkowski
Copy link
Owner

I added run_file function. It executes given path or file containing JS code and returns a tuple (eval_return, context). You can use the same context to execute many files. update your js2py to use it.

@UniqueFool
Copy link
Author

thanks, I will take a look - and thanks again for being so responsive, much appreciated !!

@UniqueFool
Copy link
Author

Regarding the esprima js/py example: Is the serialization mechanism documented anywhere, i.e. can the AST be easily traversed/inspected or customized?

@UniqueFool
Copy link
Author

What is the recommended way to translate a whole set of related scripts - specifically, I would like to get a log-file for all translations that failed for some reason, so that I can take a look.

Thank you

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

3 participants