Custom CLIs#


By default, packages created with the Singer SDK will have a single command, e.g. tap-my-source, which will run the application in a Singer-compatible way. However, you may want to add additional commands to your package. For example, you may want to add a command to initialize the database or platform with certain attributes required by the application to run properly.

Adding a custom command#

To add a custom command, you will need to add a new method to your plugin class that returns an instance of click.Command (or a subclass of it) and decorate it with the singer_sdk.cli.plugin_cli decorator. Then you will need to add the command to the [tool.poetry.scripts] section of your pyproject.toml file.

# tap_shortcut/

class ShortcutTap(Tap):
    """Shortcut tap class."""

    def update_schema(cls) -> click.Command:
        """Update the OpenAPI schema for this tap."""
        def update():
            response = requests.get(
            with Path("tap_shortcut/openapi.json").open("w") as f:

        return update
# pyproject.toml

tap-shortcut = "tap_shortcut.tap:ShortcutTap.cli"
tap-shortcut-update-schema = "tap_shortcut.tap:ShortcutTap.update_schema"