interloper-api 0.134.0__tar.gz → 0.135.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. {interloper_api-0.134.0 → interloper_api-0.135.0}/PKG-INFO +2 -2
  2. {interloper_api-0.134.0 → interloper_api-0.135.0}/pyproject.toml +2 -2
  3. {interloper_api-0.134.0 → interloper_api-0.135.0}/pyproject.toml.orig +2 -2
  4. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/websocket.py +20 -31
  5. {interloper_api-0.134.0 → interloper_api-0.135.0}/README.md +0 -0
  6. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/__init__.py +0 -0
  7. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/app.py +0 -0
  8. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/authorization.py +0 -0
  9. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/cli.py +0 -0
  10. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/dependencies/__init__.py +0 -0
  11. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/dependencies/auth.py +0 -0
  12. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/dependencies/rbac.py +0 -0
  13. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/dependencies/state.py +0 -0
  14. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/extension.yaml +0 -0
  15. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/login.py +0 -0
  16. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/notifications/__init__.py +0 -0
  17. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/notifications/base.py +0 -0
  18. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/notifications/invitations.py +0 -0
  19. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/notifications/super_admins.py +0 -0
  20. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/__init__.py +0 -0
  21. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/admin.py +0 -0
  22. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/agent.py +0 -0
  23. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/apps.py +0 -0
  24. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/auth.py +0 -0
  25. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/authorization.py +0 -0
  26. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/backfills.py +0 -0
  27. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/catalog.py +0 -0
  28. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/components.py +0 -0
  29. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/executions.py +0 -0
  30. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/extensions.py +0 -0
  31. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/health.py +0 -0
  32. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/oauth.py +0 -0
  33. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/organisations.py +0 -0
  34. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/overview.py +0 -0
  35. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/relations.py +0 -0
  36. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/runs.py +0 -0
  37. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/routes/tokens.py +0 -0
  38. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/server.py +0 -0
  39. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/settings.py +0 -0
  40. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/utils/__init__.py +0 -0
  41. {interloper_api-0.134.0 → interloper_api-0.135.0}/src/interloper_api/utils/time.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: interloper-api
3
- Version: 0.134.0
3
+ Version: 0.135.0
4
4
  Summary: Interloper FastAPI routes
5
5
  Author: Guillaume Onfroy
6
6
  Author-email: Guillaume Onfroy <guillaume@digitlcloud.com>
@@ -11,7 +11,7 @@ Requires-Dist: cryptography>=43.0.0
11
11
  Requires-Dist: fastapi>=0.115.0
12
12
  Requires-Dist: google-auth>=2.0.0
13
13
  Requires-Dist: httpx2>=2.13.1
14
- Requires-Dist: psycopg2-binary>=2.9.0
14
+ Requires-Dist: psycopg[binary]>=3.1
15
15
  Requires-Dist: uvicorn[standard]>=0.41.0
16
16
  Requires-Dist: wsproto>=1.2.0
17
17
  Requires-Dist: itsdangerous>=2.2
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "interloper-api"
3
- version = "0.134.0"
3
+ version = "0.135.0"
4
4
  description = "Interloper FastAPI routes"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -12,7 +12,7 @@ dependencies = [
12
12
  "fastapi>=0.115.0",
13
13
  "google-auth>=2.0.0",
14
14
  "httpx2>=2.13.1",
15
- "psycopg2-binary>=2.9.0",
15
+ "psycopg[binary]>=3.1",
16
16
  "uvicorn[standard]>=0.41.0",
17
17
  "wsproto>=1.2.0",
18
18
  "itsdangerous>=2.2",
@@ -3,7 +3,7 @@
3
3
  # ###############
4
4
  [project]
5
5
  name = "interloper-api"
6
- version = "0.134.0"
6
+ version = "0.135.0"
7
7
  description = "Interloper FastAPI routes"
8
8
  readme = "README.md"
9
9
  authors = [{ name = "Guillaume Onfroy", email = "guillaume@digitlcloud.com" }]
@@ -16,7 +16,7 @@ dependencies = [
16
16
  "fastapi>=0.115.0",
17
17
  "google-auth>=2.0.0",
18
18
  "httpx2>=2.13.1",
19
- "psycopg2-binary>=2.9.0",
19
+ "psycopg[binary]>=3.1",
20
20
  "uvicorn[standard]>=0.41.0",
21
21
  "wsproto>=1.2.0",
22
22
  "itsdangerous>=2.2",
@@ -16,15 +16,13 @@ from __future__ import annotations
16
16
  import asyncio
17
17
  import json
18
18
  import logging
19
- import select as _select
20
19
  import threading
21
20
  import time
22
21
  from collections.abc import AsyncGenerator
23
22
  from contextlib import asynccontextmanager
24
23
  from uuid import UUID
25
24
 
26
- import psycopg2
27
- import psycopg2.extensions
25
+ import psycopg
28
26
  from fastapi import APIRouter, Cookie, FastAPI, HTTPException, WebSocket, WebSocketDisconnect
29
27
  from interloper_db import Store
30
28
  from starlette.concurrency import run_in_threadpool
@@ -101,36 +99,27 @@ def _start_notify_listener(dsn: str, loop: asyncio.AbstractEventLoop) -> None:
101
99
  """Background thread: listens for PostgreSQL NOTIFY and dispatches to WebSocket clients.
102
100
 
103
101
  Args:
104
- dsn: PostgreSQL connection string.
102
+ dsn: libpq connection string of the database to listen on.
105
103
  loop: The asyncio event loop to schedule coroutines on.
106
104
  """
107
105
  while True:
108
106
  try:
109
- connection = psycopg2.connect(dsn)
110
- connection.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
111
-
112
- with connection.cursor() as cursor:
113
- cursor.execute("LISTEN table_changes")
114
-
115
- logger.info("[Realtime] NOTIFY listener started")
116
-
117
- while True:
118
- readable, _, _ = _select.select([connection], [], [], 1.0)
119
- if readable:
120
- connection.poll()
121
- while connection.notifies:
122
- notify = connection.notifies.pop(0)
123
- try:
124
- payload = json.loads(notify.payload)
125
- org_id = str(payload["org_id"])
126
- message = {
127
- "table": payload["table"],
128
- "event": payload["op"],
129
- "record": payload.get("record"),
130
- }
131
- asyncio.run_coroutine_threadsafe(_manager.broadcast(org_id, message), loop)
132
- except (json.JSONDecodeError, KeyError) as e:
133
- logger.warning("[Realtime] Invalid NOTIFY payload: %s", e)
107
+ with psycopg.connect(dsn, autocommit=True) as connection:
108
+ connection.execute("LISTEN table_changes")
109
+ logger.info("[Realtime] NOTIFY listener started")
110
+
111
+ for notify in connection.notifies():
112
+ try:
113
+ payload = json.loads(notify.payload)
114
+ org_id = str(payload["org_id"])
115
+ message = {
116
+ "table": payload["table"],
117
+ "event": payload["op"],
118
+ "record": payload.get("record"),
119
+ }
120
+ asyncio.run_coroutine_threadsafe(_manager.broadcast(org_id, message), loop)
121
+ except (json.JSONDecodeError, KeyError) as e:
122
+ logger.warning("[Realtime] Invalid NOTIFY payload: %s", e)
134
123
  except Exception as e: # noqa: BLE001
135
124
  # This thread is the only realtime path; letting anything escape
136
125
  # would end it for the life of the process, so every failure is
@@ -154,8 +143,8 @@ async def realtime_lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
154
143
  from interloper_db import get_engine
155
144
 
156
145
  engine = get_engine()
157
- # str(engine.url) masks the password as '***' — psycopg2 needs the real one.
158
- dsn = engine.url.render_as_string(hide_password=False)
146
+ # libpq refuses SQLAlchemy's driver name, and str(engine.url) would mask the password as '***'.
147
+ dsn = engine.url.set(drivername="postgresql").render_as_string(hide_password=False)
159
148
 
160
149
  loop = asyncio.get_running_loop()
161
150
  thread = threading.Thread(