Skip to content

Commit 12f83d7

Browse files
committed
add missing
1 parent 9a162b2 commit 12f83d7

File tree

5 files changed

+213
-12
lines changed

5 files changed

+213
-12
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2025 Airbyte, Inc., all rights reserved.
2+
"""The `airbyte-cdk.cli.manifest_runner` module provides a standalone CLI for the Airbyte CDK Manifest Runner.
3+
4+
This CLI enables running a FastAPI server for managing and executing Airbyte declarative manifests.
5+
"""
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Copyright (c) 2025 Airbyte, Inc., all rights reserved.
2+
"""Standalone CLI for the Airbyte CDK Manifest Runner.
3+
4+
This CLI provides commands for running and managing the FastAPI-based manifest runner server.
5+
6+
**Installation:**
7+
8+
To use the manifest-runner functionality, install the CDK with the manifest-runner extra:
9+
10+
```bash
11+
pip install airbyte-cdk[manifest-runner]
12+
# or
13+
poetry install --extras manifest-runner
14+
```
15+
16+
**Usage:**
17+
18+
```bash
19+
manifest-runner start --port 8000
20+
manifest-runner info
21+
manifest-runner --help
22+
```
23+
"""
24+
25+
import sys
26+
from typing import Optional
27+
28+
import rich_click as click
29+
30+
# Import server dependencies with graceful fallback
31+
try:
32+
import fastapi
33+
import uvicorn
34+
35+
FASTAPI_AVAILABLE = True
36+
except ImportError:
37+
FASTAPI_AVAILABLE = False
38+
fastapi = None
39+
uvicorn = None
40+
41+
42+
def _check_manifest_runner_dependencies() -> None:
43+
"""Check if manifest-runner dependencies are installed."""
44+
if not FASTAPI_AVAILABLE:
45+
click.echo(
46+
"❌ Manifest runner dependencies not found. Please install with:\n\n"
47+
" pip install airbyte-cdk[manifest-runner]\n"
48+
" # or\n"
49+
" poetry install --extras manifest-runner\n",
50+
err=True,
51+
)
52+
sys.exit(1)
53+
54+
55+
@click.group(
56+
help=__doc__.replace("\n", "\n\n"), # Render docstring as help text (markdown)
57+
invoke_without_command=True,
58+
)
59+
@click.option(
60+
"--version",
61+
is_flag=True,
62+
help="Show the version of the Airbyte CDK Manifest Runner.",
63+
)
64+
@click.pass_context
65+
def cli(
66+
ctx: click.Context,
67+
version: bool,
68+
) -> None:
69+
"""Airbyte CDK Manifest Runner CLI."""
70+
if version:
71+
click.echo("Airbyte CDK Manifest Runner v1.0.0")
72+
ctx.exit()
73+
74+
if ctx.invoked_subcommand is None:
75+
# If no subcommand is provided, show the help message.
76+
click.echo(ctx.get_help())
77+
ctx.exit()
78+
79+
80+
@cli.command()
81+
@click.option(
82+
"--host",
83+
default="127.0.0.1",
84+
help="Host to bind the server to",
85+
show_default=True,
86+
)
87+
@click.option(
88+
"--port",
89+
default=8000,
90+
help="Port to bind the server to",
91+
show_default=True,
92+
)
93+
@click.option(
94+
"--reload",
95+
is_flag=True,
96+
help="Enable auto-reload for development",
97+
)
98+
def start(host: str, port: int, reload: bool) -> None:
99+
"""Start the FastAPI manifest runner server."""
100+
_check_manifest_runner_dependencies()
101+
102+
# Import and use the main server function
103+
from airbyte_cdk.manifest_runner.main import run_server
104+
105+
run_server(
106+
host=host,
107+
port=port,
108+
reload=reload,
109+
)
110+
111+
112+
@cli.command()
113+
def info() -> None:
114+
"""Show manifest runner information and status."""
115+
if FASTAPI_AVAILABLE:
116+
click.echo("✅ Manifest runner dependencies are installed")
117+
click.echo(f" FastAPI version: {fastapi.__version__}")
118+
click.echo(f" Uvicorn version: {uvicorn.__version__}")
119+
else:
120+
click.echo("❌ Manifest runner dependencies not installed")
121+
click.echo(" Install with: pip install airbyte-cdk[manifest-runner]")
122+
123+
124+
def run() -> None:
125+
"""Entry point for the manifest-runner CLI."""
126+
cli()
127+
128+
129+
if __name__ == "__main__":
130+
run()

airbyte_cdk/manifest_migrations/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This directory contains the logic and registry for manifest migrations in the Ai
2121
3. **Register the Migration:**
2222
- Open `migrations/registry.yaml`.
2323
- Add an entry under the appropriate version, or create a new version section if needed.
24-
- Version can be: "*", "==6.48.3", "~=1.2", ">=1.0.0,<2.0.0", "6.48.3"
24+
- Version can be: "\*", "==6.48.3", "~=1.2", ">=1.0.0,<2.0.0", "6.48.3"
2525
- Each migration entry should include:
2626
- `name`: The filename (without `.py`)
2727
- `order`: The order in which this migration should be applied for the version

poetry.lock

Lines changed: 73 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ pytest = {version = "^7", optional = true }
8787
orjson = "^3.10.7"
8888
serpyco-rs = "^1.10.2"
8989
sqlalchemy = {version = "^2.0,!=2.0.36", optional = true }
90+
fastapi = { version = "^0.104.0", optional = true }
91+
uvicorn = { version = "^0.24.0", optional = true }
9092
xmltodict = ">=0.13,<0.15"
9193
anyascii = "^0.3.2"
9294
whenever = "^0.6.16"
@@ -121,11 +123,13 @@ file-based = ["avro", "fastavro", "pyarrow", "unstructured", "pdf2image", "pdfmi
121123
vector-db-based = ["langchain", "openai", "cohere", "tiktoken"]
122124
sql = ["sqlalchemy"]
123125
dev = ["pytest"]
126+
manifest-runner = ["fastapi", "uvicorn"]
124127

125128
[tool.poetry.scripts]
126129

127130
airbyte-cdk = "airbyte_cdk.cli.airbyte_cdk:cli"
128131
source-declarative-manifest = "airbyte_cdk.cli.source_declarative_manifest:run"
132+
manifest-runner = "airbyte_cdk.cli.manifest_runner._run:run"
129133

130134
# Ruff configuration moved to ruff.toml
131135

0 commit comments

Comments
 (0)