Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Limit internal usage of pendulum #2132

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
d9bd3f1
refactor: Limit internal usage of pendulum
edgarrmondragon Jan 2, 2024
c4d31ba
Merge branch 'main' into edgarrmondragon/refactor/limit-usage-of-pend…
edgarrmondragon Jan 26, 2024
35a3c54
fix: Replace use of deprecated `jsonschema._RefResolver` with recomme…
edgarrmondragon Jan 26, 2024
68af5a1
refactor: Remove unused `logger` parameter from private catalog helpe…
edgarrmondragon Jan 27, 2024
c631d0e
refactor: Use `functools.lru_cache` instead of the stale `memoization…
edgarrmondragon Jan 27, 2024
4b9af7b
chore(deps): bump referencing from 0.32.1 to 0.33.0 (#2194)
dependabot[bot] Jan 29, 2024
b7a69b1
chore(deps): bump cryptography from 42.0.0 to 42.0.1 (#2193)
dependabot[bot] Jan 29, 2024
d6ecb55
chore(deps-dev): bump pytz from 2023.3.post1 to 2023.4 (#2191)
dependabot[bot] Jan 29, 2024
8cac7f4
fix(templates): Include empty `schemas` directory in REST tap cookiec…
edgarrmondragon Jan 29, 2024
de12694
Merge branch 'main' into edgarrmondragon/refactor/limit-usage-of-pend…
edgarrmondragon Jan 29, 2024
0784397
Merge branch 'main' into edgarrmondragon/refactor/limit-usage-of-pend…
edgarrmondragon Jan 31, 2024
0a346df
Merge branch 'main' into edgarrmondragon/refactor/limit-usage-of-pend…
edgarrmondragon Jan 31, 2024
0873d31
Merge branch 'main' into edgarrmondragon/refactor/limit-usage-of-pend…
edgarrmondragon Feb 5, 2024
25f80c6
Merge branch 'main' into edgarrmondragon/refactor/limit-usage-of-pend…
edgarrmondragon Feb 5, 2024
664076b
Merge branch 'main' into edgarrmondragon/refactor/limit-usage-of-pend…
edgarrmondragon Feb 9, 2024
18427b1
docs: Added an example implemetation of JSON schema validation that u…
edgarrmondragon Feb 9, 2024
e843707
fix(templates): Test workflow job now fails for unsupported Python ve…
ReubenFrankel Feb 10, 2024
bed5e2f
chore(deps): bump pre-commit from 3.6.0 to 3.6.1 in /.github/workflow…
dependabot[bot] Feb 12, 2024
fd99a3c
chore: pre-commit autoupdate (#2234)
pre-commit-ci[bot] Feb 13, 2024
41c0397
chore(deps): bump sqlalchemy from 2.0.25 to 2.0.26 (#2235)
dependabot[bot] Feb 13, 2024
95cb480
chore(deps): bump sqlalchemy from 2.0.26 to 2.0.27 (#2236)
dependabot[bot] Feb 13, 2024
b3d943f
chore(deps-dev): bump duckdb from 0.9.2 to 0.10.0 (#2237)
dependabot[bot] Feb 13, 2024
35c2842
fix(taps): Hard and soft deletes for handling `ACTIVATE_VERSION` mess…
vitoravancini Feb 14, 2024
54fb14b
fix: Instances of `oneOf` are now handled by null-appending logic (#2…
edgarrmondragon Feb 15, 2024
aa802b4
chore: Cleaned up some unused files (#2240)
edgarrmondragon Feb 15, 2024
e37d695
fix: Force flattened record according to provided flattened schema (#…
joaopamaral Feb 15, 2024
76b5f55
docs: Linked reference docs to source code (#2239)
edgarrmondragon Feb 15, 2024
94cdcdb
chore: Release v0.35.1 (#2247)
MeltyBot Feb 15, 2024
1f7e0e3
chore(deps): bump cryptography from 42.0.2 to 42.0.3 (#2249)
dependabot[bot] Feb 19, 2024
2b9b401
chore(deps): bump pre-commit from 3.6.1 to 3.6.2 in /.github/workflow…
dependabot[bot] Feb 19, 2024
f4529cb
chore(deps): bump faker from 23.1.0 to 23.2.1 (#2250)
dependabot[bot] Feb 19, 2024
2151377
fix: Null type is now correctly appended as `{"type": "null"}` to `on…
edgarrmondragon Feb 19, 2024
7920aae
chore: Release v0.35.2 (#2253)
MeltyBot Feb 19, 2024
7e27f67
chore: pre-commit autoupdate (#2254)
pre-commit-ci[bot] Feb 20, 2024
db79a62
chore(deps-dev): bump types-simplejson from 3.19.0.2 to 3.19.0.202402…
dependabot[bot] Feb 20, 2024
92e77e5
chore(deps): bump pytest from 8.0.0 to 8.0.1 (#2256)
dependabot[bot] Feb 20, 2024
66ef127
chore(deps): bump cryptography from 42.0.3 to 42.0.4 (#2261)
dependabot[bot] Feb 21, 2024
ee21bd5
chore(deps-dev): bump coverage from 7.4.1 to 7.4.2 (#2260)
dependabot[bot] Feb 21, 2024
b37e8f8
refactor: Deprecated `singer_sdk.authenticators.BasicAuthenticator` i…
edgarrmondragon Feb 23, 2024
8052080
feat(targets): Targets now accept a `batch_size_rows` setting to conf…
BuzzCutNorman Feb 23, 2024
e0b120d
fix: Database disconnects are now handled via SQLAlchemy `pool_pre_pi…
edgarrmondragon Feb 23, 2024
cc05280
feat: Nested settings are now documented in the output of `--about --…
edgarrmondragon Feb 23, 2024
56c6f25
feat: JSON schema keywords such as `maxLength` are now supported in `…
edgarrmondragon Feb 23, 2024
15b10cc
chore(deps): bump poetry from 1.7.1 to 1.8.0 in /.github/workflows (#…
dependabot[bot] Feb 26, 2024
3fca784
chore(deps): bump typing-extensions from 4.9.0 to 4.10.0 (#2266)
dependabot[bot] Feb 26, 2024
113d929
chore(deps): bump cryptography from 42.0.4 to 42.0.5 (#2268)
dependabot[bot] Feb 26, 2024
380f363
chore(deps): bump importlib-resources from 6.1.1 to 6.1.2 (#2267)
dependabot[bot] Feb 26, 2024
7f385f5
chore(deps-dev): bump coverage from 7.4.2 to 7.4.3 (#2269)
dependabot[bot] Feb 26, 2024
01c1aba
chore(deps): bump pytest from 8.0.1 to 8.0.2 (#2270)
dependabot[bot] Feb 26, 2024
9cc12cf
chore: Update locked dependencies (#2271)
edgarrmondragon Feb 26, 2024
7da351a
chore: Release v0.36.0 (#2272)
MeltyBot Feb 26, 2024
0c72880
chore(deps): bump poetry from 1.8.0 to 1.8.1 in /.github/workflows (#…
dependabot[bot] Feb 27, 2024
7eaf0e4
fix(templates): Test workflow now fails for any Python matrix job fai…
ReubenFrankel Feb 29, 2024
2ddfc19
chore(deps): bump faker from 23.2.1 to 23.3.0 (#2275)
dependabot[bot] Feb 29, 2024
bbfd6c6
chore(deps): bump python-dateutil from 2.8.2 to 2.9.0 (#2276)
dependabot[bot] Mar 1, 2024
5b3f47d
chore(deps): bump the actions group with 1 update (#2280)
dependabot[bot] Mar 4, 2024
c44f819
chore(deps): bump python-dateutil from 2.9.0 to 2.9.0.post0 (#2279)
dependabot[bot] Mar 4, 2024
6b287fd
chore(deps): bump poetry from 1.8.1 to 1.8.2 in /.github/workflows (#…
dependabot[bot] Mar 4, 2024
71925e8
chore(deps): bump nox from 2023.4.22 to 2024.3.2 in /.github/workflow…
dependabot[bot] Mar 4, 2024
500465f
fix: The `state_partition_context` dictionary is now correctly interp…
edgarrmondragon Mar 4, 2024
b50493e
test: Made the `test_sync_timer` test faster by using `time_machine` …
edgarrmondragon Mar 4, 2024
7f43050
chore(deps): bump faker from 23.3.0 to 24.0.0 (#2284)
dependabot[bot] Mar 5, 2024
a818a77
chore(deps): bump sqlalchemy from 2.0.27 to 2.0.28 (#2286)
dependabot[bot] Mar 5, 2024
1ad8dc3
chore(deps-dev): bump duckdb-engine from 0.11.1 to 0.11.2 (#2285)
dependabot[bot] Mar 5, 2024
0798ac2
Merge branch 'main' into edgarrmondragon/refactor/limit-usage-of-pend…
edgarrmondragon Mar 20, 2024
298555b
Merge branch 'main' into edgarrmondragon/refactor/limit-usage-of-pend…
edgarrmondragon May 7, 2024
cdc702f
Merge branch 'main' into edgarrmondragon/refactor/limit-usage-of-pend…
edgarrmondragon May 27, 2024
98de45e
Merge branch 'main' into edgarrmondragon/refactor/limit-usage-of-pend…
edgarrmondragon May 27, 2024
f20d720
Merge branch 'main' into edgarrmondragon/refactor/limit-usage-of-pend…
edgarrmondragon Jul 5, 2024
3aecc4e
Make deptry happy
edgarrmondragon Jul 5, 2024
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
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ types-requests = "requests"
[tool.deptry.per_rule_ignores]
DEP002 = [
# Deprecated dependencies
"pendulum",
"python-dateutil",
# Transitive constraints
"numpy",
Expand Down Expand Up @@ -407,6 +408,9 @@ typing = "t"
fixture-parentheses = false
parametrize-names-type = "csv"

[tool.ruff.lint.flake8-tidy-imports.banned-api]
"pendulum".msg = "BAN002: pendulum is banned"

[tool.ruff.lint.isort]
known-first-party = ["singer_sdk", "samples", "tests"]
required-imports = ["from __future__ import annotations"]
Expand Down
3 changes: 1 addition & 2 deletions singer_sdk/authenticators.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import math
import typing as t
import warnings
from datetime import timedelta
from types import MappingProxyType
from urllib.parse import parse_qs, urlencode, urlsplit, urlunsplit

Expand Down Expand Up @@ -557,7 +556,7 @@ def oauth_request_body(self) -> dict:
"iss": self.client_id,
"scope": self.oauth_scopes,
"aud": self.auth_endpoint,
"exp": math.floor((request_time + timedelta(hours=1)).timestamp()),
"exp": math.floor((request_time + datetime.timedelta(hours=1)).timestamp()),
"iat": math.floor(request_time.timestamp()),
}

Expand Down
9 changes: 2 additions & 7 deletions singer_sdk/helpers/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@

from __future__ import annotations

import datetime
import json
import typing as t
from pathlib import Path, PurePath

import pendulum

if t.TYPE_CHECKING:
import datetime


def read_json_file(path: PurePath | str) -> dict[str, t.Any]:
"""Read json file, throwing an error if missing."""
Expand All @@ -30,5 +26,4 @@ def read_json_file(path: PurePath | str) -> dict[str, t.Any]:

def utc_now() -> datetime.datetime:
"""Return current time in UTC."""
# TODO: replace with datetime.datetime.now(tz=datetime.timezone.utc)
return pendulum.now(tz="UTC")
return datetime.datetime.now(datetime.timezone.utc)
8 changes: 4 additions & 4 deletions singer_sdk/streams/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from pathlib import Path
from types import MappingProxyType

import pendulum

import singer_sdk._singerlib as singer
from singer_sdk import metrics
from singer_sdk.batch import Batcher
Expand All @@ -30,6 +28,7 @@
SDKBatchMessage,
)
from singer_sdk.helpers._catalog import pop_deselected_record_properties
from singer_sdk.helpers._compat import datetime_fromisoformat
from singer_sdk.helpers._flattening import get_flattening_options
from singer_sdk.helpers._state import (
finalize_state_progress_markers,
Expand Down Expand Up @@ -291,7 +290,8 @@ def get_starting_timestamp(
msg = f"The replication key {self.replication_key} is not of timestamp type"
raise ValueError(msg)

return t.cast(datetime.datetime, pendulum.parse(value))
result = datetime_fromisoformat(value)
return result if result.tzinfo else result.replace(tzinfo=datetime.timezone.utc)

@property
def selected(self) -> bool:
Expand Down Expand Up @@ -377,7 +377,7 @@ def compare_start_date(self, value: str, start_date_value: str) -> str:
The most recent value between the bookmark and start date.
"""
if self.is_timestamp_replication_key:
return max(value, start_date_value, key=pendulum.parse)
return max(value, start_date_value, key=datetime_fromisoformat)

return value

Expand Down
4 changes: 2 additions & 2 deletions tests/core/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import typing as t
from contextlib import contextmanager

import pendulum
import pytest
from typing_extensions import override

from singer_sdk import Stream, Tap
from singer_sdk.helpers._compat import datetime_fromisoformat
from singer_sdk.typing import (
DateTimeType,
IntegerType,
Expand Down Expand Up @@ -70,7 +70,7 @@ class UnixTimestampIncrementalStream2(UnixTimestampIncrementalStream):
def compare_start_date(self, value: str, start_date_value: str) -> str:
"""Compare a value to a start date value."""

start_timestamp = pendulum.parse(start_date_value).format("X")
start_timestamp = datetime_fromisoformat(start_date_value).timestamp()
return max(value, start_timestamp, key=float)


Expand Down
7 changes: 3 additions & 4 deletions tests/core/test_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import logging
import typing as t

import pendulum
import pytest
import requests

Expand All @@ -24,12 +23,12 @@
from singer_sdk.typing import IntegerType, PropertiesList, Property, StringType
from tests.core.conftest import SimpleTestStream

CONFIG_START_DATE = "2021-01-01"

if t.TYPE_CHECKING:
from singer_sdk import Stream, Tap
from tests.core.conftest import SimpleTestTap

CONFIG_START_DATE = "2021-01-01"


class RestTestStream(RESTStream):
"""Test RESTful stream class."""
Expand Down Expand Up @@ -181,7 +180,7 @@ def test_stream_apply_catalog(stream: Stream):
"unix_ts_override",
None,
"1577858400",
pendulum.parse(CONFIG_START_DATE).format("X"),
parse(CONFIG_START_DATE).timestamp(),
id="unix-ts-repl-key-old-bookmark",
),
],
Expand Down
Loading