diff --git a/lago_python_client/base_client.py b/lago_python_client/base_client.py index 4ba29344..6e0351c5 100644 --- a/lago_python_client/base_client.py +++ b/lago_python_client/base_client.py @@ -1,7 +1,7 @@ from abc import ABC, abstractmethod from typing import Type -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel class BaseClient(ABC): diff --git a/lago_python_client/base_model.py b/lago_python_client/base_model.py index 97db6d20..6a47bb31 100644 --- a/lago_python_client/base_model.py +++ b/lago_python_client/base_model.py @@ -1,4 +1,7 @@ -from pydantic import BaseModel +try: + from pydantic.v1 import BaseModel # type: ignore +except ImportError: + from pydantic import BaseModel class BaseResponseModel(BaseModel): diff --git a/lago_python_client/events/clients.py b/lago_python_client/events/clients.py index 992e2cab..d3f43da5 100644 --- a/lago_python_client/events/clients.py +++ b/lago_python_client/events/clients.py @@ -1,7 +1,7 @@ import sys from typing import Any, ClassVar, Optional, Type -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from ..base_client import BaseClient from ..fees.clients import FeeClient diff --git a/lago_python_client/mixins.py b/lago_python_client/mixins.py index eadd35b9..898fa002 100644 --- a/lago_python_client/mixins.py +++ b/lago_python_client/mixins.py @@ -8,7 +8,7 @@ except ImportError: # Python 3.7 from typing_extensions import Protocol # type: ignore -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from .services.json import to_json from .services.request import make_headers, make_url, send_delete_request, send_get_request, send_post_request, send_put_request diff --git a/lago_python_client/models/add_on.py b/lago_python_client/models/add_on.py index 643d3630..738b189a 100644 --- a/lago_python_client/models/add_on.py +++ b/lago_python_client/models/add_on.py @@ -1,6 +1,6 @@ from typing import List, Optional -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from ..base_model import BaseResponseModel diff --git a/lago_python_client/models/applied_coupon.py b/lago_python_client/models/applied_coupon.py index 2bd253df..098b6058 100644 --- a/lago_python_client/models/applied_coupon.py +++ b/lago_python_client/models/applied_coupon.py @@ -1,6 +1,6 @@ from typing import Optional -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from .credit import CreditsResponse from ..base_model import BaseResponseModel diff --git a/lago_python_client/models/billable_metric.py b/lago_python_client/models/billable_metric.py index 657210d7..a4736294 100644 --- a/lago_python_client/models/billable_metric.py +++ b/lago_python_client/models/billable_metric.py @@ -1,6 +1,6 @@ from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from ..base_model import BaseResponseModel diff --git a/lago_python_client/models/charge.py b/lago_python_client/models/charge.py index 1f8f3575..5e73620a 100644 --- a/lago_python_client/models/charge.py +++ b/lago_python_client/models/charge.py @@ -1,6 +1,6 @@ from typing import Any, Dict, List, Optional -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from .tax import TaxesResponse from ..base_model import BaseResponseModel @@ -63,4 +63,4 @@ class ChargeOverrides(BaseModel): class ChargesOverrides(BaseModel): - __root__: List[ChargeOverrides] \ No newline at end of file + __root__: List[ChargeOverrides] diff --git a/lago_python_client/models/coupon.py b/lago_python_client/models/coupon.py index 16692d1e..5a2d0383 100644 --- a/lago_python_client/models/coupon.py +++ b/lago_python_client/models/coupon.py @@ -1,6 +1,6 @@ from typing import Any, List, Optional -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from ..base_model import BaseResponseModel diff --git a/lago_python_client/models/credit.py b/lago_python_client/models/credit.py index 9e14ce0d..47848d9e 100644 --- a/lago_python_client/models/credit.py +++ b/lago_python_client/models/credit.py @@ -1,6 +1,6 @@ from typing import List, Optional -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from .invoice_item import InvoiceItemResponse from ..base_model import BaseResponseModel diff --git a/lago_python_client/models/credit_note.py b/lago_python_client/models/credit_note.py index b8accf5c..49bf8ff1 100644 --- a/lago_python_client/models/credit_note.py +++ b/lago_python_client/models/credit_note.py @@ -1,6 +1,6 @@ from typing import List, Optional -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from .fee import FeeResponse from ..base_model import BaseResponseModel diff --git a/lago_python_client/models/customer.py b/lago_python_client/models/customer.py index f4bd94e3..2ee55760 100644 --- a/lago_python_client/models/customer.py +++ b/lago_python_client/models/customer.py @@ -1,6 +1,6 @@ from typing import List, Optional -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from ..base_model import BaseResponseModel diff --git a/lago_python_client/models/customer_usage.py b/lago_python_client/models/customer_usage.py index 1921b8e6..eb1987fd 100644 --- a/lago_python_client/models/customer_usage.py +++ b/lago_python_client/models/customer_usage.py @@ -1,6 +1,6 @@ from typing import Dict, List, Optional -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from ..base_model import BaseResponseModel diff --git a/lago_python_client/models/event.py b/lago_python_client/models/event.py index 17cc4709..d130daf9 100644 --- a/lago_python_client/models/event.py +++ b/lago_python_client/models/event.py @@ -1,6 +1,6 @@ from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from ..base_model import BaseResponseModel @@ -30,4 +30,4 @@ class EventResponse(BaseResponseModel): created_at: str class BatchEventResponse(BaseResponseModel): - events: List[EventResponse] \ No newline at end of file + events: List[EventResponse] diff --git a/lago_python_client/models/group.py b/lago_python_client/models/group.py index 58920373..3b195498 100644 --- a/lago_python_client/models/group.py +++ b/lago_python_client/models/group.py @@ -1,6 +1,6 @@ from typing import Optional -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from ..base_model import BaseResponseModel diff --git a/lago_python_client/models/invoice.py b/lago_python_client/models/invoice.py index 035359f1..8f51e0fa 100644 --- a/lago_python_client/models/invoice.py +++ b/lago_python_client/models/invoice.py @@ -1,6 +1,6 @@ from typing import List, Optional -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from .credit import CreditsResponse from .customer import CustomerResponse diff --git a/lago_python_client/models/organization.py b/lago_python_client/models/organization.py index 0f7ea56f..6b296dbe 100644 --- a/lago_python_client/models/organization.py +++ b/lago_python_client/models/organization.py @@ -1,6 +1,6 @@ from typing import Optional, List -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from ..base_model import BaseResponseModel diff --git a/lago_python_client/models/plan.py b/lago_python_client/models/plan.py index 082738a6..5ad40842 100644 --- a/lago_python_client/models/plan.py +++ b/lago_python_client/models/plan.py @@ -1,6 +1,6 @@ from typing import List, Optional -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from .charge import Charges, ChargesResponse, ChargesOverrides from .tax import Taxes, TaxesResponse @@ -48,4 +48,4 @@ class PlanOverrides(BaseModel): amount_currency: Optional[str] trial_period: Optional[float] charges: Optional[ChargesOverrides] - tax_codes: Optional[List[str]] \ No newline at end of file + tax_codes: Optional[List[str]] diff --git a/lago_python_client/models/subscription.py b/lago_python_client/models/subscription.py index 3ebf1dca..340382bc 100644 --- a/lago_python_client/models/subscription.py +++ b/lago_python_client/models/subscription.py @@ -1,6 +1,6 @@ from typing import List, Optional -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from .plan import PlanOverrides from ..base_model import BaseResponseModel diff --git a/lago_python_client/models/tax.py b/lago_python_client/models/tax.py index ba8d9b51..e0d96f76 100644 --- a/lago_python_client/models/tax.py +++ b/lago_python_client/models/tax.py @@ -1,6 +1,6 @@ from typing import List, Optional -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from ..base_model import BaseResponseModel diff --git a/lago_python_client/models/wallet.py b/lago_python_client/models/wallet.py index 13f3fe76..639e8955 100644 --- a/lago_python_client/models/wallet.py +++ b/lago_python_client/models/wallet.py @@ -1,6 +1,6 @@ from typing import List, Optional -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from ..base_model import BaseResponseModel diff --git a/lago_python_client/models/wallet_transaction.py b/lago_python_client/models/wallet_transaction.py index d7d0c560..62a7ae04 100644 --- a/lago_python_client/models/wallet_transaction.py +++ b/lago_python_client/models/wallet_transaction.py @@ -1,6 +1,6 @@ from typing import Optional -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from ..base_model import BaseResponseModel diff --git a/lago_python_client/models/webhook_endpoint.py b/lago_python_client/models/webhook_endpoint.py index d797e8af..a97dd6ec 100644 --- a/lago_python_client/models/webhook_endpoint.py +++ b/lago_python_client/models/webhook_endpoint.py @@ -1,6 +1,6 @@ from typing import Optional -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from ..base_model import BaseResponseModel diff --git a/lago_python_client/services/response.py b/lago_python_client/services/response.py index aa774634..59b438bf 100644 --- a/lago_python_client/services/response.py +++ b/lago_python_client/services/response.py @@ -11,7 +11,7 @@ from typing_extensions import Final # type: ignore from httpx import Response as Response # not a typo! implicit reexport -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel import typeguard from ..exceptions import LagoApiError diff --git a/lago_python_client/wallets/clients.py b/lago_python_client/wallets/clients.py index 82a35344..b896f64a 100644 --- a/lago_python_client/wallets/clients.py +++ b/lago_python_client/wallets/clients.py @@ -1,7 +1,7 @@ import sys from typing import Any, ClassVar, Type, Union -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from ..base_client import BaseClient from ..mixins import CreateCommandMixin, DestroyCommandMixin, FindAllCommandMixin, FindCommandMixin, UpdateCommandMixin diff --git a/lago_python_client/webhook_endpoints/clients.py b/lago_python_client/webhook_endpoints/clients.py index c16eca9c..95f076af 100644 --- a/lago_python_client/webhook_endpoints/clients.py +++ b/lago_python_client/webhook_endpoints/clients.py @@ -1,7 +1,7 @@ import sys from typing import Any, ClassVar, Type, Union -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel from ..base_client import BaseClient from ..mixins import CreateCommandMixin, DestroyCommandMixin, FindAllCommandMixin, FindCommandMixin, UpdateCommandMixin diff --git a/lago_python_client/webhooks/clients.py b/lago_python_client/webhooks/clients.py index 39e0656a..243e684c 100644 --- a/lago_python_client/webhooks/clients.py +++ b/lago_python_client/webhooks/clients.py @@ -7,7 +7,7 @@ except ImportError: from typing_extensions import TypedDict -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel import typeguard from ..base_client import BaseClient diff --git a/setup.cfg b/setup.cfg index 6a3e12b8..d6022cf2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,7 +30,7 @@ install_requires = classes~=0.4.1 # bugfix auto updates allowed httpx~=0.24.0 # bugfix auto updates allowed orjson~=3.8 # minor auto updates allowed - pydantic~=1.10 # minor auto updates allowed + pydantic>=1.10,<3 # minor auto updates allowed typeguard~=3.0.2 # bugfix auto updates allowed [options.extras_require] diff --git a/tests/test_response_services.py b/tests/test_response_services.py index 4997f291..1731f857 100644 --- a/tests/test_response_services.py +++ b/tests/test_response_services.py @@ -1,7 +1,7 @@ """Test response services.""" from copy import deepcopy -from pydantic import BaseModel +from lago_python_client.base_model import BaseModel import pytest from httpx import Request, Response