Skip to main content

aiosupabase

Unofficial Asyncronous Python Client for Supabase

Latest Version: PyPI version

Features

  • Unified Asyncronous and Syncronous Python Client for Supabase
  • Supports Python 3.6+
  • Strongly Typed with Pydantic
  • Utilizes Environment Variables for Configuration

APIs

Both async and sync Apis are available for the following

  • Auth
  • Postgrest
  • Storage
  • Realtime
  • Functions

Installation

# Install from PyPI
pip install aiosupabase

# Install from source
pip install git+https://github.com/trisongz/aiosupabase.git

Usage

Example Usage

import asyncio
from aiosupabase import Supabase
from aiosupabase.utils import logger

"""
Environment Vars that map to Supabase.configure:
all vars are prefixed with SUPABASE_

SUPABASE_URL (url): str   | Supabase URL
SUPABASE_KEY (key): str   | API Key
SUPABASE_DEBUG_ENABLED (debug_enabled): bool - defaults to False

SUPABASE_CLIENT_SCHEMA (client_schema): str - defaults to 'public'
SUPABASE_HEADERS (headers): Dict - defaults to {}
SUPABASE_AUTO_REFRESH_TOKENS (auto_refresh_tokens): bool - defaults to True
SUPABASE_PERSIST_SESSION (persist_session): bool - defaults to True
SUPABASE_REALTIME_CONFIG (realtime_config): Dict - defaults to None
SUPABASE_TIMEOUT (timeout): int - defaults to 5 [DEFAULT_POSTGREST_CLIENT_TIMEOUT]

SUPABASE_COOKIE_OPTIONS (cookie_options): Dict - defaults to None
SUPABASE_REPLACE_DEFAULT_HEADERS (replace_default_headers): bool - defaults to False

"""

Supabase.configure(
    url = '...',
    key = "...",
    debug_enabled = True,
)

async def async_fetch_table(table: str = "profiles", select: str = "*"):
    # Async fetch
    # note that table is `atable` for async
    return await Supabase.atable(table).select(select).execute()

def fetch_table(table: str = "profiles", select: str = "*"):
    # Sync fetch
    return Supabase.table(table).select(select).execute()

async def async_fetch_users():
    # Async `ListUsers`
    # note that most async methods are prefixed with
    # `async_` 
    return await Supabase.auth.async_list_users()

def fetch_users():
    # Sync `ListUsers`
    # note that most async methods are prefixed with
    return Supabase.auth.list_users()

async def run_test():
    # Async fetch
    async_data = await async_fetch_table()
    logger.info(f"async_data: {async_data}")

    async_users = await async_fetch_users()
    logger.info(f"async_users: {async_users}")

    # Sync fetch
    sync_data = fetch_table()
    logger.info(f"sync_data: {sync_data}")

    sync_users = fetch_users()
    logger.info(f"sync_users: {sync_users}")


asyncio.run(run_test())

Metadata

Release files for aiosupabase 0.0.4

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

Source distribution (sdist)

Source distribution for aiosupabase 0.0.4
File Size Uploaded Provenance
aiosupabase-0.0.4.tar.gz 16.5 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 35.4 kB

Release files / aiosupabase-0.0.4.tar.gz

Download URL aiosupabase-0.0.4.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4714b046c99fe1002f01f498951a34b9b5bd4419ad51bd8212489b1dfd238314
BLAKE2b-256 checksum
How to use checksums
f6ccb289c31cc1a186a6048bc2dbce8605af8e916f6e3aeb5219d3147f4488d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / aiosupabase-0.0.4-py3-none-any.whl

Download URL aiosupabase-0.0.4-py3-none-any.whl
Size 18.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d54639c1731cb68f16a1fa24673956c1c19543d509350ca99fbdea6af50dc82
BLAKE2b-256 checksum
How to use checksums
0538cd43c9c2398f9208332ebb3dd3e62689b22aee4085948197a9663d50b5b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for aiosupabase 0.0.4

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.

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