Skip to main content

supabase-py

Python client for Supabase

PyPI installation

Install the package (for Python >= 3.11):

# with pip
pip install supabase

# with uv
uv add supabase

# with conda
conda install -c conda-forge supabase

Supabase Service Compatibility

supabase only guarantees compatibility with the latest release of each Supabase service, unless a minimum supported version is explicitly listed below.

Older service releases are supported on a best-effort basis, but compatibility is not guaranteed.

If you self-host Supabase, we recommend upgrading your services to their latest releases when upgrading the SDK.

Service SDK package Server releases Lowest supported version
Auth supabase_auth supabase/auth Latest release
Storage storage3 supabase/storage Latest release
Functions supabase_functions supabase/edge-runtime Latest release
PostgREST postgrest PostgREST/postgrest Latest release
Realtime realtime supabase/realtime Latest release

Usage

Set your Supabase environment variables in a dotenv file, or using the shell:

export SUPABASE_URL="my-url-to-my-awesome-supabase-instance"
export SUPABASE_KEY="my-supa-dupa-secret-supabase-api-key"

Init client:

import os
from supabase import create_client, Client

url: str = os.environ.get("SUPABASE_URL")
key: str = os.environ.get("SUPABASE_KEY")
supabase: Client = create_client(url, key)

Use the supabase client to interface with your database.

Sign-up

user = supabase.auth.sign_up({ "email": users_email, "password": users_password })

Sign-in

user = supabase.auth.sign_in_with_password({ "email": users_email, "password": users_password })

Insert Data

data = supabase.table("countries").insert({"name":"Germany"}).execute()

# Assert we pulled real data.
assert len(data.data) > 0

Select Data

data = supabase.table("countries").select("*").eq("country", "IL").execute()

# Assert we pulled real data.
assert len(data.data) > 0

Update Data

data = supabase.table("countries").update({"country": "Indonesia", "capital_city": "Jakarta"}).eq("id", 1).execute()

Update data with duplicate keys

country = {
  "country": "United Kingdom",
  "capital_city": "London" # This was missing when it was added
}

data = supabase.table("countries").upsert(country).execute()
assert len(data.data) > 0

Delete Data

data = supabase.table("countries").delete().eq("id", 1).execute()

Call Edge Functions

def test_func():
  try:
    resp = supabase.functions.invoke("hello-world", invoke_options={'body':{}})
    return resp
  except (FunctionsRelayError, FunctionsHttpError) as exception:
    err = exception.to_dict()
    print(err.get("message"))

Download a file from Storage

bucket_name: str = "photos"

data = supabase.storage.from_(bucket_name).download("photo1.png")

Upload a file

bucket_name: str = "photos"
new_file = getUserFile()

data = supabase.storage.from_(bucket_name).upload("/user1/profile.png", new_file)

Remove a file

bucket_name: str = "photos"

data = supabase.storage.from_(bucket_name).remove(["old_photo.png", "image5.jpg"])

List all files

bucket_name: str = "charts"

data = supabase.storage.from_(bucket_name).list()

Move and rename files

bucket_name: str = "charts"
old_file_path: str = "generic/graph1.png"
new_file_path: str = "important/revenue.png"

data = supabase.storage.from_(bucket_name).move(old_file_path, new_file_path)

Important: Proper Client Shutdown

To ensure the Supabase client terminates correctly and to prevent resource leaks, you must explicitly call:

client.auth.sign_out()

Metadata

Release files for supabase 2.34.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for supabase 2.34.1
File Size Uploaded Provenance Actions
supabase-2.34.1.tar.gz 10.1 kB Without provenance Details for supabase-2.34.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for supabase 2.34.1
File Interpreter ABI Platform Actions
supabase-2.34.1-py3-none-any.whl Python 3 none any Details for supabase-2.34.1-py3-none-any.whl

Total release size: 27.2 kB

Release files / supabase-2.34.1.tar.gz

Download URL supabase-2.34.1.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
122cb31eb917e7a61817e4b51a754c7a858eecc882d44af4f1c3b26f1ebd0a5c
BLAKE2b-256 checksum
How to use checksums
7dc5958cd70894e414eb00da45d2c202c3e66c62eb00905c08fa458f6c7dc7fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.3 {"installer":{"name":"uv","version":"0.13.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / supabase-2.34.1-py3-none-any.whl

Download URL supabase-2.34.1-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf06e59d0b37fbbdbc4d4d1f6b60844c517b744aa9bc34432deae06f59a6cc1d
BLAKE2b-256 checksum
How to use checksums
cc50cc59d5a7e0278a137e957a959627f5f9d988a45c4867b1162665eab7bb0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.3 {"installer":{"name":"uv","version":"0.13.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for supabase 2.34.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.34.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page