loongson/pypi/: astor-0.8.1 metadata and description

Homepage Simple index

Read/rewrite/write Python ASTs

author Patrick Maupin
author_email pmaupin@gmail.com
  • Development Status :: 5 - Production/Stable
  • Environment :: Console
  • Intended Audience :: Developers
  • License :: OSI Approved :: BSD License
  • Operating System :: OS Independent
  • Programming Language :: Python
  • Programming Language :: Python :: 2
  • Programming Language :: Python :: 2.7
  • Programming Language :: Python :: 3
  • Programming Language :: Python :: 3.4
  • Programming Language :: Python :: 3.5
  • Programming Language :: Python :: 3.6
  • Programming Language :: Python :: 3.7
  • Programming Language :: Python :: 3.8
  • Programming Language :: Python :: Implementation
  • Programming Language :: Python :: Implementation :: CPython
  • Programming Language :: Python :: Implementation :: PyPy
  • Topic :: Software Development :: Code Generators
  • Topic :: Software Development :: Compilers
keywords ast,codegen,PEP 8
license BSD-3-Clause
  • Independent
requires_python !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7

Because this project isn't in the mirror_whitelist, no releases from root/pypi are included.

File Tox results History
27 KB
Python Wheel
  • Replaced 1 time(s)
  • Uploaded to loongson/pypi by loongson 2022-08-08 02:35:01
License:3-clause BSD
Build status:Travis CI

astor is designed to allow easy manipulation of Python source via the AST.

There are some other similar libraries, but astor focuses on the following areas:


The decompilation back to Python is based on code originally written by Armin Ronacher. Armin’s code was well-structured, but failed on some obscure corner cases of the Python language (and even more corner cases when the AST changed on different versions of Python), and its output arguably had cosmetic issues – for example, it produced parentheses even in some cases where they were not needed, to avoid having to reason about precedence.

Other derivatives of Armin’s code are floating around, and typically have fixes for a few corner cases that happened to be noticed by the maintainers, but most of them have not been tested as thoroughly as astor. One exception may be the version of codegen maintained at github by CensoredUsername. This has been tested to work properly on Python 2.7 using astor’s test suite, and, as it is a single source file, it may be easier to drop into some applications that do not require astor’s other features or Python 3.x compatibility.