|
looks really cool! congrats, seems like a lot of work went into this, and code generation is always fun. i do have some feedback about the readme though... maybe i'm not the intended audience, but the examples didn't work great for me - the readme just shows the code without the inputs/outputs, so you kind of have to guess what it does. ("show me your tables, not your flowcharts" etc.) i also think you should add some more basic examples / common tasks, e.g. converting AOS to SOA: [{'a': 5, 'b': 'foo'},
{'a': 10, 'b': 'bar'} ]
c.fun['stuff'](data) # look how concise!
{'a': [5, 10 ],
'b': ['foo', 'bar']}
and build up to more complex stuff from there, to help readers get a feel for the library.and i think the examples should be a bit higher up in the readme –
ofc wanting to describe how cool the implementation is is natural :) but honestly, when i'm looking at a library like this, i want to be able to make a quick assessment if might be useful for me - the implementation is kind of secondary in most cases. now, despite what i wrote above, i'd love to hear some stuff about the implementation :) as someone who also wrote a library that does runtime python codegen, what's your approach to that? |
Regarding the README, I'll improve it within the next few days.
As for the approach, the main assumption was that everything is simple as long as you deal with expressions only, so I've introduced every expression I needed as a conversion object (each able to generate the code within the context).
Exceptions are custom code generating parts (e.g. aggregate, reducers) and the part where I break down piped conversions into a series of statements in the top level converter.
Another tricky piece was to support parametrization - e.g. c.input_arg here - https://convtools.readthedocs.io/en/latest/cheatsheet.html#c... So it was necessary to make every conversion know about every inner dependency it has, to make all dependencies pop up, to know function signatures & parameters needed to be passed during internal generation of functions.