diff --git a/docs/_config.yml b/docs/_config.yml index 3dd41fa..62e3808 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -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 diff --git a/scripts/load_pe_targets.py b/scripts/load_pe_targets.py index 1eca42d..6a1ad04 100644 --- a/scripts/load_pe_targets.py +++ b/scripts/load_pe_targets.py @@ -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" @@ -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 " diff --git a/scripts/run_supabase_calibration.py b/scripts/run_supabase_calibration.py index e757303..47e6085 100644 --- a/scripts/run_supabase_calibration.py +++ b/scripts/run_supabase_calibration.py @@ -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 " diff --git a/tests/test_supabase_client.py b/tests/test_supabase_client.py index b7af10e..6d007b3 100644 --- a/tests/test_supabase_client.py +++ b/tests/test_supabase_client.py @@ -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")