----------------
New features
~~~~~~~~~~~~
* New ``astor.rtrip`` command-line tool to test round-tripping
of Python source to AST and back to source.
(Contributed by Patrick Maupin.)
* New pretty printer outputs much better looking code:
- Remove parentheses where not necessary
- Use triple-quoted strings where it makes sense
- Add placeholder for function to do nice line wrapping on output
(Contributed by Patrick Maupin.)
* Additional Python 3.5 support:
- Additional unpacking generalizations (:pep:`448`)
- Async and await (:pep:`492`)
(Contributed by Zack M. Davis.)
* Added Python 3.6 feature support:
- f-strings (:pep:`498`)
- async comprehensions (:pep:`530`)
- variable annotations (:pep:`526`)
(Contributed by Ryan Gonzalez.)
* Code cleanup, including renaming for PEP8 and deprecation of old names.
See :ref:`deprecations` for more information.
(Contributed by Leonard Truong in `Issue 36`_.)
.. _`Issue 36`: https://github.com/berkerpeksag/astor/issues/36
Bug fixes
~~~~~~~~~
* Don't put trailing comma-spaces in dictionaries. astor will now create
``{'three': 3}`` instead of ``{'three': 3, }``.
(Contributed by Zack M. Davis.)
* Fixed several bugs in code generation:
. Keyword-only arguments should come before ``**``
. ``from .. import <member>`` with no trailing module name did not work
. Support ``from .. import foo as bar`` syntax
. Support ``with foo: ...``, ``with foo as bar: ...`` and
``with foo, bar as baz: ...`` syntax
. Support ``1eNNNN`` syntax
. Support ``return (yield foo)`` syntax
. Support unary operations such as ``-(1) + ~(2) + +(3)``
. Support ``if (yield): pass``
. Support ``if (yield from foo): pass``
. ``try...finally`` block needs to come after the ``try...else`` clause
. Wrap integers with parentheses where applicable (e.g. ``(0).real``
should generated)
. When the ``yield`` keyword is an expression rather than a statement,
it can be a syntax error if it is not enclosed in parentheses
. Remove extraneous parentheses around ``yield from``
(Contributed by Patrick Maupin in `Issue 27`_.)
.. _`Issue 27`: https://github.com/berkerpeksag/astor/issues/27