-
Notifications
You must be signed in to change notification settings - Fork 30
feat: add airbyte-cdk
CLI with support for: connector test
, secrets fetch
and --version
#493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…d for classes starting with "Test"
/autofix
|
/poetry-lock
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
APPROVED
/poetry-lock
|
Overview
This PR makes the CDK a true "developer kit" and not just a library.
Simple functions can be performed directly from the new
airbyte-cdk
CLI, starting with:airbyte-cdk --help
- Print usage info and exit.airbyte-cdk --version
- Print the CDK version and exit.airbyte-cdk connector test
- Test the connector using the new FAST Airbyte Standard Tests framework. (No stub file required, and connector type is autodetected frommetadata.yaml
.)airbyte-cdk secrets fetch
- Fetch the secrets for a given connector into the connector'ssecrets
directory (e.g.source-s3/secrets
for the S3 source.(Each command group and command also support
--help
.)CLI Screenshot:
--help
Loom Demo
https://www.loom.com/share/970666990f564eed8dda8e089cfbe6df?sid=798c51df-73a5-44d6-b3be-6e9c64872931
Future Work (Not in Scope Here)
In a future iteration, I'm planning to add
--docker-image
support withinconnector test
command. This would run all of the FAST Standard tests against the docker image, rather than using the local python environment. (This is mostly useful in CI to ensure the image is healthy, or for Java/Kotlin connectors.)I also added stubs for
manifest
andimage
command groups, which I expect we may want to populate in the future with something like...:airbyte-cdk image build
(in progress here: feat(cli): Addimage build
command toairbyte-cdk
CLI #489)airbyte-cdk manifest validate
airbyte-cdk manifest test-read
How many CLI entrypoints would we have after this?
I think the goal is to have exactly 2 CLI entrypoints:
source-declarative-manifest
- this is literally howsource-declarative-manifest
is invoked as a connector and it lives in the CDK.airbyte-cdk
- This is the new "dev tools" CLI - and we can put all manner of dev-related tools in here as needed. This should replace the more fragile and awkwardpython -m ....
-based invocations. By structuring under command groups (secrets
,manifest
,connector
, etc.), we can avoid needing multiple entrypoints for different purposes.How is this invoked?
There are three invocation patterns:
pipx run airbyte-cdk ...
oruvx airbyte-cdk ...
. This doesn't require a pre-install and it uses the latest version by default.poetry run airbyte-cdk ...
. This uses exactly the version of the CDK that you have in your dev environment, and it runs directly within your venv. When you bump the CDK version in your project, you also bump the CDK CLI version.pipx install airbyte-cdk
oruv tool install airbyte-cdk
allows you to just invoke directly with no prefix:airbyte-cdk ...
. If you use this method, you just have to ensure you remember to upgrade occassionally.Why choose
airbyte-cdk
as the name of the CLI entrypoint?There are really two main reasons I arrived on using the
airbyte-cdk
name:First, the name aligns exactly with the functions it delivers: these are the "connector developer kit" actions that are needed by developers during development.
Second, by aligning the name of the CLI with the name of the package, we get a much more concise stateless invocation when running with
pipx
oruvx
.When names don't match, you end up having to type both the package name and the CLI name like this (using
--from
or--spec
):But because the CLI name matches the package name, we can use this much more concise shorthand, where the package name and CLI name are one and the same:
Summary by CodeRabbit
.tmp
to.gitignore
to exclude temporary files.