Supabase Functions Python Client (Deprecated)
supafunc is a Python client library for interacting with Supabase Edge Functions. It provides synchronous and asynchronous APIs to invoke serverless functions deployed on Supabase. As of August 8, 2025, this package is officially deprecated in favor of `supabase_functions` to align with the JavaScript client library naming convention. Version 0.10.2 is the last version that received updates under this name and includes deprecation warnings upon import.
Warnings
- breaking The `supafunc` package is officially deprecated as of August 8, 2025, in favor of `supabase_functions`. Version `0.10.2` is the last to receive updates and will issue deprecation warnings upon import. Future development and bug fixes will only be applied to `supabase_functions`.
- breaking The minimum required Python version was bumped to 3.9 in `v0.6.2`. Users on older Python versions will encounter compatibility issues.
- breaking In `v0.9.0`, region enumerated literals were rewritten as Python Enums. If your code relied on specific string values or direct comparisons with previous literal representations, this could be a breaking change.
- gotcha Prior to `v0.10.1`, strict JWT key validation might have caused issues with newer Supabase API keys. This was resolved by relaxing the validation.
- gotcha Versions prior to `v0.9.3` improperly handled non-JSON body types when invoking functions, potentially leading to incorrect data transmission or errors.
Install
-
pip install supafunc -
pip install supabase_functions
Imports
- AsyncFunctionsClient
from supabase_functions import AsyncFunctionsClient
- FunctionsClient
from supabase_functions import FunctionsClient
Quickstart
import os
from supabase import create_client
# Note: This quickstart uses the recommended 'supabase_functions' client
# Ensure your Supabase project URL and Anon Key are set as environment variables
SUPABASE_URL = os.environ.get('SUPABASE_URL', 'YOUR_SUPABASE_URL')
SUPABASE_ANON_KEY = os.environ.get('SUPABASE_ANON_KEY', 'YOUR_SUPABASE_ANON_KEY')
# Initialize the Supabase client, which includes the functions client
supabase = create_client(SUPABASE_URL, SUPABASE_ANON_KEY)
functions_client = supabase.functions
async def invoke_hello_world():
try:
# Assuming you have an Edge Function named 'hello-world' deployed
# that expects a JSON body like {'name': 'World'}
response = await functions_client.invoke(
'hello-world',
invoke_options={'body': {'name': 'Supabase User'}}
)
print(f"Function invoked successfully: {response.data}")
except Exception as e:
print(f"Error invoking function: {e}")
if __name__ == '__main__':
import asyncio
asyncio.run(invoke_hello_world())