Skip to content

Commit f7b88eb

Browse files
authored
docs: add cli module to api docs (#564)
1 parent bed128d commit f7b88eb

File tree

2 files changed

+41
-45
lines changed

2 files changed

+41
-45
lines changed

airbyte/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
from airbyte import (
147147
caches,
148148
callbacks,
149-
# cli, # Causes circular import if included
149+
cli,
150150
cloud,
151151
constants,
152152
datasets,
@@ -166,7 +166,7 @@
166166
# Modules
167167
"caches",
168168
"callbacks",
169-
# "cli", # Causes circular import if included
169+
"cli",
170170
"cloud",
171171
"constants",
172172
"datasets",

airbyte/cli.py

+39-43
Original file line numberDiff line numberDiff line change
@@ -3,64 +3,60 @@
33
44
The PyAirbyte CLI provides a command-line interface for testing connectors and running benchmarks.
55
6-
PyAirbyte CLI can be invoked with the `pyairbyte` CLI executable, or the
6+
After installing PyAirbyte, the CLI can be invoked with the `pyairbyte` CLI executable, or the
77
shorter `pyab` alias.
88
99
These are equivalent:
1010
11-
```bash
12-
python -m airbyte.cli --help
13-
pyairbyte --help
14-
pyab --help
15-
```
11+
```bash
12+
python -m airbyte.cli --help
13+
pyairbyte --help
14+
pyab --help
15+
```
1616
1717
You can also use `pipx` or the fast and powerful `uv` tool to run the PyAirbyte CLI
1818
without pre-installing:
1919
20-
```
21-
# Install `uv` if you haven't already:
22-
brew install uv
20+
```bash
21+
# Install `uv` if you haven't already:
22+
brew install uv
2323
24-
# Run the PyAirbyte CLI using `uvx`:
25-
uvx --from=airbyte pyab --help
26-
```
24+
# Run the PyAirbyte CLI using `uvx`:
25+
uvx --from=airbyte pyab --help
26+
```
2727
2828
Example `benchmark` Usage:
2929
30-
```
31-
# PyAirbyte System Benchmark (no-op):
32-
pyab benchmark --num-records=2.4e6
30+
```bash
31+
# PyAirbyte System Benchmark (no-op):
32+
pyab benchmark --num-records=2.4e6
3333
34-
# Source Benchmark:
35-
pyab benchmark --source=source-hardcoded-records --config='{count: 400000}'
36-
pyab benchmark --source=source-hardcoded-records --config='{count: 400000}' --streams='*'
37-
pyab benchmark --source=source-hardcoded-records --config='{count: 4000}' --streams=dummy_fields
34+
# Source Benchmark:
35+
pyab benchmark --source=source-hardcoded-records --config='{count: 400000}'
36+
pyab benchmark --source=source-hardcoded-records --config='{count: 400000}' --streams='*'
37+
pyab benchmark --source=source-hardcoded-records --config='{count: 4000}' --streams=dummy_fields
3838
39-
# Source Benchmark from Docker Image:
40-
pyab benchmark --source=airbyte/source-hardcoded-records:latest --config='{count: 400_000}'
41-
pyab benchmark --source=airbyte/source-hardcoded-records:dev --config='{count: 400_000}'
42-
43-
# Destination Benchmark:
44-
pyab benchmark --destination=destination-dev-null --config=/path/to/config.json
45-
46-
# Benchmark a Local Python Source (source-s3):
47-
pyab benchmark --source=$(poetry run which source-s3) --config=./secrets/config.json
48-
# Equivalent to:
49-
LOCAL_EXECUTABLE=$(poetry run which source-s3)
50-
CONFIG_PATH=$(realpath ./secrets/config.json)
51-
pyab benchmark --source=$LOCAL_EXECUTABLE --config=$CONFIG_PATH
52-
```
53-
54-
Example Usage with `uv`:
39+
# Source Benchmark from Docker Image:
40+
pyab benchmark --source=airbyte/source-hardcoded-records:latest --config='{count: 400_000}'
41+
pyab benchmark --source=airbyte/source-hardcoded-records:dev --config='{count: 400_000}'
5542
43+
# Destination Benchmark:
44+
pyab benchmark --destination=destination-dev-null --config=/path/to/config.json
5645
46+
# Benchmark a Local Python Source (source-s3):
47+
pyab benchmark --source=$(poetry run which source-s3) --config=./secrets/config.json
48+
# Equivalent to:
49+
LOCAL_EXECUTABLE=$(poetry run which source-s3)
50+
CONFIG_PATH=$(realpath ./secrets/config.json)
51+
pyab benchmark --source=$LOCAL_EXECUTABLE --config=$CONFIG_PATH
52+
```
5753
5854
Example `validate` Usage:
5955
60-
```
61-
pyab validate --connector=source-hardcoded-records
62-
pyab validate --connector=source-hardcoded-records --config='{count: 400_000}'
63-
```
56+
```bash
57+
pyab validate --connector=source-hardcoded-records
58+
pyab validate --connector=source-hardcoded-records --config='{count: 400_000}'
59+
```
6460
"""
6561

6662
from __future__ import annotations
@@ -322,7 +318,7 @@ def validate(
322318
config: str | None = None,
323319
pip_url: str | None = None,
324320
) -> None:
325-
"""Validate the connector."""
321+
"""CLI command to run a `benchmark` operation."""
326322
if not connector:
327323
raise PyAirbyteInputError(
328324
message="No connector provided.",
@@ -403,7 +399,7 @@ def benchmark(
403399
destination: str | None = None,
404400
config: str | None = None,
405401
) -> None:
406-
"""Run benchmarks.
402+
"""CLI command to run a `benchmark` operation.
407403
408404
You can provide either a source or a destination, but not both. If a destination is being
409405
benchmarked, you can use `--num-records` to specify the number of records to generate for the
@@ -506,7 +502,7 @@ def sync(
506502
destination_pip_url: str | None = None,
507503
streams: str | None = None,
508504
) -> None:
509-
"""Run a sync operation.
505+
"""CLI command to run a `sync` operation.
510506
511507
Currently, this only supports full refresh syncs. Incremental syncs are not yet supported.
512508
Custom catalog syncs are not yet supported.
@@ -536,7 +532,7 @@ def sync(
536532

537533
@click.group()
538534
def cli() -> None:
539-
"""PyAirbyte CLI."""
535+
"""@private PyAirbyte CLI."""
540536
pass
541537

542538

0 commit comments

Comments
 (0)