Skip to content

Conversation

@codegen-sh
Copy link

@codegen-sh codegen-sh bot commented May 12, 2025

Description

This PR implements the missing codegen_sdk_codebase.py module in the codegen-on-oss/codegen_on_oss/analyzers/ directory. The module provides functionality for accessing the Codegen SDK codebase for analysis.

Changes Made

  1. Created a new codegen_sdk_codebase.py file in the analyzers directory with the following functions:

    • get_codegen_sdk_base_path(): Determines the base path of the Codegen SDK
    • get_codegen_sdk_subdirectories(): Returns a list of subdirectories containing the SDK code
    • get_codegen_sdk_codebase(): Creates a Codebase instance specifically for the SDK
  2. Updated the __init__.py file to expose the new module's functions

  3. Added comprehensive tests for the new module

Testing

Added unit tests to verify the functionality of the new module. The tests cover:

  • Finding the SDK base path
  • Getting SDK subdirectories
  • Creating a Codebase instance for the SDK

Resolves

Resolves ZAM-371


💻 View my workAbout Codegen

Summary by Sourcery

Implement tooling to locate and analyze the Codegen SDK codebase and integrate it into the analyzers framework

New Features:

  • Add codegen_sdk_codebase module with functions to locate the SDK base path, gather SDK subdirectories, and instantiate a Codebase for the SDK

Enhancements:

  • Expose the new SDK codebase functions in the analyzers package initialization

Tests:

  • Introduce unit tests verifying SDK path detection, subdirectory listing, and codebase creation logic

clee-codegen and others added 30 commits February 26, 2025 23:54
# Motivation

The **Codegen on OSS** package provides a pipeline that:

- **Collects repository URLs** from different sources (e.g., CSV files
or GitHub searches).
- **Parses repositories** using the codegen tool.
- **Profiles performance** and logs metrics for each parsing run.
- **Logs errors** to help pinpoint parsing failures or performance
bottlenecks.

<!-- Why is this change necessary? -->

# Content

<!-- Please include a summary of the change -->
see
[codegen-on-oss/README.md](https://github.com/codegen-sh/codegen-sdk/blob/acfe3dc07b65670af33b977fa1e7bc8627fd714e/codegen-on-oss/README.md)

# Testing

<!-- How was the change tested? -->
`uv run modal run modal_run.py`
No unit tests yet 😿 

# Please check the following before marking your PR as ready for review

- [ ] I have added tests for my changes
- [x] I have updated the documentation or added new documentation as
needed
Original commit by Tawsif Kamal: Revert "Revert "Adding Schema for Tool Outputs"" (codegen-sh#894)

Reverts codegen-sh#892

---------

Co-authored-by: Rushil Patel <rpatel@codegen.com>
Co-authored-by: rushilpatel0 <171610820+rushilpatel0@users.noreply.github.com>
Original commit by Ellen Agarwal: fix: Workaround for relace not adding newlines (codegen-sh#907)
Zeeeepa and others added 19 commits April 23, 2025 11:36
Original commit by Edo Pujol: fix: return branch name with pr changes

# Motivation

<!-- Why is this change necessary? -->

# Content

<!-- Please include a summary of the change -->

# Testing

<!-- How was the change tested? -->

# Please check the following before marking your PR as ready for review

- [ ] I have added tests for my changes
- [ ] I have updated the documentation or added new documentation as
needed
Original commit by Tawsif Kamal: fix: additional tools won't duplicate (codegen-sh#928)

additional_tools stay

just will be overriden by duplicate tools passed in from
additional_tools
Original commit by renovate[bot]: chore(deps): update astral-sh/setup-uv action to v5.4 (codegen-sh#938)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [astral-sh/setup-uv](https://redirect.github.com/astral-sh/setup-uv) |
action | minor | `v5.3` -> `v5.4` |

---

### Release Notes

<details>
<summary>astral-sh/setup-uv (astral-sh/setup-uv)</summary>

###
[`v5.4`](https://redirect.github.com/astral-sh/setup-uv/compare/v5.3...v5.4)

[Compare
Source](https://redirect.github.com/astral-sh/setup-uv/compare/v5.3...v5.4)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - "* 0-3 * * 1" (UTC).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/codegen-sh/codegen).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjIwNy4xIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Original commit by Edward Li: feat: Add `setup_commands` to `repo_config` (codegen-sh#1050)
Original commit by Christine Wang: fix: add `get_issue_safe` to repo client (codegen-sh#816)
Original commit by Carol Jung: fix: CG-17050: skip codebase init if repo operator is none (codegen-sh#999)

# Motivation

<!-- Why is this change necessary? -->

# Content

<!-- Please include a summary of the change -->

# Testing

<!-- How was the change tested? -->

# Please check the following before marking your PR as ready for review

- [ ] I have added tests for my changes
- [ ] I have updated the documentation or added new documentation as
needed
Original commit by Christine Wang: fix: add logs for git init failure (codegen-sh#1000)
Original commit by Carol Jung: feat: better logger stream allocation (codegen-sh#1006)

# Motivation

<!-- Why is this change necessary? -->

# Content

<!-- Please include a summary of the change -->

# Testing

<!-- How was the change tested? -->

# Please check the following before marking your PR as ready for review

- [ ] I have added tests for my changes
- [ ] I have updated the documentation or added new documentation as
needed
Original commit by Rushil Patel: feat: api client (codegen-sh#1027)

# Motivation

<!-- Why is this change necessary? -->

# Content

<!-- Please include a summary of the change -->

# Testing

<!-- How was the change tested? -->

# Please check the following before marking your PR as ready for review

- [ ] I have added tests for my changes
- [ ] I have updated the documentation or added new documentation as
needed

---------

Co-authored-by: rushilpatel0 <171610820+rushilpatel0@users.noreply.github.com>
Original commit by Rushil Patel: fix: undefined field type (codegen-sh#1031)

# Motivation

<!-- Why is this change necessary? -->

# Content

<!-- Please include a summary of the change -->

# Testing

<!-- How was the change tested? -->

# Please check the following before marking your PR as ready for review

- [ ] I have added tests for my changes
- [ ] I have updated the documentation or added new documentation as
needed

---------

Co-authored-by: rushilpatel0 <171610820+rushilpatel0@users.noreply.github.com>
@sourcery-ai
Copy link

sourcery-ai bot commented May 12, 2025

Reviewer's Guide

Implements a new analyzer module for locating and loading the Codegen SDK codebase by adding path-resolution functions and Codebase factory logic, updates the analyzers package to expose these utilities, and adds unit tests to validate base path discovery, subdirectory enumeration, and codebase instantiation.

File-Level Changes

Change Details Files
Add codegen_sdk_codebase analyzer module
  • Introduce get_codegen_sdk_base_path to detect SDK root
  • Implement get_codegen_sdk_subdirectories for path enumeration
  • Create get_codegen_sdk_codebase to build a Codebase instance
codegen-on-oss/codegen_on_oss/analyzers/codegen_sdk_codebase.py
Expose SDK utilities in analyzers package
  • Add get_selected_codebase, get_codegen_sdk_codebase, and get_codegen_sdk_subdirectories to init.py exports
codegen-on-oss/codegen_on_oss/analyzers/__init__.py
Add tests for SDK codebase utilities
  • Test base path resolution across common locations
  • Verify subdirectory listing under various presence scenarios
  • Validate Codebase instantiation parameters for SDK
codegen-on-oss/tests/test_codegen_sdk_codebase.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@korbit-ai
Copy link

korbit-ai bot commented May 12, 2025

By default, I don't review pull requests opened by bots. If you would like me to review this pull request anyway, you can request a review via the /korbit-review command in a comment.

@coderabbitai
Copy link

coderabbitai bot commented May 12, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Join our Discord community for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codegen-sh
Copy link
Author

codegen-sh bot commented May 12, 2025

Hey! 👋 I see one of the checks failed. I am on it! 🫡

💻 View my work

@codegen-sh
Copy link
Author

codegen-sh bot commented May 12, 2025

I've fixed the code style issues in the PR. The main problems were:

  1. Using List and Optional from typing instead of using Python 3.10+ syntax (list[str] and | None)
  2. Formatting issues in the code (whitespace, line breaks, etc.)
  3. Import ordering in the __init__.py file

I've pushed a commit that addresses these issues, and the checks are now running. Let's wait to see if they pass.

The changes I made:

  1. Updated type hints to use modern Python syntax
  2. Fixed code formatting according to the project's style guidelines
  3. Reorganized imports and exports in the __init__.py file

I'll update you once the checks complete.

💻 View my work

@codegen-sh
Copy link
Author

codegen-sh bot commented May 12, 2025

The checks are still running on our fix. I've made the following changes to address the failing pre-commit checks:

  1. Updated the type annotations in codegen_sdk_codebase.py:

    • Changed List[str] to list[str]
    • Changed Optional[Type] to Type | None
    • Removed unnecessary imports from typing module
  2. Fixed code formatting issues:

    • Removed extra whitespace
    • Fixed line breaks and indentation
    • Properly formatted multi-line strings and docstrings
  3. Reorganized the __init__.py file:

    • Sorted imports alphabetically within their groups
    • Sorted the __all__ list alphabetically
    • Fixed string quotes to be consistent (using double quotes)

These changes should address the failing pre-commit checks. The CI pipeline is currently running to verify our fixes. I'll update you once all checks have completed.

💻 View my work • React 👍 or 👎

@codegen-sh
Copy link
Author

codegen-sh bot commented May 12, 2025

Hey! 👋 I see one of the checks failed. I am on it! 🫡

💻 View my work

@codegen-sh
Copy link
Author

codegen-sh bot commented May 12, 2025

I've fixed the failing checks in PR #101 by updating the type annotations in the codegen_sdk_codebase.py file to use modern Python syntax. The main changes were:

  1. Replaced from typing import List, Optional with native Python type annotations:

    • Changed List[str] to list[str]
    • Used the pipe operator (|) for union types instead of Optional
  2. Maintained consistent formatting and docstrings throughout the files

I've pushed these changes to the PR branch. The CI checks are currently running to verify the fixes. The changes were minimal but necessary to comply with the project's coding standards and type checking requirements.

Let me know if you need any further adjustments to the PR!

💻 View my work • React 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants