Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sphinx:
config:
html_theme: sphinx_book_theme
html_theme_options:
repository_url: https://github.com/PolicyEngine/micro
repository_url: https://github.com/PolicyEngine/microplex
use_repository_button: true
use_issues_button: true
autodoc_member_order: bysource
Expand Down
11 changes: 9 additions & 2 deletions scripts/load_pe_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
from typing import List, Dict, Any, Tuple
from dataclasses import dataclass, field

# Supabase connection
SUPABASE_URL = "https://nsupqhfchdtqclomlrgs.supabase.co"
# Supabase connection.
SUPABASE_URL = os.environ.get("POLICYENGINE_SUPABASE_URL") or os.environ.get(
"SUPABASE_URL"
)
SUPABASE_KEY = os.environ.get("POLICYENGINE_SUPABASE_SERVICE_KEY")

PE_BASE = "https://raw.githubusercontent.com/PolicyEngine/policyengine-us-data/main/policyengine_us_data/storage/calibration_targets"
Expand All @@ -38,6 +40,11 @@ class BatchSupabaseClient:
"""Supabase client optimized for batch operations."""

def __init__(self, url: str, key: str, schema: str = "microplex"):
if not url:
raise ValueError(
"POLICYENGINE_SUPABASE_URL must be set before loading "
"PolicyEngine calibration targets."
)
if not key:
raise ValueError(
"POLICYENGINE_SUPABASE_SERVICE_KEY must be set before loading "
Expand Down
10 changes: 7 additions & 3 deletions scripts/run_supabase_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,15 @@ class SupabaseCalibrationLoader:
}

def __init__(self):
self.url = os.environ.get(
"SUPABASE_URL",
"https://nsupqhfchdtqclomlrgs.supabase.co"
self.url = os.environ.get("POLICYENGINE_SUPABASE_URL") or os.environ.get(
"SUPABASE_URL"
)
self.key = os.environ.get("POLICYENGINE_SUPABASE_SERVICE_KEY")
if not self.url:
raise ValueError(
"POLICYENGINE_SUPABASE_URL must be set before running "
"Supabase calibration."
)
if not self.key:
raise ValueError(
"POLICYENGINE_SUPABASE_SERVICE_KEY must be set before running "
Expand Down
4 changes: 3 additions & 1 deletion tests/test_supabase_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ class TestBatchIntegration:
@pytest.fixture
def live_client(self):
"""Create a client connected to real Supabase."""
url = os.environ.get("SUPABASE_URL")
url = os.environ.get("POLICYENGINE_SUPABASE_URL") or os.environ.get(
"SUPABASE_URL"
)
key = os.environ.get("POLICYENGINE_SUPABASE_SERVICE_KEY")
if not url or not key:
pytest.skip("No Supabase credentials - skipping integration test")
Expand Down
Loading