Skip to content

Commit 1b48476

Browse files
authored
chore(deps): Replace pytz.utc with datetime.timezone.utc (#887)
1 parent ff0f427 commit 1b48476

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

airbyte/caches/_state_backend.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44

55
from __future__ import annotations
66

7-
from datetime import datetime
7+
from datetime import datetime, timezone
88
from typing import TYPE_CHECKING
99

10-
from pytz import utc
1110
from sqlalchemy import Column, DateTime, PrimaryKeyConstraint, String, and_
1211
from sqlalchemy.orm import Session, declarative_base
1312

@@ -59,7 +58,9 @@ class CacheStreamStateModel(SqlAlchemyModel): # type: ignore[misc]
5958
"""The JSON string representation of the state message."""
6059

6160
last_updated = Column(
62-
DateTime(timezone=True), onupdate=datetime.now(utc), default=datetime.now(utc)
61+
DateTime(timezone=True),
62+
onupdate=datetime.now(timezone.utc),
63+
default=datetime.now(timezone.utc),
6364
)
6465
"""The last time the state was updated."""
6566

@@ -89,7 +90,9 @@ class DestinationStreamStateModel(SqlAlchemyModel): # type: ignore[misc]
8990
"""The JSON string representation of the state message."""
9091

9192
last_updated = Column(
92-
DateTime(timezone=True), onupdate=datetime.now(utc), default=datetime.now(utc)
93+
DateTime(timezone=True),
94+
onupdate=datetime.now(timezone.utc),
95+
default=datetime.now(timezone.utc),
9396
)
9497
"""The last time the state was updated."""
9598

airbyte/records.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,9 @@
6868

6969
from __future__ import annotations
7070

71-
from datetime import datetime
71+
from datetime import datetime, timezone
7272
from typing import TYPE_CHECKING, Any
7373

74-
import pytz
7574
from uuid_extensions import uuid7str
7675

7776
from airbyte._util.name_normalizers import LowerCaseNormalizer, NameNormalizerBase
@@ -236,7 +235,7 @@ def __init__(
236235
self.update(
237236
{
238237
AB_RAW_ID_COLUMN: uuid7str(),
239-
AB_EXTRACTED_AT_COLUMN: extracted_at or datetime.now(pytz.utc),
238+
AB_EXTRACTED_AT_COLUMN: extracted_at or datetime.now(timezone.utc),
240239
AB_META_COLUMN: {},
241240
}
242241
)
@@ -254,7 +253,7 @@ def from_record_message(
254253
from_dict=data_dict,
255254
stream_record_handler=stream_record_handler,
256255
with_internal_columns=True,
257-
extracted_at=datetime.fromtimestamp(record_message.emitted_at / 1000, tz=pytz.utc),
256+
extracted_at=datetime.fromtimestamp(record_message.emitted_at / 1000, tz=timezone.utc),
258257
)
259258

260259
def __getitem__(self, key: str) -> Any: # noqa: ANN401

poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ pydantic = ">=2.0,<=3.0"
3838
pydantic-core = "*"
3939
python-dotenv = "^1.0.1"
4040
python-ulid = "^3.0.0"
41-
pytz = "*"
4241
pyyaml = "^6.0.2"
4342
requests = "!=3.32.0" # 3.32.0 breaks docker tests
4443
rich = "^13.7.0"

0 commit comments

Comments
 (0)