supabase


Namesupabase JSON
Version 2.23.1 PyPI version JSON
download
home_pageNone
SummarySupabase client for Python.
upload_time2025-11-03 14:30:12
maintainerLeonardo Santiago
docs_urlNone
authorJoel Lee, Leon Fedden, Daniel Reinón García, Leynier Gutiérrez González, Anand, Andrew Smith
requires_python>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # `supabase-py`

Python client for [Supabase](https://supabase.com)

- Documentation: [supabase.com/docs](https://supabase.com/docs/reference/python/introduction)
- Usage:
  - [GitHub OAuth in your Python Flask app](https://supabase.com/blog/oauth2-login-python-flask-apps)
  - [Python data loading with Supabase](https://supabase.com/blog/loading-data-supabase-python)

### PyPI installation

Install the package (for Python >= 3.9):

```bash
# with pip
pip install supabase

# with uv
uv add supabase

# with conda
conda install -c conda-forge supabase
```

## Usage

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

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

Init client:

```python
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

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

### Sign-in

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

### Insert Data

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

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

### Select Data

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

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

### Update Data

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

### Update data with duplicate keys

```python
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

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

### Call Edge Functions

```python
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

```python
bucket_name: str = "photos"

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

### Upload a file

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

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

### Remove a file

```python
bucket_name: str = "photos"

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

### List all files

```python
bucket_name: str = "charts"

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

### Move and rename files

```python
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:

```python
client.auth.sign_out()
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "supabase",
    "maintainer": "Leonardo Santiago",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Leonardo Santiago <leonardo.santiago@supabase.io>",
    "keywords": null,
    "author": "Joel Lee, Leon Fedden, Daniel Rein\u00f3n Garc\u00eda, Leynier Guti\u00e9rrez Gonz\u00e1lez, Anand, Andrew Smith",
    "author_email": "Joel Lee <joel@joellee.org>, Leon Fedden <leonfedden@gmail.com>, Daniel Rein\u00f3n Garc\u00eda <danielreinon@outlook.com>, Leynier Guti\u00e9rrez Gonz\u00e1lez <leynier41@gmail.com>, Andrew Smith <a.smith@silentworks.co.uk>",
    "download_url": "https://files.pythonhosted.org/packages/43/25/5398f30d54d12a21a085c62943ba34cffffab6d9ae4bcc37d31fe8571127/supabase-2.23.1.tar.gz",
    "platform": null,
    "description": "# `supabase-py`\n\nPython client for [Supabase](https://supabase.com)\n\n- Documentation: [supabase.com/docs](https://supabase.com/docs/reference/python/introduction)\n- Usage:\n  - [GitHub OAuth in your Python Flask app](https://supabase.com/blog/oauth2-login-python-flask-apps)\n  - [Python data loading with Supabase](https://supabase.com/blog/loading-data-supabase-python)\n\n### PyPI installation\n\nInstall the package (for Python >= 3.9):\n\n```bash\n# with pip\npip install supabase\n\n# with uv\nuv add supabase\n\n# with conda\nconda install -c conda-forge supabase\n```\n\n## Usage\n\nSet your Supabase environment variables in a dotenv file, or using the shell:\n\n```bash\nexport SUPABASE_URL=\"my-url-to-my-awesome-supabase-instance\"\nexport SUPABASE_KEY=\"my-supa-dupa-secret-supabase-api-key\"\n```\n\nInit client:\n\n```python\nimport os\nfrom supabase import create_client, Client\n\nurl: str = os.environ.get(\"SUPABASE_URL\")\nkey: str = os.environ.get(\"SUPABASE_KEY\")\nsupabase: Client = create_client(url, key)\n```\n\nUse the supabase client to interface with your database.\n\n### Sign-up\n\n```python\nuser = supabase.auth.sign_up({ \"email\": users_email, \"password\": users_password })\n```\n\n### Sign-in\n\n```python\nuser = supabase.auth.sign_in_with_password({ \"email\": users_email, \"password\": users_password })\n```\n\n### Insert Data\n\n```python\ndata = supabase.table(\"countries\").insert({\"name\":\"Germany\"}).execute()\n\n# Assert we pulled real data.\nassert len(data.data) > 0\n```\n\n### Select Data\n\n```python\ndata = supabase.table(\"countries\").select(\"*\").eq(\"country\", \"IL\").execute()\n\n# Assert we pulled real data.\nassert len(data.data) > 0\n```\n\n### Update Data\n\n```python\ndata = supabase.table(\"countries\").update({\"country\": \"Indonesia\", \"capital_city\": \"Jakarta\"}).eq(\"id\", 1).execute()\n```\n\n### Update data with duplicate keys\n\n```python\ncountry = {\n  \"country\": \"United Kingdom\",\n  \"capital_city\": \"London\" # This was missing when it was added\n}\n\ndata = supabase.table(\"countries\").upsert(country).execute()\nassert len(data.data) > 0\n```\n\n### Delete Data\n\n```python\ndata = supabase.table(\"countries\").delete().eq(\"id\", 1).execute()\n```\n\n### Call Edge Functions\n\n```python\ndef test_func():\n  try:\n    resp = supabase.functions.invoke(\"hello-world\", invoke_options={'body':{}})\n    return resp\n  except (FunctionsRelayError, FunctionsHttpError) as exception:\n    err = exception.to_dict()\n    print(err.get(\"message\"))\n```\n\n### Download a file from Storage\n\n```python\nbucket_name: str = \"photos\"\n\ndata = supabase.storage.from_(bucket_name).download(\"photo1.png\")\n```\n\n### Upload a file\n\n```python\nbucket_name: str = \"photos\"\nnew_file = getUserFile()\n\ndata = supabase.storage.from_(bucket_name).upload(\"/user1/profile.png\", new_file)\n```\n\n### Remove a file\n\n```python\nbucket_name: str = \"photos\"\n\ndata = supabase.storage.from_(bucket_name).remove([\"old_photo.png\", \"image5.jpg\"])\n```\n\n### List all files\n\n```python\nbucket_name: str = \"charts\"\n\ndata = supabase.storage.from_(bucket_name).list()\n```\n\n### Move and rename files\n\n```python\nbucket_name: str = \"charts\"\nold_file_path: str = \"generic/graph1.png\"\nnew_file_path: str = \"important/revenue.png\"\n\ndata = supabase.storage.from_(bucket_name).move(old_file_path, new_file_path)\n```\n\n## Important: Proper Client Shutdown\n\nTo ensure the Supabase client terminates correctly and to prevent resource leaks, you **must** explicitly call:\n\n```python\nclient.auth.sign_out()\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Supabase client for Python.",
    "version": "2.23.1",
    "project_urls": {
        "changelog": "https://github.com/supabase/supabase-py/tree/main/CHANGELOG.md",
        "documentation": "https://github.com/supabase/supabase-py/src/supabase",
        "homepage": "https://github.com/supabase/supabase-py",
        "repository": "https://github.com/supabase/supabase-py"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5af7c74c0cbe87e79d2ffd397be57fa21b741637c6a4f4682e28accc9c9aeeef",
                "md5": "54b80fc44ae912b1b5dfde47d06ae373",
                "sha256": "3e868a0719a072bfb60b4f6e70a0a64b05dc1a5e0131d845dd765c3ee2b1a9f1"
            },
            "downloads": -1,
            "filename": "supabase-2.23.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "54b80fc44ae912b1b5dfde47d06ae373",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 16370,
            "upload_time": "2025-11-03T14:30:10",
            "upload_time_iso_8601": "2025-11-03T14:30:10.273088Z",
            "url": "https://files.pythonhosted.org/packages/5a/f7/c74c0cbe87e79d2ffd397be57fa21b741637c6a4f4682e28accc9c9aeeef/supabase-2.23.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "43255398f30d54d12a21a085c62943ba34cffffab6d9ae4bcc37d31fe8571127",
                "md5": "4183c67eabef08f8526da4a86ce124b9",
                "sha256": "0d48ec9c1ae1d9bbb51d2bf1c6510bf954a6e45faf13222147e6bf003135acfd"
            },
            "downloads": -1,
            "filename": "supabase-2.23.1.tar.gz",
            "has_sig": false,
            "md5_digest": "4183c67eabef08f8526da4a86ce124b9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 9352,
            "upload_time": "2025-11-03T14:30:12",
            "upload_time_iso_8601": "2025-11-03T14:30:12.081150Z",
            "url": "https://files.pythonhosted.org/packages/43/25/5398f30d54d12a21a085c62943ba34cffffab6d9ae4bcc37d31fe8571127/supabase-2.23.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-11-03 14:30:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "supabase",
    "github_project": "supabase-py",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "supabase"
}
        
Elapsed time: 2.16663s