Skip to content

Commit c63ca4a

Browse files
committed
cleaning out annoying usages importing dependencies from airbyte_cdk without a path
1 parent bbaf25a commit c63ca4a

File tree

13 files changed

+20
-30
lines changed

13 files changed

+20
-30
lines changed

airbyte_cdk/sources/declarative/concurrent_declarative_source.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@
8181
from airbyte_cdk.sources.declarative.spec.spec import Spec
8282
from airbyte_cdk.sources.declarative.types import Config, ConnectionDefinition
8383
from airbyte_cdk.sources.message.concurrent_repository import ConcurrentMessageRepository
84-
from airbyte_cdk.sources.message.repository import InMemoryMessageRepository, MessageRepository
85-
from airbyte_cdk.sources.streams import Stream
84+
from airbyte_cdk.sources.message.repository import InMemoryMessageRepository
8685
from airbyte_cdk.sources.streams.concurrent.abstract_stream import AbstractStream
8786
from airbyte_cdk.sources.streams.concurrent.partitions.types import QueueItem
8887
from airbyte_cdk.sources.utils.slice_logger import (
@@ -386,7 +385,7 @@ def discover(self, logger: logging.Logger, config: Mapping[str, Any]) -> Airbyte
386385
)
387386

388387
# todo: add PR comment about whether we can change the signature to List[AbstractStream]
389-
def streams(self, config: Mapping[str, Any]) -> List[Union[Stream, AbstractStream]]: # type: ignore # we are migrating away from the AbstractSource and are expecting that this will only be called by ConcurrentDeclarativeSource or the Connector Builder
388+
def streams(self, config: Mapping[str, Any]) -> List[AbstractStream]: # type: ignore # we are migrating away from the AbstractSource and are expecting that this will only be called by ConcurrentDeclarativeSource or the Connector Builder
390389
"""
391390
The `streams` method is used as part of the AbstractSource in the following cases:
392391
* ConcurrentDeclarativeSource.check -> ManifestDeclarativeSource.check -> AbstractSource.check -> DeclarativeSource.check_connection -> CheckStream.check_connection -> streams

airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@ def create_datetime_based_cursor(
19721972

19731973
def create_default_stream(
19741974
self, model: DeclarativeStreamModel, config: Config, is_parent: bool = False, **kwargs: Any
1975-
) -> Union[DeclarativeStream, AbstractStream]:
1975+
) -> AbstractStream:
19761976
primary_key = model.primary_key.__root__ if model.primary_key else None
19771977

19781978
partition_router = self._build_stream_slicer_from_partition_router(

airbyte_cdk/sources/declarative/requesters/http_job_repository.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
1+
# Copyright (c) 2025 Airbyte, Inc., all rights reserved.
2+
23
import logging
34
import uuid
45
from dataclasses import dataclass, field
@@ -8,9 +9,8 @@
89
import requests
910
from requests import Response
1011

11-
from airbyte_cdk import AirbyteMessage
1212
from airbyte_cdk.logger import lazy_log
13-
from airbyte_cdk.models import FailureType, Type
13+
from airbyte_cdk.models import AirbyteMessage, FailureType, Type
1414
from airbyte_cdk.sources.declarative.async_job.job import AsyncJob
1515
from airbyte_cdk.sources.declarative.async_job.repository import AsyncJobRepository
1616
from airbyte_cdk.sources.declarative.async_job.status import AsyncJobStatus

airbyte_cdk/sources/declarative/transformations/keys_replace_transformation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from dataclasses import InitVar, dataclass
66
from typing import Any, Dict, Mapping, Optional
77

8-
from airbyte_cdk import InterpolatedString
8+
from airbyte_cdk.sources.declarative.interpolation import InterpolatedString
99
from airbyte_cdk.sources.declarative.transformations import RecordTransformation
1010
from airbyte_cdk.sources.types import Config, StreamSlice, StreamState
1111

unit_tests/sources/declarative/async_job/test_integration.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,26 @@
55
from typing import Any, Iterable, List, Mapping, Optional, Set, Tuple
66
from unittest import TestCase, mock
77

8-
from airbyte_cdk import (
9-
AbstractSource,
10-
DeclarativeStream,
11-
SinglePartitionRouter,
12-
Stream,
13-
StreamSlice,
14-
)
8+
from airbyte_cdk.legacy.sources.declarative.declarative_stream import DeclarativeStream
159
from airbyte_cdk.models import ConnectorSpecification
10+
from airbyte_cdk.sources import AbstractSource
1611
from airbyte_cdk.sources.declarative.async_job.job import AsyncJob
1712
from airbyte_cdk.sources.declarative.async_job.job_orchestrator import AsyncJobOrchestrator
1813
from airbyte_cdk.sources.declarative.async_job.job_tracker import JobTracker
1914
from airbyte_cdk.sources.declarative.async_job.repository import AsyncJobRepository
2015
from airbyte_cdk.sources.declarative.async_job.status import AsyncJobStatus
2116
from airbyte_cdk.sources.declarative.extractors.record_extractor import RecordExtractor
2217
from airbyte_cdk.sources.declarative.extractors.record_selector import RecordSelector
18+
from airbyte_cdk.sources.declarative.partition_routers import SinglePartitionRouter
2319
from airbyte_cdk.sources.declarative.partition_routers.async_job_partition_router import (
2420
AsyncJobPartitionRouter,
2521
)
2622
from airbyte_cdk.sources.declarative.retrievers.async_retriever import AsyncRetriever
2723
from airbyte_cdk.sources.declarative.schema import InlineSchemaLoader
2824
from airbyte_cdk.sources.declarative.stream_slicers import StreamSlicer
2925
from airbyte_cdk.sources.message import NoopMessageRepository
26+
from airbyte_cdk.sources.streams import Stream
27+
from airbyte_cdk.sources.types import StreamSlice
3028
from airbyte_cdk.sources.utils.transform import TransformConfig, TypeTransformer
3129
from airbyte_cdk.test.catalog_builder import CatalogBuilder, ConfiguredAirbyteStreamBuilder
3230
from airbyte_cdk.test.entrypoint_wrapper import read

unit_tests/sources/declarative/async_job/test_job_orchestrator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import pytest
1212

13-
from airbyte_cdk import AirbyteTracedException, StreamSlice
1413
from airbyte_cdk.models import FailureType
1514
from airbyte_cdk.sources.declarative.async_job.job import AsyncJob, AsyncJobStatus
1615
from airbyte_cdk.sources.declarative.async_job.job_orchestrator import (
@@ -21,6 +20,8 @@
2120
from airbyte_cdk.sources.declarative.async_job.repository import AsyncJobRepository
2221
from airbyte_cdk.sources.message import MessageRepository
2322
from airbyte_cdk.sources.streams.http.http_client import MessageRepresentationAirbyteTracedErrors
23+
from airbyte_cdk.sources.types import StreamSlice
24+
from airbyte_cdk.utils import AirbyteTracedException
2425

2526
_ANY_STREAM_SLICE = Mock()
2627
_A_STREAM_SLICE = Mock()

unit_tests/sources/declarative/decoders/test_decoders_memory_usage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
import pytest
99
import requests
1010

11-
from airbyte_cdk import YamlDeclarativeSource
1211
from airbyte_cdk.models import SyncMode
1312
from airbyte_cdk.sources.declarative.models import DeclarativeStream as DeclarativeStreamModel
1413
from airbyte_cdk.sources.declarative.parsers.model_to_component_factory import (
1514
ModelToComponentFactory,
1615
)
16+
from airbyte_cdk.sources.declarative.yaml_declarative_source import YamlDeclarativeSource
1717

1818

1919
@pytest.mark.slow

unit_tests/sources/declarative/extractors/test_dpath_extractor.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
import pytest
99
import requests
1010

11-
from airbyte_cdk import Decoder
12-
from airbyte_cdk.sources.declarative.decoders import CompositeRawDecoder
11+
from airbyte_cdk.sources.declarative.decoders import CompositeRawDecoder, Decoder
1312
from airbyte_cdk.sources.declarative.decoders.composite_raw_decoder import JsonLineParser
1413
from airbyte_cdk.sources.declarative.decoders.json_decoder import (
1514
IterableDecoder,

unit_tests/sources/declarative/interpolation/test_jinja.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from freezegun import freeze_time
99
from jinja2.exceptions import TemplateSyntaxError
1010

11-
from airbyte_cdk import StreamSlice
1211
from airbyte_cdk.sources.declarative.interpolation.jinja import JinjaInterpolation
12+
from airbyte_cdk.sources.types import StreamSlice
1313
from airbyte_cdk.utils import AirbyteTracedException
1414

1515
interpolation = JinjaInterpolation()

unit_tests/sources/declarative/parsers/test_model_to_component_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from freezegun.api import FakeDatetime
1515
from pydantic.v1 import ValidationError
1616

17-
from airbyte_cdk import AirbyteTracedException
1817
from airbyte_cdk.legacy.sources.declarative.declarative_stream import DeclarativeStream
1918
from airbyte_cdk.legacy.sources.declarative.incremental import DatetimeBasedCursor
2019
from airbyte_cdk.models import (
@@ -175,6 +174,7 @@
175174
SingleUseRefreshTokenOauth2Authenticator,
176175
)
177176
from airbyte_cdk.sources.types import StreamSlice
177+
from airbyte_cdk.utils import AirbyteTracedException
178178
from airbyte_cdk.utils.datetime_helpers import AirbyteDateTime, ab_datetime_now, ab_datetime_parse
179179
from unit_tests.sources.declarative.parsers.testing_components import (
180180
TestingCustomSubstreamPartitionRouter,

0 commit comments

Comments
 (0)