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:
- Round-trip an AST back to Python:
- Modified AST doesn't need linenumbers, ctx, etc. or otherwise
be directly compileable for the round-trip to work.
- Easy to read generated code as, well, code
- Can round-trip two different source trees to compare for functional
differences, using the astor.rtrip tool (for example, after PEP8 edits).
- Dump pretty-printing of AST
- Harder to read than round-tripped code, but more accurate to figure out what
is going on.
- Easier to read than dump from built-in AST module
- Non-recursive treewalk
- Sometimes you want a recursive treewalk (and astor supports that, starting
at any node on the tree), but sometimes you don't need to do that. astor
doesn't require you to explicitly visit sub-nodes unless you want to:
- You can add code that executes before a node's children are visited, and/or
- You can add code that executes after a node's children are visited, and/or
- You can add code that executes and keeps the node's children from being
visited (and optionally visit them yourself via a recursive call)
- Write functions to access the tree based on object names and/or attribute names
- Enjoy easy access to parent node(s) for tree rewriting
Provides
Requires
License
BSD-3-Clause
Changelog
* Mon Sep 08 2025 Markéta Machová <mmachova@suse.com>
- Add py314.patch to support Python 3.14
* Fri Jun 13 2025 Steve Kowalik <steven.kowalik@suse.com>
- Switch to pyproject macros.
- Add patches, to support Python 3.12+:
* lower-huge-int.patch
* support-match.patch
* Thu Jul 04 2024 Daniel Garcia <daniel.garcia@suse.com>
- Skip same tests for python-3.13
* Thu Sep 28 2023 Daniel Garcia <daniel.garcia@suse.com>
- Skip same tests for python-3.12
* Fri Apr 21 2023 Dirk Müller <dmueller@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
* Thu Apr 13 2023 Matej Cepl <mcepl@suse.com>
- Make calling of %{sle15modernpython} optional.
* Tue Jan 10 2023 Daniel Garcia <daniel.garcia@suse.com>
- Skip same tests for python-3.11
* Mon Sep 12 2022 Markéta Machová <mmachova@suse.com>
- Skip test_huge_int due to new security feature in Python
* https://github.com/python/cpython/issues/95778
* Sun Dec 12 2021 Ben Greiner <code@bnavigator.de>
- Also skip convert_stdlib in python310: still not fixed
* Fri Mar 19 2021 Ben Greiner <code@bnavigator.de>
- Skip failing stdlib roundtrip test on python39
gh#berkerpeksag/astor#196
Files
/usr/lib/python3.14/site-packages/astor
/usr/lib/python3.14/site-packages/astor-0.8.1.dist-info
/usr/lib/python3.14/site-packages/astor-0.8.1.dist-info/INSTALLER
/usr/lib/python3.14/site-packages/astor-0.8.1.dist-info/METADATA
/usr/lib/python3.14/site-packages/astor-0.8.1.dist-info/RECORD
/usr/lib/python3.14/site-packages/astor-0.8.1.dist-info/REQUESTED
/usr/lib/python3.14/site-packages/astor-0.8.1.dist-info/WHEEL
/usr/lib/python3.14/site-packages/astor-0.8.1.dist-info/licenses
/usr/lib/python3.14/site-packages/astor-0.8.1.dist-info/licenses/AUTHORS
/usr/lib/python3.14/site-packages/astor-0.8.1.dist-info/licenses/LICENSE
/usr/lib/python3.14/site-packages/astor-0.8.1.dist-info/top_level.txt
/usr/lib/python3.14/site-packages/astor-0.8.1.dist-info/zip-safe
/usr/lib/python3.14/site-packages/astor/VERSION
/usr/lib/python3.14/site-packages/astor/__init__.py
/usr/lib/python3.14/site-packages/astor/__pycache__
/usr/lib/python3.14/site-packages/astor/__pycache__/__init__.cpython-314.opt-1.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/__init__.cpython-314.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/code_gen.cpython-314.opt-1.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/code_gen.cpython-314.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/codegen.cpython-314.opt-1.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/codegen.cpython-314.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/file_util.cpython-314.opt-1.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/file_util.cpython-314.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/node_util.cpython-314.opt-1.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/node_util.cpython-314.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/op_util.cpython-314.opt-1.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/op_util.cpython-314.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/rtrip.cpython-314.opt-1.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/rtrip.cpython-314.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/source_repr.cpython-314.opt-1.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/source_repr.cpython-314.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/string_repr.cpython-314.opt-1.pyc
/usr/lib/python3.14/site-packages/astor/__pycache__/string_repr.cpython-314.