Skip to content

Commit 1058b8c

Browse files
chore: Relax pydantic version (#232)
1 parent 7a34135 commit 1058b8c

File tree

6 files changed

+20
-14
lines changed

6 files changed

+20
-14
lines changed

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ install_requires =
2828
appdirs-stubs>=0.1.0
2929
cryptography>=3.4.0
3030
httpx[http2]==0.23.0
31-
pydantic[dotenv]>=1.8.2,<1.10
31+
pydantic[dotenv]>=1.8.2
3232
python-dateutil>=2.8.2
3333
readerwriterlock==1.0.9
3434
sqlparse>=0.4.2

src/firebolt/common/settings.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
from typing import Optional
23

34
from pydantic import BaseSettings, Field, SecretStr, root_validator
45

@@ -33,14 +34,14 @@ class Settings(BaseSettings):
3334
default_region (str): Default region for provisioning
3435
"""
3536

36-
auth: Auth = Field(None)
37+
auth: Optional[Auth] = Field(None)
3738
# Authorization
38-
user: str = Field(None, env="FIREBOLT_USER")
39-
password: SecretStr = Field(None, env="FIREBOLT_PASSWORD")
39+
user: Optional[str] = Field(None, env="FIREBOLT_USER")
40+
password: Optional[SecretStr] = Field(None, env="FIREBOLT_PASSWORD")
4041
# Or
41-
access_token: str = Field(None, env="FIREBOLT_AUTH_TOKEN")
42+
access_token: Optional[str] = Field(None, env="FIREBOLT_AUTH_TOKEN")
4243

43-
account_name: str = Field(None, env="FIREBOLT_ACCOUNT")
44+
account_name: Optional[str] = Field(None, env="FIREBOLT_ACCOUNT")
4445
server: str = Field(..., env="FIREBOLT_SERVER")
4546
default_region: str = Field(..., env="FIREBOLT_DEFAULT_REGION")
4647
use_token_cache: bool = Field(True)

src/firebolt/model/database.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ class Database(FireboltBaseModel):
4545
compute_region_key: RegionKey = Field(alias="compute_region_id")
4646

4747
# optional
48-
database_key: Optional[DatabaseKey] = Field(alias="id")
49-
description: Optional[str] = Field(max_length=255)
50-
emoji: Optional[str] = Field(max_length=255)
48+
database_key: Optional[DatabaseKey] = Field(None, alias="id")
49+
description: Optional[str] = Field(None, max_length=255)
50+
emoji: Optional[str] = Field(None, max_length=255)
5151
current_status: Optional[str]
5252
health_status: Optional[str]
5353
data_size_full: Optional[int]

src/firebolt/model/engine.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,17 @@ class Engine(FireboltBaseModel):
122122
settings: EngineSettings
123123

124124
# optional
125-
key: Optional[EngineKey] = Field(alias="id")
125+
key: Optional[EngineKey] = Field(None, alias="id")
126126
description: Optional[str]
127127
emoji: Optional[str]
128128
current_status: Optional[EngineStatus]
129129
current_status_summary: Optional[EngineStatusSummary]
130-
latest_revision_key: Optional[EngineRevisionKey] = Field(alias="latest_revision_id")
130+
latest_revision_key: Optional[EngineRevisionKey] = Field(
131+
None, alias="latest_revision_id"
132+
)
131133
endpoint: Optional[str]
132134
endpoint_serving_revision_key: Optional[EngineRevisionKey] = Field(
133-
alias="endpoint_serving_revision_id"
135+
None, alias="endpoint_serving_revision_id"
134136
)
135137
create_time: Optional[datetime]
136138
create_actor: Optional[str]
@@ -140,7 +142,7 @@ class Engine(FireboltBaseModel):
140142
desired_status: Optional[str]
141143
health_status: Optional[str]
142144
endpoint_desired_revision_key: Optional[EngineRevisionKey] = Field(
143-
alias="endpoint_desired_revision_id"
145+
None, alias="endpoint_desired_revision_id"
144146
)
145147

146148
@classmethod

src/firebolt/model/engine_revision.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class EngineRevision(FireboltBaseModel):
4848
specification: EngineRevisionSpecification
4949

5050
# optional
51-
key: Optional[EngineRevisionKey] = Field(alias="id")
51+
key: Optional[EngineRevisionKey] = Field(None, alias="id")
5252
current_status: Optional[str]
5353
create_time: Optional[datetime]
5454
create_actor: Optional[str]

src/firebolt/service/manager.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ def __init__(self, settings: Optional[Settings] = None):
3636
if self.settings.access_token:
3737
auth = Token(self.settings.access_token)
3838
else:
39+
# mypy checks
40+
assert self.settings.user
41+
assert self.settings.password
3942
auth = UsernamePassword(
4043
self.settings.user,
4144
self.settings.password.get_secret_value(),

0 commit comments

Comments
 (0)