py-backwards icon indicating copy to clipboard operation
py-backwards copied to clipboard

Consider using typed-astunparse

Open mitar opened this issue 7 years ago • 6 comments

It seems this one supports also preserving type comments: https://github.com/mbdevpl/typed-astunparse (in contrast with https://github.com/nvbn/py-backwards-astunparse).

mitar avatar Sep 25 '17 04:09 mitar

py-backwards was using it before and there were problems similar to https://github.com/simonpercivall/astunparse/issues/18 and https://github.com/simonpercivall/astunparse/issues/17

nvbn avatar Sep 27 '17 16:09 nvbn

Wouldn't be easier to make PRs to it to fix those instead of creating a fork? Because having typed unparse is really useful and makes #44 work great.

mitar avatar Sep 27 '17 16:09 mitar

Not that much, typed-astunparse is based on astunparse.

And pull requests were already submitted to astunparse.

Also, are we really need type comments in compiled code? I think it would be better to have a less readable compiled code and something like source maps.

nvbn avatar Sep 27 '17 16:09 nvbn

And pull requests were already submitted to astunparse.

Hm, it seems they are waiting to be rebased?

Also, are we really need type comments in compiled code? I think it would be better to have a less readable compiled code and something like source maps.

Yes, one could automatically generate typing stub files. But comments seemed easier at a time. Otherwise one would have to create whole infrastructure to pass those types around and make those extra files.

mitar avatar Sep 27 '17 17:09 mitar

Hm, it seems they are waiting to be rebased?

https://github.com/simonpercivall/astunparse/pulls

Yes, one could automatically generate typing stub files. But comments seemed easier at a time. Otherwise one would have to create whole infrastructure to pass those types around and make those extra files.

As I remember, in the current implementation of packager original sources are still in the package. So IDE will see original sources with types. Not sure about mypy.

And source maps will be mostly used for stack traces, like in js.

nvbn avatar Sep 27 '17 17:09 nvbn

Now closed https://github.com/simonpercivall/astunparse/pull/19 and https://github.com/simonpercivall/astunparse/pull/20

jayvdb avatar Oct 10 '20 07:10 jayvdb