[0] https://yourlabs.io/pyratzlabs/pymich [1] https://yourlabs.io/oss/ryzom/#javascript [2] https://redbaron.readthedocs.io/en/latest/
[0] https://yourlabs.io/pyratzlabs/pymich [1] https://yourlabs.io/oss/ryzom/#javascript [2] https://redbaron.readthedocs.io/en/latest/
That's cool. I'm working on something very similar, with the goal of generating idiomatic Javascript, which seems to be a goal for your code as well.
I did make a few different choices.
- Instead of worrying about formatting and indent, I just output whatever I feel like, and run Prettier afterwards. That way I don't have to worry about whitespace, indents, or superfluous parenthesis. - I integrated it with type analysis, so that operators like `+=` will produce different code for each type (ints vs lists, for example). - I also include the comments from the python source in the target javascript
But these things aside, I can see a lot of similarities!
Care to elaborate about that?
It seems to me like the resulting code will be very consistent, and only change when I either improve the transpiler, or when Prettier issue an update to their formatting. But that's unlikely, and anyway I can just use a fixed version.
> [2] https://redbaron.readthedocs.io/en/latest/
Thanks for the link. This looks really cool!
> For now, RedBaron can be considered in alpha, the core is quite stable but it is not battle tested yet and is still a bit rough.
> RedBaron [supports] up to python 3.7 grammar
> Last commit: 11 Aug 2019
Does anyone know what's going on with the project?
For example we use troposphere to generate cloudformation templates, so I wrote a linter which would ensure that every time we tried to create an elastic container registry on AWS we explicitly setup "security scanning" to be "on".
That kind of thing is trivial to write when you have the AST to manipulate:
* Find all calls to function "foo(...)".
* Error out if there is is no parameter "scan_on_push = True".
I'm thinking of calling it Pasta (Python AST view....A? I don't have a word that starts with A).
[0] I only really have a gif - https://imgur.com/a/4YYdfmZ