Skip to content
Open
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
6 changes: 3 additions & 3 deletions flake.lock

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

19 changes: 10 additions & 9 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
pkgs.uv
pkgs.gnumake
pkgs.docker
pkgs.postgresql_15
];
workspace = uv2nix.lib.workspace.loadWorkspace { workspaceRoot = ./.; };

Expand All @@ -47,11 +48,14 @@

pyproject-overlay = pkgs: final: prev: {
ruamel-yaml-clib = prev.ruamel-yaml-clib.overrideAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs ++ [
(final.resolveBuildSystem {
nativeBuildInputs = old.nativeBuildInputs ++ (final.resolveBuildSystem {
setuptools = [];
})
];
});
});
urwid-readline = prev.urwid-readline.overrideAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs ++ (final.resolveBuildSystem {
setuptools = [];
});
});
pyiceberg = prev.pyiceberg.overrideAttrs (old: {
buildInputs = (old.buildInputs or []) ++ [ final.poetry-core ];
Expand All @@ -61,12 +65,9 @@
sed -i '1i from Cython.Build import cythonize' setup.py
sed -i 's/ext_modules=[pyroaring_module]/ext_modules=[cythonize(pyroaring_module)]/' setup.py
'';
nativeBuildInputs = old.nativeBuildInputs ++ [
(final.resolveBuildSystem {
nativeBuildInputs = old.nativeBuildInputs ++ [final.cython] ++ (final.resolveBuildSystem {
setuptools = [];
})
final.cython
];
});
});
};

Expand Down
29 changes: 29 additions & 0 deletions src/realtime/infra/supabase/migrations/20240810125543_init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ CREATE POLICY "Allow authenticated access" ON "public"."todos" AS permissive
USING (TRUE)
WITH CHECK (TRUE);

CREATE POLICY "authenticated can receive broadcast" ON "realtime"."messages"
FOR ALL
TO AUTHENTICATED
USING (TRUE);

ALTER publication supabase_realtime
ADD TABLE todos;

Expand All @@ -26,3 +31,27 @@ create table messages (

-- enable realtime on messages table
alter publication supabase_realtime add table messages;

-- Grant API access to tables for anon and authenticated roles.
-- Required since Supabase no longer grants public schema access by default
-- (see https://github.com/orgs/supabase/discussions/45329).
GRANT ALL ON TABLE public.todos TO anon, authenticated;
GRANT ALL ON TABLE public.messages TO anon, authenticated;

-- Grant sequence usage for tables with generated identity primary keys
GRANT USAGE, SELECT ON SEQUENCE public.messages_id_seq TO anon, authenticated;

CREATE OR replace FUNCTION public.send_realtime(
topic text,
event text,
payload jsonb,
private boolean default True
)
RETURNS void
LANGUAGE SQL
SECURITY DEFINER
AS $$
SELECT realtime.send(payload, event, topic, private);
$$;

GRANT EXECUTE ON FUNCTION public.send_realtime(text,text,jsonb,boolean) TO anon, authenticated, service_role;
10 changes: 6 additions & 4 deletions src/realtime/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ maintainers = [
license = "MIT"
readme = "README.md"
repository = "https://github.com/supabase/supabase-py"
requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
"websockets >=11,<16",
"typing-extensions >=4.14.0",
"pydantic (>=2.11.7,<3.0.0)",
"pytest-asyncio>=0.21.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this be added to dev dependencies instead?

"yarl>=1.22.0",
]

[project.urls]
Expand All @@ -32,6 +34,7 @@ tests = [
"pytest-cov >= 6.2.1",
"python-dotenv >= 1.1.1",
"pytest-asyncio >= 1.0.0",
"pudb>=2025.1.5",
]
lints = [
"ruff >= 0.12.1",
Expand Down Expand Up @@ -68,11 +71,10 @@ ignore = ["F401", "F403", "F841", "E712", "E501", "E402", "UP006", "UP035"]
keep-runtime-typing = true

[tool.pytest.ini_options]
asyncio_mode = "strict"
asyncio_default_fixture_loop_scope = "function"
asyncio_mode = "auto"

[tool.mypy]
python_version = "3.9"
python_version = "3.10"
check_untyped_defs = true
allow_redefinition = true

Expand Down
10 changes: 3 additions & 7 deletions src/realtime/src/realtime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@

from realtime.version import __version__

from ._async.channel import AsyncRealtimeChannel
from ._async.client import AsyncRealtimeClient
from ._async.presence import AsyncRealtimePresence
from ._sync.channel import SyncRealtimeChannel
from ._sync.client import SyncRealtimeClient
from ._sync.presence import SyncRealtimePresence
from .channel import RealtimeChannel
from .client import RealtimeClient
from .exceptions import *
from .message import *
from .transformers import *
from .presence import RealtimePresence
from .types import *
Empty file.
Loading
Loading