Skip to content

Commit 748892d

Browse files
author
Oleksandr Bazarnov
committed
Merge remote-tracking branch 'origin/main' into baz/cdk/extract-common-manifest-parts
2 parents be3bab1 + bf998bd commit 748892d

File tree

57 files changed

+718
-245
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+718
-245
lines changed

.github/workflows/connector-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
name: "Check: '${{matrix.connector}}' (skip=${{needs.cdk_changes.outputs['src'] == 'false' || needs.cdk_changes.outputs[matrix.cdk_extra] == 'false'}})"
9797
permissions:
9898
checks: write
99-
contents: write # Required for creating commit statuses
99+
contents: write # Required for creating commit statuses
100100
pull-requests: read
101101
steps:
102102
- name: Abort if extra not changed (${{matrix.cdk_extra}})

.github/workflows/docker-build-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
docker-build-check:
10-
name: SDM Docker Image Build # Renamed job to be more descriptive
10+
name: SDM Docker Image Build # Renamed job to be more descriptive
1111
runs-on: ubuntu-24.04
1212
steps:
1313
- name: Checkout code

.github/workflows/pypi_publish.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ jobs:
4242
name: Build Python Package
4343
runs-on: ubuntu-24.04
4444
steps:
45-
4645
- name: Checkout CDK Repo
4746
uses: actions/checkout@v4
4847
with:

.github/workflows/python_dependency_analysis.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ jobs:
1919
name: Dependency Analysis with Deptry
2020
runs-on: ubuntu-24.04
2121
steps:
22-
- name: Checkout code
23-
uses: actions/checkout@v4
24-
- name: Set up Python
25-
uses: actions/setup-python@v5
26-
with:
27-
python-version: '3.10'
28-
- name: Set up Poetry
29-
uses: Gr1N/setup-poetry@v9
30-
with:
31-
poetry-version: "2.0.1"
32-
- name: Install dependencies
33-
run: poetry install --all-extras
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.10"
28+
- name: Set up Poetry
29+
uses: Gr1N/setup-poetry@v9
30+
with:
31+
poetry-version: "2.0.1"
32+
- name: Install dependencies
33+
run: poetry install --all-extras
3434

35-
# Job-specific step(s):
36-
- name: Run Deptry
37-
run: |
38-
poetry run deptry .
35+
# Job-specific step(s):
36+
- name: Run Deptry
37+
run: |
38+
poetry run deptry .

.github/workflows/semantic_pr_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
Build
4040
tests
4141
Tests
42-
42+
4343
- name: Check for "do not merge" in PR title
4444
if: ${{ github.event.pull_request.draft == false }}
4545
uses: actions/github-script@v6

.github/workflows/slash_command_dispatch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
- \`/test\` - Runs the test suite
5252
- \`/poetry-lock\` - Re-locks dependencies and updates the poetry.lock file
5353
- \`/help\` - Shows this help message"
54-
54+
5555
if [[ "${{ github.event.comment.body }}" == "/help" ]]; then
5656
echo "body=$HELP_TEXT" >> $GITHUB_OUTPUT
5757
else

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ repos:
3636
- id: check-toml
3737

3838
- repo: https://github.com/astral-sh/ruff-pre-commit
39-
rev: v0.8.3
39+
rev: v0.11.5
4040
hooks:
4141
# Run the linter with repo-defined settings
4242
- id: ruff

airbyte_cdk/connector_builder/connector_builder_handler.py

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

55

66
from dataclasses import asdict, dataclass, field
7-
from typing import Any, Dict, List, Mapping, Optional
7+
from typing import Any, ClassVar, Dict, List, Mapping, Optional
88

99
from airbyte_cdk.connector_builder.test_reader import TestReader
1010
from airbyte_cdk.models import (
@@ -37,6 +37,8 @@
3737

3838
@dataclass
3939
class TestLimits:
40+
__test__: ClassVar[bool] = False # Tell Pytest this is not a Pytest class, despite its name
41+
4042
max_records: int = field(default=DEFAULT_MAXIMUM_RECORDS)
4143
max_pages_per_slice: int = field(default=DEFAULT_MAXIMUM_NUMBER_OF_PAGES_PER_SLICE)
4244
max_slices: int = field(default=DEFAULT_MAXIMUM_NUMBER_OF_SLICES)
@@ -53,18 +55,33 @@ def get_limits(config: Mapping[str, Any]) -> TestLimits:
5355
max_streams = command_config.get(MAX_STREAMS_KEY) or DEFAULT_MAXIMUM_STREAMS
5456
return TestLimits(max_records, max_pages_per_slice, max_slices, max_streams)
5557

58+
def normalize_manifest(config: Mapping[str, Any]) -> bool:
59+
"""
60+
Check if the manifest should be normalized.
61+
:param config: The configuration to check
62+
:return: True if the manifest should be normalized, False otherwise.
63+
"""
64+
return config.get("__requires_normalization", False)
65+
66+
def post_resolve_manifest(config: Mapping[str, Any]) -> bool:
67+
"""
68+
Check if the manifest should be post-resolved.
69+
:param config: The configuration to check
70+
:return: True if the manifest should be post-resolved, False otherwise.
71+
"""
72+
return config.get("__post_resolve_manifest", False)
5673

5774
def create_source(
5875
config: Mapping[str, Any],
5976
limits: TestLimits,
60-
post_resolve_manifest: Optional[bool] = False,
6177
) -> ManifestDeclarativeSource:
6278
manifest = config["__injected_declarative_manifest"]
6379
return ManifestDeclarativeSource(
6480
config=config,
6581
emit_connector_builder_messages=True,
6682
source_config=manifest,
67-
post_resolve_manifest=post_resolve_manifest,
83+
normalize_manifest=normalize_manifest(config),
84+
post_resolve_manifest=post_resolve_manifest(config),
6885
component_factory=ModelToComponentFactory(
6986
emit_connector_builder_messages=True,
7087
limit_pages_fetched_per_slice=limits.max_pages_per_slice,

airbyte_cdk/connector_builder/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ def handle_connector_builder_request(
7878
if command == "resolve_manifest":
7979
return resolve_manifest(source)
8080
elif command == "test_read":
81-
assert (
82-
catalog is not None
83-
), "`test_read` requires a valid `ConfiguredAirbyteCatalog`, got None."
81+
assert catalog is not None, (
82+
"`test_read` requires a valid `ConfiguredAirbyteCatalog`, got None."
83+
)
8484
return read_stream(source, config, catalog, state, limits)
8585
elif command == "full_resolve_manifest":
8686
return full_resolve_manifest(source, limits)

airbyte_cdk/connector_builder/test_reader/reader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
import logging
7-
from typing import Any, Dict, Iterator, List, Mapping, Optional, Union
7+
from typing import Any, ClassVar, Dict, Iterator, List, Mapping, Optional, Union
88

99
from airbyte_cdk.connector_builder.models import (
1010
AuxiliaryRequest,
@@ -66,6 +66,8 @@ class TestReader:
6666
6767
"""
6868

69+
__test__: ClassVar[bool] = False # Tell Pytest this is not a Pytest class, despite its name
70+
6971
logger = logging.getLogger("airbyte.connector-builder")
7072

7173
def __init__(

0 commit comments

Comments
 (0)