Skip to content

Commit f3bc4c6

Browse files
authored
Feat: Add pip_url support in CLI (#416)
1 parent 919a812 commit f3bc4c6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

airbyte/cli.py

+21
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ def _resolve_source_job(
177177
source: str | None = None,
178178
config: str | None = None,
179179
streams: str | None = None,
180+
pip_url: str | None = None,
180181
) -> Source:
181182
"""Resolve the source job into a configured Source object.
182183
@@ -187,6 +188,7 @@ def _resolve_source_job(
187188
config: The path to a configuration file for the named source or destination.
188189
streams: A comma-separated list of stream names to select for reading. If set to "*",
189190
all streams will be selected. If not provided, all streams will be selected.
191+
pip_url: Optional. A location from which to install the connector.
190192
"""
191193
config_dict = _resolve_config(config) if config else None
192194
streams_list: str | list[str] = streams or "*"
@@ -200,6 +202,7 @@ def _resolve_source_job(
200202
docker_image=source,
201203
config=config_dict,
202204
streams=streams_list,
205+
pip_url=pip_url,
203206
)
204207
return source_obj
205208

@@ -218,6 +221,7 @@ def _resolve_source_job(
218221
local_executable=source_executable,
219222
config=config_dict,
220223
streams=streams_list,
224+
pip_url=pip_url,
221225
)
222226
return source_obj
223227

@@ -233,13 +237,15 @@ def _resolve_source_job(
233237
name=source_name,
234238
config=config_dict,
235239
streams=streams_list,
240+
pip_url=pip_url,
236241
)
237242

238243

239244
def _resolve_destination_job(
240245
*,
241246
destination: str,
242247
config: str | None = None,
248+
pip_url: str | None = None,
243249
) -> Destination:
244250
"""Resolve the destination job into a configured Destination object.
245251
@@ -249,6 +255,7 @@ def _resolve_destination_job(
249255
If the destination contains a colon (':'), it will be interpreted as a docker image
250256
and tag.
251257
config: The path to a configuration file for the named source or destination.
258+
pip_url: Optional. A location from which to install the connector.
252259
"""
253260
if not config:
254261
raise PyAirbyteInputError(
@@ -271,13 +278,15 @@ def _resolve_destination_job(
271278
name=destination_executable.stem,
272279
local_executable=destination_executable,
273280
config=config_dict,
281+
pip_url=pip_url,
274282
)
275283

276284
# else: # Treat the destination as a name.
277285

278286
return get_destination(
279287
name=destination,
280288
config=config_dict,
289+
pip_url=pip_url,
281290
)
282291

283292

@@ -293,6 +302,15 @@ def _resolve_destination_job(
293302
type=str,
294303
help="The connector name or a path to the local executable.",
295304
)
305+
@click.option(
306+
"--pip-url",
307+
type=str,
308+
help=(
309+
"Optional. The location from which to install the connector. "
310+
"This can be a anything pip accepts, including: a PyPI package name, a local path, "
311+
"a git repository, a git branch ref, etc."
312+
),
313+
)
296314
@click.option(
297315
"--config",
298316
type=str,
@@ -302,6 +320,7 @@ def _resolve_destination_job(
302320
def validate(
303321
connector: str | None = None,
304322
config: str | None = None,
323+
pip_url: str | None = None,
305324
) -> None:
306325
"""Validate the connector."""
307326
if not connector:
@@ -315,11 +334,13 @@ def validate(
315334
source=connector,
316335
config=None,
317336
streams=None,
337+
pip_url=pip_url,
318338
)
319339
else: # destination
320340
connector_obj = _resolve_destination_job(
321341
destination=connector,
322342
config=None,
343+
pip_url=pip_url,
323344
)
324345

325346
print("Getting `spec` output from connector...")

0 commit comments

Comments
 (0)