Skip to content
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

Add psycopg2 extra, patch psycogreen in entry points. #915

Merged
merged 1 commit into from
May 20, 2024

Conversation

salomon-smekecohen
Copy link
Contributor

Closes #62

💸 TL;DR

If you want to use psycopg2, baseplate should automatically patch it for gevent. You can use sqlalchemy with a variety of postgres packages, not just psycopg2. So make the dependencies an extra instead of attaching to sqlalchemy or a "sqlalchemy-postgres" extra.

🧪 Testing Steps / Validation

Pointed my Baseplate.py project to this hash, no issues. Patch works as expected.

✅ Checks

  • CI tests (if present) are passing
  • Adheres to code style for repo
  • Contributor License Agreement (CLA) completed if not a Reddit employee

poetry.lock Outdated Show resolved Hide resolved
Comment on lines +42 to +43
psycopg2 = "^2.0.0"
psycogreen = "^1.0.0"
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I'm surprised this doesn't need to be marked with optional = true like the other extra dependencies, but I checked and the built wheel seems to correctly mark it as only needed with the extra:

Requires-Dist: psycogreen (>=1.0.0,<2.0.0) ; extra == "psycopg2"
Requires-Dist: psycopg2 (>=2.0.0,<3.0.0) ; extra == "psycopg2"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Chris! Yeah maybe I messed this up, I have never added an extra using poetry before. If you have a docs link to how you did it ill give it a read to try and track down differences.

@chriskuehl chriskuehl merged commit 9ea10ec into reddit:develop May 20, 2024
5 checks passed
@salomon-smekecohen salomon-smekecohen deleted the issue-62 branch May 22, 2024 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Consider automating Psycogreen monkeypatching
2 participants