Skip to content

Commit b47176b

Browse files
committed
move connector-builder-test-read into cli module, register CLI in pyproject.toml
1 parent f98b5fa commit b47176b

File tree

8 files changed

+25
-6
lines changed

8 files changed

+25
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (c) 2025 Airbyte, Inc., all rights reserved.
2+
"""CLI for running test reads from the Airbyte Connector Builder.
3+
4+
This CLI accepts a config file and an action to perform on the connector.
5+
6+
Usage:
7+
connector-builder-test-read [--config CONFIG] [--action ACTION]
8+
9+
Options:
10+
--action ACTION The action to perform (e.g., test, validate).
11+
--config CONFIG Path to the config file.
12+
"""
13+
from airbyte_cdk.cli.connector_builder_test_read.run import run
14+
15+
__all__ = [
16+
"run",
17+
]

airbyte_cdk/connector_builder/main.py renamed to airbyte_cdk/cli/connector_builder_test_read/run.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,17 @@ def handle_request(args: List[str]) -> str:
9696
).decode() # type: ignore[no-any-return] # Serializer.dump() always returns AirbyteMessage
9797

9898

99-
if __name__ == "__main__":
99+
def run(args: List[str] | None) -> None:
100+
args = args or sys.argv[1:]
100101
try:
101-
print(handle_request(sys.argv[1:]))
102+
print(handle_request(args))
102103
except Exception as exc:
103104
error = AirbyteTracedException.from_exception(
104105
exc, message=f"Error handling request: {str(exc)}"
105106
)
106107
m = error.as_airbyte_message()
107108
print(orjson.dumps(AirbyteMessageSerializer.dump(m)).decode())
109+
110+
111+
if __name__ == "__main__":
112+
run()

airbyte_cdk/connector_builder/__init__.py

-3
This file was deleted.

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ vector-db-based = ["langchain", "openai", "cohere", "tiktoken"]
109109
sql = ["sqlalchemy"]
110110

111111
[tool.poetry.scripts]
112-
113112
source-declarative-manifest = "airbyte_cdk.cli.source_declarative_manifest:run"
113+
connector-builder-test-read = "airbyte_cdk.cli.connector_builder_test_read:run"
114114

115115
[tool.isort]
116116
skip = ["__init__.py"] # TODO: Remove after this is fixed: https://github.com/airbytehq/airbyte-python-cdk/issues/12

0 commit comments

Comments
 (0)