Skip to content

Conversation

@spezifant
Copy link
Contributor

Motivation

Certain build systems or configurations have Python packages located in a non-default path. Those are not found by Codegen per default.

Content

Codegen now considers the PYTHONPATH environment variable when resolving packages.

Testing

Added unit tests which resolve packages only when the PYTHONPATH is set in a correct way.

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

@spezifant spezifant requested review from a team and codegen-team as code owners February 21, 2025 15:06
@CLAassistant
Copy link

CLAassistant commented Feb 21, 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.
3 out of 4 committers have signed the CLA.

✅ spezifant
✅ christinewangcw
✅ tomcodgen
❌ Matthias Bartelt


Matthias Bartelt 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
Contributor

@eacodegen eacodegen left a comment

Choose a reason for hiding this comment

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

Would it be possible for you to add two options:

  1. Make respecting sys.path opt in
  2. Add additional overrides

Example: if codegen is installed a virtual environment, we wouldn't want to make the user set PYTHONPATH/install it into the project environment. We'd also not want to accidentally include code from their virtual enviornment

Copy link
Contributor

@eacodegen eacodegen left a comment

Choose a reason for hiding this comment

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

Thanks for the PR by the way! Let us know if you ever have any questions.

@bagel897 bagel897 mentioned this pull request Feb 22, 2025
2 tasks
@spezifant spezifant changed the title Check PYTHONPATH value when resolving a package Allow custom overrites for package resolving and optional sys.path support Feb 24, 2025
@tkfoss tkfoss merged commit 66ad2c6 into codegen-sh:develop Feb 26, 2025
21 of 26 checks passed
@tkfoss
Copy link
Contributor

tkfoss commented Feb 26, 2025

thank you @spezifant

@github-actions
Copy link
Contributor

🎉 This PR is included in version 0.37.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@spezifant spezifant deleted the spezifant-patch-1 branch February 26, 2025 06:38
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.

7 participants