Skip to content

Commit 2c7afab

Browse files
committed
Don't require supabase related envs
1 parent 70e6402 commit 2c7afab

File tree

5 files changed

+19
-122
lines changed

5 files changed

+19
-122
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 99 deletions
This file was deleted.

openweights/client/__init__.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,22 @@ def register_job(cls):
9898
return register_job
9999

100100

101+
_SUPABASE_URL = os.environ.get(
102+
"SUPABASE_URL", "https://cmaguqyuzweixkrqjvnf.supabase.co"
103+
)
104+
_SUPABASE_ANON_KEY = os.environ.get(
105+
"SUPABASE_ANON_KEY",
106+
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNtYWd1cXl1endlaXhrcnFqdm5mIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE2ODA1ODIsImV4cCI6MjA3NzI1NjU4Mn0.SlD0g3sWHsc3_SKEofR6Y6H01oWiEYBlmXYQiw0379s",
107+
)
108+
109+
101110
class OpenWeights:
102111
_INSTANCES = []
103112

104113
def __init__(
105114
self,
106-
supabase_url: Optional[str] = None,
107-
supabase_key: Optional[str] = None,
115+
supabase_url: Optional[str] = _SUPABASE_URL,
116+
supabase_key: Optional[str] = _SUPABASE_ANON_KEY,
108117
auth_token: Optional[str] = None,
109118
organization_id: Optional[str] = None,
110119
use_async: bool = False,
@@ -118,21 +127,11 @@ def __init__(
118127
auth_token: Authentication token (or OPENWEIGHTS_API_KEY env var)
119128
Can be either a session token or a service account JWT token
120129
"""
121-
self.supabase_url = supabase_url or os.environ.get(
122-
"SUPABASE_URL", "https://cmaguqyuzweixkrqjvnf.supabase.co"
123-
)
124-
self.supabase_key = supabase_key or os.environ.get(
125-
"SUPABASE_ANON_KEY",
126-
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNtYWd1cXl1endlaXhrcnFqdm5mIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE2ODA1ODIsImV4cCI6MjA3NzI1NjU4Mn0.SlD0g3sWHsc3_SKEofR6Y6H01oWiEYBlmXYQiw0379s",
127-
)
130+
self.supabase_url = supabase_url
131+
self.supabase_key = supabase_key
128132
self.auth_token = auth_token or os.getenv("OPENWEIGHTS_API_KEY")
129133
self.deploy_kwargs = deploy_kwargs
130134

131-
if not self.supabase_url or not self.supabase_key:
132-
raise ValueError(
133-
"Supabase URL and key must be provided either as arguments or environment variables"
134-
)
135-
136135
if not self.auth_token:
137136
raise ValueError(
138137
"Authentication token must be provided either as argument or OPENWEIGHTS_API_KEY environment variable"

openweights/dashboard/backend/database.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
validate_organization_secrets,
2626
)
2727

28-
from openweights import OpenWeights
28+
from openweights.client import _SUPABASE_ANON_KEY, _SUPABASE_URL, OpenWeights
2929
from supabase import Client, create_client
3030

3131

3232
class Database:
3333
def __init__(self, auth_token: Optional[str] = None):
34-
self.supabase_url = os.getenv("SUPABASE_URL")
35-
self.supabase_anon_key = os.getenv("SUPABASE_ANON_KEY")
34+
self.supabase_url = _SUPABASE_URL
35+
self.supabase_anon_key = _SUPABASE_ANON_KEY
3636
self.auth_token = auth_token
3737
self._current_org_id = None
3838

openweights/dashboard/backend/main.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,8 @@ async def create_organization(
116116
@app.get("/organizations/", response_model=List[Organization])
117117
async def get_organizations(db: Database = Depends(get_db)):
118118
"""Get list of organizations the current user has access to."""
119-
try:
120-
result = db.client.from_("organizations").select("*").execute()
121-
return result.data
122-
except Exception as e:
123-
raise HTTPException(status_code=500, detail=str(e))
119+
result = db.client.from_("organizations").select("*").execute()
120+
return result.data
124121

125122

126123
@app.get("/organizations/{organization_id}", response_model=Organization)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "openweights"
7-
version = "0.7.1"
7+
version = "0.7.3"
88
description = "An openai-like sdk for finetuning and batch inference"
99
readme = "README.md"
1010
requires-python = ">=3.11"

0 commit comments

Comments
 (0)