Co

Codegen – OSS Python Library for Advanced Code Manipulation

Hacker News

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. 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.

Share card

Actual performance

14points
3comments
Made the leaderboard

Launch Intel predictions

Analyze your own launch →
Product HuntOn track for Day 1 leaderboard · Strong signals: new, visual, tasks · Missing: mac, agents, macos
90%90% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Hacker NewsStrong engagement from HN community · Strong signals: excited, exist, existing · Missing: https docs, just released, lua
84%84% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
Indie HackersFits the IH revenue-focused audience · Strong signals: including · Missing: supports, reddit linkedin, podcasting
79%79% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
TrustMRRLess likely to generate early MRR · Missing: mobile apps, ios, personal
43%43% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Strong signals: interface · Missing: plus, platform, intuitive
43%43% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Strong signals: training · Missing: arr, mrr, revenue
15%15% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Re
Redframes, a Python data manipulation library like dplyr67%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Redframes, a Python data manipulation library like dplyr

Hacker News8
Python String Manipulation Handbook
Python String Manipulation Handbook52%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Python String Manipulation Handbook

Indie Hackers1books
St
String-fn – string manipulation library55%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

String-fn – string manipulation library

Hacker News4
A
A RIFF parsing and manipulation library61%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A RIFF parsing and manipulation library

Hacker News1
Ti
Ticktock – A Python code metering library61%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Ticktock – A Python code metering library

Hacker News3
Dp
Dplython, dplyr data manipulation for python64%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Dplython, dplyr data manipulation for python

Hacker News11
Da
Dataiter – Python classes for data manipulation43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Dataiter – Python classes for data manipulation

Hacker News3
Fl
Fleming, Better Datetime/Timezone Manipulation for Python66%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Fleming, Better Datetime/Timezone Manipulation for Python

Hacker News4
A
A Python library for Unicode string collation55%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A Python library for Unicode string collation

Hacker News4
Py
Python library for parsing Dockerfile65%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Python library for parsing Dockerfile

Hacker News2