$npx skillfedfor your agent

ast-comments

Worth itPyPI Software DevelopmentReleased Feb 2026334.3K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — ast_comments-1.3.0-py3-none-any.whl
v1.3.0 · released 2026-02-22 · Python <4.0,>=3.8

Yes. The package is actively maintained, has no dependencies, installs cleanly, carries no known vulnerabilities, and solves a real gap in Python's standard library for anyone who needs comments in the AST. Install it if you're building tools that parse and regenerate Python code while preserving comments.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.8 or above; unparsing with comments preserved requires Python 3.9+.
  • Low friction: pure Python wheel with no runtime dependencies.
  • Actively maintained with a recent commit on 2026-02-22 and no known vulnerabilities.

License · maintenance · safety

MIT (permissive) — MIT license (permissive) — you can use, modify, and distribute this package freely in commercial or private projects with minimal restrictions.

last release 2026-02-22 (173 days) · last repo commit 2026-02-22 · 50 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 334,312 downloads/mo, #7,492 on PyPI

Verify before relying

pip install ast-comments

from ast_comments import parse, dump
tree = parse("x = 1  # comment")
print(dump(tree))
  • Whether the `pre_compile_fixer()` function handles all edge cases for stripping comments before compilation.
  • Performance characteristics when parsing very large source files with many comments.
Same gist for agents: .md · .json

What it is and what it does

ast-comments is a thin wrapper around Python's standard `ast` module that adds comment preservation to the Abstract Syntax Tree. When you parse source code with this library, comments appear as `Comment` nodes alongside the normal AST nodes, each carrying the comment text and a flag indicating whether it was inline or block-level. This is useful for tools that need to round-trip source code (parse it, analyze it, and regenerate it) while keeping comments intact.

The library's API mirrors the standard `ast` module exactly — you call `parse()` the same way you would with the built-in module, and the result is a standard `ast.Module` object with the addition of `Comment` nodes in the tree. For Python 3.9+, you can also unparse the tree back to source with comments preserved. The main gotcha is that Python's `compile()` function cannot directly consume the tree; the library provides a `pre_compile_fixer()` function to strip comments when compilation is needed.

Use it for

  • Code refactoring tools that need to preserve developer comments when transforming source.
  • Documentation generators that extract and process inline comments as metadata.
  • Linters or code analyzers that want to report issues with comment context.
  • Source-to-source translators or code formatters that must round-trip comments.
  • AST-based code inspection tools that treat comments as semantic information.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

The package is actively maintained, has no dependencies, installs cleanly, carries no known vulnerabilities, and solves a real gap in Python's standard library for anyone who needs comments in the AST. Install it if you're building tools that parse and regenerate Python code while preserving comments.

Install

ast-comments on PyPI

Before you install

Low friction: pure Python wheel with no runtime dependencies. Actively maintained with a recent commit on 2026-02-22 and no known vulnerabilities.

Requires Python 3.8 or above; unparsing with comments preserved requires Python 3.9+.

License in practice

MIT license (permissive) — you can use, modify, and distribute this package freely in commercial or private projects with minimal restrictions.

Quickstart

pip install ast-comments

from ast_comments import parse, dump
tree = parse("x = 1  # comment")
print(dump(tree))

Verify before relying

  • Whether the `pre_compile_fixer()` function handles all edge cases for stripping comments before compilation.
  • Performance characteristics when parsing very large source files with many comments.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release <4.0,>=3.8
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceActively maintained 173 days since the last release
Last repo commit
First released
Downloads334,312 / month, #7,492 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Evidence: ast_comments-1.3.0-py3-none-any.whl

Tags

Capabilities
ast with commentsparse python code preserve commentsabstract syntax tree commentscomment-aware ast parsingpython source code comments extraction
Topics
ast-parsingcode-analysis

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “ast with comments”

  • ast-commentsExtends Python's built-in `ast` module to preserve comments as nodes…
  • typed-astProvides Python 2.7 and Python 3 AST parsers with PEP 484 type…
  • baronBaron parses Python source code into a Full Syntax Tree (FST) that…

Give your agent the search over MCP, or paste the wish link into any chat.

More Software Development packages

typing-extensions Worth it
PyPI · Software Development · released Jul 2026

Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.

PSF-2.0pure Python · 3.9+
1.9Bdownloads / mo
numpy Worth it
PyPI · Software Development · released Aug 2026

NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.

BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0compiled wheel · 3.12+
1.1Bdownloads / mo
fastapi Worth it
PyPI · Software Development · released Jul 2026

FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.

MITpure Python · 3.10+
568.6Mdownloads / mo
annotated-doc With conditions
PyPI · Software Development · released Jul 2026

Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.

MITpure Python · 3.9+
456.2Mdownloads / mo
typer Worth it
PyPI · Software Development · released Aug 2026

Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.

Install it if you are building CLIs in Python.

MITpure Python · 3.10+
369.3Mdownloads / mo
distlib With conditions
PyPI · Software Development · released Jun 2026

Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.

permissive licensepure Python
323.3Mdownloads / mo

See also astatine · django-contrib-comments · typed-ast · asttokens · astunparse · ast-decompiler · commented-configparser · gast · json-with-comments · pr-commenter