berkerpeksag / astor

Python AST read/write
https://pypi.org/project/astor/
BSD 3-Clause "New" or "Revised" License
810 stars 102 forks source link

Suspected API breakage from 0.6 to 0.6.1 #87

Closed mdanatg closed 6 years ago

mdanatg commented 6 years ago

Hi, our builds started failing with AttributeError: module 'astor' has no attribute 'codegen':

https://travis-ci.org/google/tangent/jobs/300437272

I wonder if it's related to the new 0.6.1 release?

berkerpeksag commented 6 years ago

Thank you for your report, @mdanatg. 0.6 was actually broken due to the way deprecate() function in astor/__init__.py implemented and it broke Hy: https://github.com/hylang/hy/issues/1452

Adding

# Note that 'astor.codegen' is renamed to 'astor.code_gen'
# but it will stay until astor 1.0.
import astor.codegen

after

https://github.com/google/tangent/blob/ff9ffddd4f2cc5f6b51a29545fcd1d2a036773e8/tangent/quoting.py#L19

would fix the build for now.

I'll try to find a way to make both use cases work. Sorry for the trouble!

berkerpeksag commented 6 years ago

@mdanatg I couldn't run tangent tests under my system because my glibc version was too old for Tensorflow (https://github.com/tensorflow/tensorflow/issues/53), but I believe PR #88 fixed this issue.

I just released 0.6.2.

mdanatg commented 6 years ago

@berkerpeksag Thank you for the quick fix!

Would it be useful for us to rename codegen to code_gen in out code base?

berkerpeksag commented 6 years ago

We don't plan to remove old imports before version 1.0.0 (we may keep them even after 1.0.0 if we don't introduce more serious API changes) so I'd say it's OK to keep astor.codegen imports in the foreseeable future.