{"categories":[{"label":"Software Development","url":"https://skillfed.io/packages/category/software-development/9"}],"enrichment":{"capability":"Extends Python's built-in `ast` module to preserve comments as nodes in the Abstract Syntax Tree, allowing you to parse and analyze code while retaining inline and block comments.","skillfed_tags":["ast-parsing","code-analysis"],"use_cases":["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."],"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.\n\nThe library's API mirrors the standard `ast` module exactly \u2014 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.","worth_installing":"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."},"id":"ast-comments","links":{"html":"https://skillfed.io/packages/ast-comments","md":"https://skillfed.io/packages/ast-comments.md","pypi":"https://pypi.org/project/ast-comments/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2026-02-22","license_spdx":null,"license_treatment":"permissive","name":"ast-comments","python_support":"supports_current","summary":null},"popularity":{"monthly_downloads":334312,"position":7492,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"1.3.0"}
