diff --git a/Dockerfile b/Dockerfile index d2bce875d..1a3e19bee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ COPY dist/*.whl ./dist/ RUN poetry config virtualenvs.create false \ && poetry install --only main --no-interaction --no-ansi || true -# Build and install the package +# Install source-declarative-manifest CLI and its dependencies RUN pip install dist/*.whl # Recreate the original structure @@ -33,7 +33,7 @@ RUN rm -rf dist/ pyproject.toml poetry.lock README.md # Set ownership of /airbyte to the non-root airbyte user and group (1000:1000) RUN chown -R 1000:1000 /airbyte -# Set the entrypoint -ENV AIRBYTE_ENTRYPOINT="python /airbyte/integration_code/main.py" -ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] +# Set the entrypoint to use the source-declarative-manifest CLI +ENV AIRBYTE_ENTRYPOINT="source-declarative-manifest" +ENTRYPOINT ["source-declarative-manifest"] USER airbyte diff --git a/airbyte_cdk/cli/README.md b/airbyte_cdk/cli/README.md new file mode 100644 index 000000000..0943ebf8e --- /dev/null +++ b/airbyte_cdk/cli/README.md @@ -0,0 +1,63 @@ +# Source Declarative Manifest CLI Usage Guide + +This guide explains how to install and use the Source Declarative Manifest (SDM) CLI tool for Airbyte connector development. + +## Installation + +### Standard Installation + +```bash +pipx install airbyte-cdk +``` + +If you encounter an error related to a missing `distutils` module, verify that you are running Python version `<=3.11` and try running: + +```bash +python -m pipx install airbyte-cdk +``` + +## Using the CLI + +The SDM CLI follows standard Airbyte connector command patterns: + +```bash +source-declarative-manifest [command] --config /path/to/config.json +``` + +Where [command] can be: + +spec - Show connector specification +check - Verify connection to the source +discover - List available streams +read - Read data from streams + +:::caution +When developing locally (outside a Docker container), the CLI operates in "remote manifest mode" and expects your manifest to be included in your configuration file. +::: + +### Steps for Local Testing + +1. Convert your manifest from YAML to JSON + +Your manifest is defined in YAML, but must be converted to JSON for the config file. You can use an [online tool](https://onlineyamltools.com/convert-yaml-to-json) to do so. + +Create a config file that includes both your config parameters AND the manifest. Add your entire manifest as a JSON object under the `__injected_declarative_manifest` key + +Example: + +```json +{ + "api_key": "very_secret_key", + "start_time": "04:20", + "__injected_declarative_manifest": { + // Insert the JSON version of your manifest here + } +} +``` + +2. Run the command against your config file + +```bash +source-declarative-manifest check --config /relative/path/to/config.json +source-declarative-manifest read --config /relative/path/to/config.json --catalog /relative/path/to/catalog.json +```