Codegen – OSS Python Library for Advanced Code Manipulation
Hey HN! We've just open-sourced Codegen (https://github.com/codegen-sh/codegen-sdk), a Python library for manipulating Python + JS/React codebases. Codegen was engineered backwards from real-world, large-scale codebase analysis + refactors we performed on multi-million-line enterprise codebases. It provides a scriptable interface to a powerful, multi-lingual language server built on Tree-sitter. We realized that many code transformation tasks that impact large teams - refactors, enforcing patterns, analyzing control flow - are fundamentally programmatic operations.…
In plain words
Codegen is an open-source Python library for programmatically manipulating Python and JavaScript/React codebases. It provides a scriptable interface to a language server built on Tree-sitter, enabling developers to perform large-scale refactoring, pattern enforcement, and control flow analysis. Designed for teams working with multi-million-line enterprise codebases, it abstracts away AST complexity to let developers express code transformations in high-level terms rather than parser internals.
written from the facts on this page · September 2026
From the sources
In the maker’s words, at launch
Hey HN! We've just open-sourced Codegen (https://github.com/codegen-sh/codegen-sdk), a Python library for manipulating Python + JS/React codebases. Codegen was engineered backwards from real-world, large-scale codebase analysis + refactors we performed on multi-million-line enterprise codebases. It provides a scriptable interface to a powerful, multi-lingual language server built on Tree-sitter. We realized that many code transformation tasks that impact large teams - refactors, enforcing patterns, analyzing control flow - are fundamentally programmatic operations. Yet existing tools like LibCST and Jscodeshift often require you to think in terms of ASTs and parser internals rather than the high-level changes you want to make. Therefore, we built Codegen to match how developers actually think about code changes: # Move a symbol to a new file # Handles imports, references, dependencies function.move_to_file("new_file.py") # Rename across the codebase class_def.rename("NewName") # Updates all usages, preserves formatting # Analyze call patterns for usage in function.usages: print(f"Used in {usage.file.name}") Codegen handles the edge cases automatically - updating imports, preserving dependencies, maintaining references, and resolving naming conflicts. You focus on intent, we handle the details. Under the hood, Codegen performs static analysis to build a rich graph representation of your code. This enables: - Versatile and comprehensive operations - Built-in visualization capabilities - Blazing fast execution of large-scale refactors We've seen a wide variety of advanced code manipulation programs emerge, including: - Mining codebases for LLM pre-training data - Analyzing security vulnerabilities - Large-scale API migrations - Enforcing code patterns We're excited to share this with the community and look forward to your feedback. Give it a spin and let us know what you think! uv tool install codegen codegen notebook --demo Docs: https://docs.codegen.com GitHub: https://github.com/codegen-sh/codegen-sdk Community: https://community.codegen.com Let us know if you have any questions or interesting use cases you'd like to explore.
More dev tools this month
the category →



Open-source GTM skills for technical founders
Dev tools · 29d ago · gtmcofounder.com


OpenTrailPaper is open-source bike computer firmware for the LilyGO T5S3 4.7" E-Paper PRO. It supports offline maps, GPX routes, FIT recording and Bluetooth sensors.
Dev tools · 1d ago · opentrailpaper.com
Launched alongside, January 2025
the whole month →- IM
Hello! I'm Byran. I spent the past ~6 months engineering a laptop from scratch. It's fully open-source on GH at: https://github.com/Hello9999901/laptop
Dev tools · 2025 · byran.ee
- TITetris in a PDF▲1,289
I realized that the PDF engines of modern desktop browsers (PDFium and PDF.js) support JavaScript with enough I/O primitives to make a basic game like Tetris. It was a bit tricky to find a union of features that work in both engines, but in the end it turns out that showing/hiding annotation "fields" works well to make monochrome pixels, and keyboard input can be achieved by typing in a text input box. All in all it's quite janky but a nice reminder of how general purpose PDF scripting can be. The linked PDF is all ASCII so you can just open it in a text editor, or have a look at…
Life & fun · 2025 · th0mas.nl



Create lifelike, personalized AI avatars from text prompts
AI · 2025 · jogg.ai
