Skip to content

Commit

Permalink
Add psycopg2 extra, patch psycogreen in entry points. (#915)
Browse files Browse the repository at this point in the history
  • Loading branch information
salomon-smekecohen authored May 20, 2024
1 parent 10ce9fa commit 9ea10ec
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 12 deletions.
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"

[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

0 comments on commit 9ea10ec

Please sign in to comment.