Skip to content
Open
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
1 change: 1 addition & 0 deletions src/auth/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ classifiers = [
requires-python = ">=3.9"
dependencies = [
"httpx[http2] >=0.26,<0.29",
"httpx2>=2.12.0; python_version >= \"3.10\"",
"pydantic >=1.10,<3",
"pyjwt[crypto] >=2.12.0",
]
Expand Down
5 changes: 4 additions & 1 deletion src/auth/src/supabase_auth/_async/gotrue_admin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

from typing import Dict, List, Optional

from httpx import AsyncClient, QueryParams
try:
from httpx2 import AsyncClient, QueryParams
except ImportError:
from httpx import AsyncClient, QueryParams

from ..helpers import (
model_validate,
Expand Down
5 changes: 4 additions & 1 deletion src/auth/src/supabase_auth/_async/gotrue_base_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

from typing import Any, Dict, Optional

from httpx import AsyncClient, HTTPStatusError, QueryParams, Response
try:
from httpx2 import AsyncClient, HTTPStatusError, QueryParams, Response
except ImportError:
from httpx import AsyncClient, HTTPStatusError, QueryParams, Response
from pydantic import BaseModel
from typing_extensions import Literal, Self

Expand Down
5 changes: 4 additions & 1 deletion src/auth/src/supabase_auth/_async/gotrue_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
from uuid import uuid4
from warnings import warn

from httpx import AsyncClient, QueryParams, Response
try:
from httpx2 import AsyncClient, QueryParams, Response
except ImportError:
from httpx import AsyncClient, QueryParams, Response
from jwt import get_algorithm_by_name
from typing_extensions import cast

Expand Down
5 changes: 4 additions & 1 deletion src/auth/src/supabase_auth/_sync/gotrue_admin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

from typing import Dict, List, Optional

from httpx import Client, QueryParams
try:
from httpx2 import Client, QueryParams
except ImportError:
from httpx import Client, QueryParams

from ..helpers import (
model_validate,
Expand Down
5 changes: 4 additions & 1 deletion src/auth/src/supabase_auth/_sync/gotrue_base_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

from typing import Any, Dict, Optional

from httpx import Client, HTTPStatusError, QueryParams, Response
try:
from httpx2 import Client, HTTPStatusError, QueryParams, Response
except ImportError:
from httpx import Client, HTTPStatusError, QueryParams, Response
from pydantic import BaseModel
from typing_extensions import Literal, Self

Expand Down
5 changes: 4 additions & 1 deletion src/auth/src/supabase_auth/_sync/gotrue_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
from uuid import uuid4
from warnings import warn

from httpx import Client, QueryParams, Response
try:
from httpx2 import Client, QueryParams, Response
except ImportError:
from httpx import Client, QueryParams, Response
from jwt import get_algorithm_by_name
from typing_extensions import cast

Expand Down
5 changes: 4 additions & 1 deletion src/auth/src/supabase_auth/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
from typing import Any, Dict, Optional, Type, TypedDict, TypeVar, Union
from urllib.parse import urlparse

from httpx import HTTPStatusError, Response
try:
from httpx2 import HTTPStatusError, Response
except ImportError:
from httpx import HTTPStatusError, Response
from pydantic import BaseModel, TypeAdapter, ValidationError

from .constants import (
Expand Down
10 changes: 8 additions & 2 deletions src/auth/tests/_async/test_gotrue.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,10 @@ async def test_link_identity() -> None:

from unittest.mock import patch

from httpx import Response
try:
from httpx2 import Response
except ImportError:
from httpx import Response

# Since the test server has manual linking disabled, we'll mock the URL generation
with patch.object(client, "_get_url_for_provider") as mock_url_provider:
Expand Down Expand Up @@ -495,7 +498,10 @@ async def test_sign_in_with_otp() -> None:
# We can't fully test the actual OTP flow since that requires email verification
from unittest.mock import patch

from httpx import Response
try:
from httpx2 import Response
except ImportError:
from httpx import Response
from supabase_auth.types import AuthOtpResponse

# First test for email OTP
Expand Down
10 changes: 8 additions & 2 deletions src/auth/tests/_sync/test_gotrue.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,10 @@ def test_link_identity() -> None:

from unittest.mock import patch

from httpx import Response
try:
from httpx2 import Response
except ImportError:
from httpx import Response

# Since the test server has manual linking disabled, we'll mock the URL generation
with patch.object(client, "_get_url_for_provider") as mock_url_provider:
Expand Down Expand Up @@ -493,7 +496,10 @@ def test_sign_in_with_otp() -> None:
# We can't fully test the actual OTP flow since that requires email verification
from unittest.mock import patch

from httpx import Response
try:
from httpx2 import Response
except ImportError:
from httpx import Response
from supabase_auth.types import AuthOtpResponse

# First test for email OTP
Expand Down
15 changes: 12 additions & 3 deletions src/auth/tests/test_helpers.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
from datetime import datetime
from unittest.mock import MagicMock, patch

import httpx
try:
import httpx2 as httpx
except ImportError:
import httpx
import pytest
import respx
from httpx import Headers, HTTPStatusError, Response
try:
from httpx2 import Headers, HTTPStatusError, Response
except ImportError:
from httpx import Headers, HTTPStatusError, Response
from pydantic import BaseModel
from supabase_auth.constants import (
API_VERSION_HEADER_NAME,
Expand Down Expand Up @@ -337,7 +343,10 @@ def test_handle_exception_weak_password_branch() -> None:
This test attempts to test the branch where weak_password needs to be both a dict and a list,
which is logically impossible, so we'll test it by mocking the implementation details.
"""
import httpx
try:
import httpx2 as httpx
except ImportError:
import httpx
from supabase_auth.errors import AuthWeakPasswordError
from supabase_auth.helpers import handle_exception

Expand Down
1 change: 1 addition & 0 deletions src/functions/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ readme = "README.md"
requires-python = ">=3.9"
dependencies = [
"httpx[http2] >=0.26,<0.29",
"httpx2>=2.12.0; python_version >= \"3.10\"",
"strenum >=0.4.15",
"yarl>=1.20.1",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
from typing import Any, Dict, Literal, Optional, Union
from warnings import warn

from httpx import AsyncClient, HTTPError, QueryParams, Response
try:
from httpx2 import AsyncClient, HTTPError, QueryParams, Response
except ImportError:
from httpx import AsyncClient, HTTPError, QueryParams, Response
from yarl import URL

from ..errors import FunctionsHttpError, FunctionsRelayError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
from typing import Any, Dict, Literal, Optional, Union
from warnings import warn

from httpx import Client, HTTPError, QueryParams, Response
try:
from httpx2 import Client, HTTPError, QueryParams, Response
except ImportError:
from httpx import Client, HTTPError, QueryParams, Response
from yarl import URL

from ..errors import FunctionsHttpError, FunctionsRelayError
Expand Down
5 changes: 4 additions & 1 deletion src/functions/src/supabase_functions/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys
from urllib.parse import urlparse

from httpx import AsyncClient as AsyncClient # noqa: F401
try:
from httpx2 import AsyncClient as AsyncClient # noqa: F401
except ImportError:
from httpx import AsyncClient as AsyncClient # noqa: F401

if sys.version_info >= (3, 11):
from enum import StrEnum
Expand Down
5 changes: 4 additions & 1 deletion src/functions/tests/_async/test_function_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
from unittest.mock import AsyncMock, Mock, patch

import pytest
from httpx import AsyncClient, HTTPError, Response, Timeout
try:
from httpx2 import AsyncClient, HTTPError, Response, Timeout
except ImportError:
from httpx import AsyncClient, HTTPError, Response, Timeout

# Import the class to test
from supabase_functions import AsyncFunctionsClient
Expand Down
5 changes: 4 additions & 1 deletion src/functions/tests/_sync/test_function_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
from unittest.mock import Mock, patch

import pytest
from httpx import Client, HTTPError, Response, Timeout
try:
from httpx2 import Client, HTTPError, Response, Timeout
except ImportError:
from httpx import Client, HTTPError, Response, Timeout

# Import the class to test
from supabase_functions import SyncFunctionsClient
Expand Down
1 change: 1 addition & 0 deletions src/postgrest/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ classifiers = [
requires-python = ">=3.9"
dependencies = [
"httpx[http2] >=0.26,<0.29",
"httpx2>=2.12.0; python_version >= \"3.10\"",
"deprecation >=2.1.0",
"pydantic >=1.9,<3.0",
"strenum >=0.4.9; python_version < \"3.11\"",
Expand Down
5 changes: 4 additions & 1 deletion src/postgrest/src/postgrest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from __future__ import annotations

from httpx import Timeout
try:
from httpx2 import Timeout
except ImportError:
from httpx import Timeout

from ._async.client import AsyncPostgrestClient
from ._async.request_builder import (
Expand Down
5 changes: 4 additions & 1 deletion src/postgrest/src/postgrest/_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
from warnings import warn

from deprecation import deprecated
from httpx import AsyncClient, Headers, QueryParams, Timeout
try:
from httpx2 import AsyncClient, Headers, QueryParams, Timeout
except ImportError:
from httpx import AsyncClient, Headers, QueryParams, Timeout
from yarl import URL

from ..base_client import BasePostgrestClient
Expand Down
5 changes: 4 additions & 1 deletion src/postgrest/src/postgrest/_async/request_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import asyncio
from typing import Any, Generic, Literal, Optional, TypeVar, Union, overload

from httpx import AsyncClient, BasicAuth, Headers, QueryParams, Response
try:
from httpx2 import AsyncClient, BasicAuth, Headers, QueryParams, Response
except ImportError:
from httpx import AsyncClient, BasicAuth, Headers, QueryParams, Response
from pydantic import ValidationError
from typing_extensions import Self, override
from yarl import URL
Expand Down
5 changes: 4 additions & 1 deletion src/postgrest/src/postgrest/_sync/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
from warnings import warn

from deprecation import deprecated
from httpx import Client, Headers, QueryParams, Timeout
try:
from httpx2 import Client, Headers, QueryParams, Timeout
except ImportError:
from httpx import Client, Headers, QueryParams, Timeout
from yarl import URL

from ..base_client import BasePostgrestClient
Expand Down
5 changes: 4 additions & 1 deletion src/postgrest/src/postgrest/_sync/request_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import time
from typing import Any, Generic, Literal, Optional, TypeVar, Union, overload

from httpx import BasicAuth, Client, Headers, QueryParams, Response
try:
from httpx2 import BasicAuth, Client, Headers, QueryParams, Response
except ImportError:
from httpx import BasicAuth, Client, Headers, QueryParams, Response
from pydantic import ValidationError
from typing_extensions import Self, override
from yarl import URL
Expand Down
5 changes: 4 additions & 1 deletion src/postgrest/src/postgrest/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
from abc import ABC, abstractmethod
from typing import Dict, Optional, Union

from httpx import AsyncClient, BasicAuth, Client, Headers, Timeout
try:
from httpx2 import AsyncClient, BasicAuth, Client, Headers, Timeout
except ImportError:
from httpx import AsyncClient, BasicAuth, Client, Headers, Timeout
from yarl import URL

from .utils import is_http_url
Expand Down
10 changes: 8 additions & 2 deletions src/postgrest/src/postgrest/base_request_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@
overload,
)

from httpx import AsyncClient, BasicAuth, Client, Headers, QueryParams
from httpx import Response as RequestResponse
try:
from httpx2 import AsyncClient, BasicAuth, Client, Headers, QueryParams
except ImportError:
from httpx import AsyncClient, BasicAuth, Client, Headers, QueryParams
try:
from httpx2 import Response as RequestResponse
except ImportError:
from httpx import Response as RequestResponse
from pydantic import BaseModel, ValidationError
from yarl import URL

Expand Down
5 changes: 4 additions & 1 deletion src/postgrest/src/postgrest/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
from collections.abc import Mapping, Sequence
from typing import Union

from httpx import AsyncClient, BasicAuth, Client, Headers, QueryParams
try:
from httpx2 import AsyncClient, BasicAuth, Client, Headers, QueryParams
except ImportError:
from httpx import AsyncClient, BasicAuth, Client, Headers, QueryParams
from pydantic import TypeAdapter
from typing_extensions import TypeAliasType
from yarl import URL
Expand Down
10 changes: 8 additions & 2 deletions src/postgrest/src/postgrest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
from urllib.parse import urlparse

from deprecation import deprecated
from httpx import AsyncClient # noqa: F401
from httpx import Client as BaseClient # noqa: F401
try:
from httpx2 import AsyncClient # noqa: F401
except ImportError:
from httpx import AsyncClient # noqa: F401
try:
from httpx2 import Client as BaseClient # noqa: F401
except ImportError:
from httpx import Client as BaseClient # noqa: F401
from pydantic import BaseModel
from yarl import URL

Expand Down
5 changes: 4 additions & 1 deletion src/postgrest/tests/_async/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from httpx import AsyncClient, AsyncHTTPTransport, Limits
try:
from httpx2 import AsyncClient, AsyncHTTPTransport, Limits
except ImportError:
from httpx import AsyncClient, AsyncHTTPTransport, Limits

from postgrest import AsyncPostgrestClient

Expand Down
5 changes: 4 additions & 1 deletion src/postgrest/tests/_async/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
from unittest.mock import patch

import pytest
from httpx import (
try:
from httpx2 import (
except ImportError:
from httpx import (
AsyncClient,
AsyncHTTPTransport,
BasicAuth,
Expand Down
5 changes: 4 additions & 1 deletion src/postgrest/tests/_async/test_filter_request_builder.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from typing import AsyncIterable

import pytest
from httpx import AsyncClient, Headers, QueryParams
try:
from httpx2 import AsyncClient, Headers, QueryParams
except ImportError:
from httpx import AsyncClient, Headers, QueryParams
from yarl import URL

from postgrest import AsyncFilterRequestBuilder
Expand Down
Loading