Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

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

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions bin/baseplate-script
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ from baseplate.server.monkey import patch_stdlib_queues
patch_all()
patch_stdlib_queues()

try:
import psycopg2
from psycogreen.gevent import patch_psycopg

patch_psycopg()
except ImportError:
pass


from baseplate.server import load_and_run_script

load_and_run_script()
9 changes: 9 additions & 0 deletions bin/baseplate-serve
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ from baseplate.server.monkey import patch_stdlib_queues
patch_all()
patch_stdlib_queues()

try:
import psycopg2
from psycogreen.gevent import patch_psycopg

patch_psycopg()
except ImportError:
pass


from baseplate.server import load_app_and_run_server

load_app_and_run_server()
9 changes: 9 additions & 0 deletions bin/baseplate-shell
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ from baseplate.server.monkey import patch_stdlib_queues
patch_all()
patch_stdlib_queues()

try:
import psycopg2
from psycogreen.gevent import patch_psycopg

patch_psycopg()
except ImportError:
pass


from baseplate.server import load_and_run_shell

load_and_run_shell()
9 changes: 9 additions & 0 deletions bin/baseplate-tshell
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ from baseplate.server.monkey import patch_stdlib_queues
patch_all()
patch_stdlib_queues()

try:
import psycopg2
from psycogreen.gevent import patch_psycopg

patch_psycopg()
except ImportError:
pass


from baseplate.server import load_and_run_shell

print("baseplate-tshell has been renamed to baseplate-shell. Please use that in the future!")
Expand Down
47 changes: 35 additions & 12 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ sentry-sdk = { version = ">=1.35.0,<2.0", optional = true }
sqlalchemy = { version = ">=1.4.49,<2", optional = true }
thrift-unofficial = ">=0.19.0,<1.0"
typing-extensions = "^4.11.0"
psycopg2 = "^2.0.0"
psycogreen = "^1.0.0"
Comment on lines +42 to +43
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.


[tool.poetry.extras]
amqp = ["kombu"]
Expand All @@ -55,6 +57,7 @@ requests = ["advocate"]
s3fetcher = [] # Kept for backwards compatibility, these are now main requirements
sentry = ["sentry-sdk"]
sql = ["sqlalchemy"]
psycopg2 = ["psycopg2", "psycogreen"]
zookeeper = ["kazoo"]

[tool.poetry.group.dev.dependencies]
Expand Down