diff --git a/README.md b/README.md index f9e94756b..b05e8b9da 100644 --- a/README.md +++ b/README.md @@ -1,117 +1,117 @@ -
+
๐ŸŒŸ -

- - - -

+

๐Ÿš€ + ๐Ÿ“š + ๐Ÿ–ผ๏ธ + ๐Ÿ”— +

๐ŸŽจ -

- Scriptable interface to a powerful, multi-lingual language server. -

+

๐Ÿ’ป + Scriptable interface to a powerful, multi-lingual language server. ๐ŸŒ +

๐Ÿ”ฅ -
+
๐ŸŽฏ -[![PyPI](https://img.shields.io/badge/PyPi-codegen-gray?style=flat-square&color=blue)](https://pypi.org/project/codegen/) -[![Documentation](https://img.shields.io/badge/Docs-docs.codegen.com-purple?style=flat-square)](https://docs.codegen.com) -[![Slack Community](https://img.shields.io/badge/Slack-Join-4A154B?logo=slack&style=flat-square)](https://community.codegen.com) -[![License](https://img.shields.io/badge/Code%20License-Apache%202.0-gray?&color=gray)](https://github.com/codegen-sh/codegen-sdk/tree/develop?tab=Apache-2.0-1-ov-file) -[![Follow on X](https://img.shields.io/twitter/follow/codegen?style=social)](https://x.com/codegen) +[![PyPI](https://img.shields.io/badge/PyPi-codegen-gray?style=flat-square&color=blue)](https://pypi.org/project/codegen/) ๐Ÿ“ฆ +[![Documentation](https://img.shields.io/badge/Docs-docs.codegen.com-purple?style=flat-square)](https://docs.codegen.com) ๐Ÿ“– +[![Slack Community](https://img.shields.io/badge/Slack-Join-4A154B?logo=slack&style=flat-square)](https://community.codegen.com) ๐Ÿ‘ฅ +[![License](https://img.shields.io/badge/Code%20License-Apache%202.0-gray?&color=gray)](https://github.com/codegen-sh/codegen-sdk/tree/develop?tab=Apache-2.0-1-ov-file) โš–๏ธ +[![Follow on X](https://img.shields.io/twitter/follow/codegen?style=social)](https://x.com/codegen) ๐Ÿฆ -
+
๐ŸŒˆ -
+
โœจ -[Codegen](https://docs.codegen.com) is a python library for manipulating codebases. +[Codegen](https://docs.codegen.com) is a python library for manipulating codebases. ๐Ÿ -```python -from codegen import Codebase +```python ๐Ÿ’ก +from codegen import Codebase ๐Ÿงฉ -# Codegen builds a complete graph connecting -# functions, classes, imports and their relationships -codebase = Codebase("./") +# Codegen builds a complete graph connecting ๐Ÿ”„ +# functions, classes, imports and their relationships ๐Ÿ”— +codebase = Codebase("./") ๐Ÿ“‚ -# Work with code without dealing with syntax trees or parsing -for function in codebase.functions: - # Comprehensive static analysis for references, dependencies, etc. - if not function.usages: - # Auto-handles references and imports to maintain correctness - function.move_to_file("deprecated.py") +# Work with code without dealing with syntax trees or parsing ๐ŸŒณ +for function in codebase.functions: ๐Ÿ” + # Comprehensive static analysis for references, dependencies, etc. ๐Ÿ”ฌ + if not function.usages: ๐Ÿšซ + # Auto-handles references and imports to maintain correctness โœ… + function.move_to_file("deprecated.py") ๐Ÿ“‹ ``` -Write code that transforms code. Codegen combines the parsing power of [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) with the graph algorithms of [rustworkx](https://github.com/Qiskit/rustworkx) to enable scriptable, multi-language code manipulation at scale. +Write code that transforms code. Codegen combines the parsing power of [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) with the graph algorithms of [rustworkx](https://github.com/Qiskit/rustworkx) to enable scriptable, multi-language code manipulation at scale. ๐Ÿ”„ -## Installation and Usage +## Installation and Usage ๐Ÿ“ฅ -We support +We support ๐Ÿ› ๏ธ -- Running Codegen in Python 3.12 - 3.13 (recommended: Python 3.13+) -- macOS and Linux - - macOS is supported - - Linux is supported on x86_64 and aarch64 with glibc 2.34+ - - Windows is supported via WSL. See [here](https://docs.codegen.com/building-with-codegen/codegen-with-wsl) for more details. -- Python, Typescript, Javascript and React codebases +- Running Codegen in Python 3.12 - 3.13 (recommended: Python 3.13+) ๐Ÿ +- macOS and Linux ๐Ÿ’ป + - macOS is supported ๐ŸŽ + - Linux is supported on x86_64 and aarch64 with glibc 2.34+ ๐Ÿง + - Windows is supported via WSL. See [here](https://docs.codegen.com/building-with-codegen/codegen-with-wsl) for more details. ๐ŸชŸ +- Python, Typescript, Javascript and React codebases ๐Ÿงฐ -``` -# Install inside existing project -uv pip install codegen +```๐Ÿ“ +# Install inside existing project ๐Ÿ—๏ธ +uv pip install codegen ๐Ÿ“ฆ -# Install global CLI -uv tool install codegen --python 3.13 +# Install global CLI ๐ŸŒ +uv tool install codegen --python 3.13 ๐Ÿ› ๏ธ -# Create a codemod for a given repo -cd path/to/repo -codegen init -codegen create test-function +# Create a codemod for a given repo ๐Ÿ”ง +cd path/to/repo ๐Ÿ“‚ +codegen init โœจ +codegen create test-function ๐Ÿงช -# Run the codemod -codegen run test-function +# Run the codemod ๐Ÿš€ +codegen run test-function โ–ถ๏ธ -# Create an isolated venv with codegen => open jupyter -codegen notebook +# Create an isolated venv with codegen => open jupyter ๐Ÿง  +codegen notebook ๐Ÿ““ ``` -## Usage +## Usage ๐Ÿ”ง -See [Getting Started](https://docs.codegen.com/introduction/getting-started) for a full tutorial. +See [Getting Started](https://docs.codegen.com/introduction/getting-started) for a full tutorial. ๐Ÿ“š -``` -from codegen import Codebase +```๐Ÿ’ป +from codegen import Codebase ๐Ÿงฉ ``` -## Troubleshooting +## Troubleshooting ๐Ÿ” -Having issues? Here are some common problems and their solutions: +Having issues? Here are some common problems and their solutions: ๐Ÿ› ๏ธ -- **I'm hitting an UV error related to `[[ packages ]]`**: This means you're likely using an outdated version of UV. Try updating to the latest version with: `uv self update`. -- **I'm hitting an error about `No module named 'codegen.sdk.extensions.utils'`**: The compiled cython extensions are out of sync. Update them with `uv sync --reinstall-package codegen`. -- **I'm hitting a `RecursionError: maximum recursion depth exceeded` error while parsing my codebase**: If you are using python 3.12, try upgrading to 3.13. If you are already on 3.13, try upping the recursion limit with `sys.setrecursionlimit(10000)`. +- **I'm hitting an UV error related to `[[ packages ]]`**: This means you're likely using an outdated version of UV. Try updating to the latest version with: `uv self update`. ๐Ÿ”„ +- **I'm hitting an error about `No module named 'codegen.sdk.extensions.utils'`**: The compiled cython extensions are out of sync. Update them with `uv sync --reinstall-package codegen`. ๐Ÿ”„ +- **I'm hitting a `RecursionError: maximum recursion depth exceeded` error while parsing my codebase**: If you are using python 3.12, try upgrading to 3.13. If you are already on 3.13, try upping the recursion limit with `sys.setrecursionlimit(10000)`. ๐Ÿ”„ -If you run into additional issues not listed here, please [join our slack community](https://community.codegen.com) and we'll help you out! +If you run into additional issues not listed here, please [join our slack community](https://community.codegen.com) and we'll help you out! ๐Ÿค -## Resources +## Resources ๐Ÿ“š -- [Docs](https://docs.codegen.com) -- [Getting Started](https://docs.codegen.com/introduction/getting-started) -- [Contributing](CONTRIBUTING.md) -- [Contact Us](https://codegen.com/contact) +- [Docs](https://docs.codegen.com) ๐Ÿ“– +- [Getting Started](https://docs.codegen.com/introduction/getting-started) ๐Ÿš€ +- [Contributing](CONTRIBUTING.md) ๐Ÿค +- [Contact Us](https://codegen.com/contact) ๐Ÿ“ง -## Why Codegen? +## Why Codegen? ๐Ÿค” -Software development is fundamentally programmatic. Refactoring a codebase, enforcing patterns, or analyzing control flow - these are all operations that can (and should) be expressed as programs themselves. +Software development is fundamentally programmatic. Refactoring a codebase, enforcing patterns, or analyzing control flow - these are all operations that can (and should) be expressed as programs themselves. ๐Ÿ’ก -We built Codegen backwards from real-world refactors performed on enterprise codebases. Instead of starting with theoretical abstractions, we focused on creating APIs that match how developers actually think about code changes: +We built Codegen backwards from real-world refactors performed on enterprise codebases. Instead of starting with theoretical abstractions, we focused on creating APIs that match how developers actually think about code changes: ๐Ÿง  -- **Natural mental model**: Write transforms that read like your thought process - "move this function", "rename this variable", "add this parameter". No more wrestling with ASTs or manual import management. +- **Natural mental model**: Write transforms that read like your thought process - "move this function", "rename this variable", "add this parameter". No more wrestling with ASTs or manual import management. ๐Ÿงฉ -- **Battle-tested on complex codebases**: Handle Python, TypeScript, and React codebases with millions of lines of code. +- **Battle-tested on complex codebases**: Handle Python, TypeScript, and React codebases with millions of lines of code. ๐Ÿ’ช -- **Built for advanced intelligences**: As AI developers become more sophisticated, they need expressive yet precise tools to manipulate code. Codegen provides a programmatic interface that both humans and AI can use to express complex transformations through code itself. +- **Built for advanced intelligences**: As AI developers become more sophisticated, they need expressive yet precise tools to manipulate code. Codegen provides a programmatic interface that both humans and AI can use to express complex transformations through code itself. ๐Ÿค– -## Contributing +## Contributing ๐Ÿค -Please see our [Contributing Guide](CONTRIBUTING.md) for instructions on how to set up the development environment and submit contributions. +Please see our [Contributing Guide](CONTRIBUTING.md) for instructions on how to set up the development environment and submit contributions. ๐Ÿ› ๏ธ -## Enterprise +## Enterprise ๐Ÿข -For more information on enterprise engagements, please [contact us](https://codegen.com/contact) or [request a demo](https://codegen.com/request-demo). +For more information on enterprise engagements, please [contact us](https://codegen.com/contact) or [request a demo](https://codegen.com/request-demo). ๐Ÿ“ž