Skip to content

Support Codebase.from_string and Codebase.from_files #630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 26, 2025

Conversation

tawsifkamal
Copy link
Contributor

Codebase.from_string
Parameters

  • code: str -> pass in the code you want to parse
  • language: str | ProgrammingLanguage -> pass in the programming language of the code

Raises error if programming language is not parsed

Codebase.from_files
Parameters

  • files: dict[str, str] -> pass in dict of {filename: code, filename: code}

  • language str | ProgrammingLanguage | None -> pass in programming language of the code

  • uses .ts, .js, .tsx, .jsx or .py to figure out language support of language not passed in

  • will not allow mismatched extensions (i.e test.py, and test.ts)

@tawsifkamal tawsifkamal requested review from codegen-team and a team as code owners February 24, 2025 22:28
@CLAassistant
Copy link

CLAassistant commented Feb 24, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ tawsifkamal
❌ codegen-bot


codegen-bot seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

codecov bot commented Feb 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files

filename = "test.ts" if prog_lang == ProgrammingLanguage.TYPESCRIPT else "test.py"

# Create temporary directory
import tempfile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we not import this top level?

@tawsifkamal tawsifkamal merged commit 7e2c9ef into develop Feb 26, 2025
25 of 27 checks passed
@tawsifkamal tawsifkamal deleted the tawsif/codebase-from-string-from-files branch February 26, 2025 23:29
Copy link
Contributor

🎉 This PR is included in version 0.41.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants