Skip to main content

Qontract Development CLI

PyPI Python Version from PEP 621 TOML PyPI - License

Qontract Development CLI supports your daily qontract-reconcile development work.

The recommended way to install qontract-development-cli is to use the uv tool:

uv tool install qontract-development-cli

and upgrade an existing installation with:

uv tool upgrade qontract-development-cli

Alternative Installation Methods

You can install this library from PyPI with pip:

python3 -m pip install qontract-development-cli

or install it with pipx:

pipx install qontract-development-cli

and upgrade an existing installation with:

pipx upgrade qontract-development-cli

Quickstart

  • Create initial configuration

    qd config init
    

    qd init

  • Create a profile sql-query to run the sql-query integration

    qd profile create sql-query
    

    qd profile create

  • Run sql-query profile

    qd profile run dev sql-query
    

    qd sql_query

Features

Qontract Development CLI currently provides the following features (get help with -h or --help):

  • Run qontract-reconcile and qontract-server as docker containers on your local machine
  • Support for different App-Interface environments (dev, prod, ...) via the env command
  • Configure your qontract-reconcile integration with the profile command
  • Support pull request reviews (see profile create)
  • Bootstrap your initial configurations with the config command
  • Shell auto-completion (see qd --help)
  • Automatically restart qontract-reconcile container when files change
  • Automatically rebuild the App-Interface bundle and restart the qontract-server container when files change

Examples

Take a look at the examples directory for different profile examples.

Usage

The following sections describe all available commands, their options and use-cases.

Let your coding agent check an integration

Your coding agent can set up qd and check integrations against real configuration using your local code—without attaching an IDE debugger or watching logs yourself.

Enable agent support once:

qd agentic skill-install

Then ask your agent:

Help me set up qd for local integration development.

Or, when you're ready to test:

Use qd to dry-run automated-actions-config and summarize the results.

The agent asks for missing details and your approval, then reviews the complete output and reports failures or gaps in coverage.

Config

Manage global qontract-development-cli configuration.

qd config [sub-cmd] --help

  • edit: open the configuration file in your favorite editor
  • init: create a default configuration

Global Settings

Key Description Default
debug Enable/disable debug mode false
defaults_profile Name of defaults profile defaults
docker_compose_project_name Docker compose project name qontract-development
editor Your favorite editor $EDITOR or vim
environments_dir Directory to store environment files User config directory / environments
profiles_dir Directory to store profile files User config directory / profiles
worktrees_dir Directory to store git repo worktrees User cache directory / worktrees

Environments

An environment specifies app-interface instance settings, e.g., dev vs. prod config and path to the actual app-interface instance.

qd env [sub-cmd] --help

  • edit: Create/edit an environment file in your editor.
  • ls: List all available environments.
  • rm: Remove environment.
  • show: Display environment.

Environment Settings

Key Description Default
app_interface_path Path to local app-interface instance ~/workspace/app-interface
app_interface_state_bucket S3 bucket empty
app_interface_state_bucket_account AWS S3 account empty
config app-interface config ~/workspace/qontract-reconcile/config.dev.toml
container_platform Default Docker container platform for all images linux/amd64
gitlab_pr_submitter_queue_url Gitlab pr submitter queue url
run_qontract_api Run qontract-api container false
run_qontract_api_subscriber Run qontract-api-subscriber container false
run_qontract_api_worker Run qontract-api-worker container false
run_cache Run cache (Redis) container false
run_qontract_reconcile Run qontract-reconcile container true
run_qontract_server Run qontract-server container true
run_vault Run vault container false

👉 Bold keys are mandatory or should be customized.

Profiles

A profile specifies all settings to run a qontract-reconcile integration (e.g., sql-query).

qd profile [sub-cmd] --help

  • create: Create a new profile to run an integration.

    Supports the creation of a new profile from an open PR/MR. See $ qd profile create --help for all available options.

  • edit: Edit a profile in your editor.

  • ls: List all available profiles.

  • rm: Remove profile.

  • run: Run a profile.

  • show: Display profile.

For a non-interactive check, use --headless --output-dir PATH. qd starts the full configured stack, records the integration's output and exit status, then stops the whole stack. This replaces any running qd stack; volumes are retained. Images are reused. Use --force-rebuild when dependencies changed or images have not been built yet.

Use --no-skip-initial-make-bundle to refresh the bundle even when the profile normally skips it; the saved profile remains unchanged.

additional_environment intentionally allows overriding generated runtime settings, including DRY_RUN, MANAGER_DRY_RUN, RUN_ONCE, and DEBUGGER, even in headless mode. These overrides take precedence over the corresponding profile settings; headless dry-run and run-once settings are not guarantees when overridden.

--no-dry-run

By default, qd runs integrations in dry-run mode if not explicitly specified differently in the profile config. There is also a --no-dry-run flag which lets you disable dry-run mode from the command line.

qd profile run dev my-integration --no-dry-run

The command line flag takes precedence over any configuration you might have in the profile settings.

Profile Settings

Key Description Default
additional_environment Dictionary of additional environment variables to pass to the qontract-reconcile container {}
container_uid Change ownership of /recconcile files in container to this user id current UID
command Command to run in the qontract-reconcile container. run-integration
command_extra_args Additional arguments to pass to the command.
debugger Python debugger debugpy
dry_run Run --dry-run mode true
extra_hosts List of 'HOSTNAME:IP' mapping entries for qontract-reconcile /etc/hosts. See extra_hosts docker compose file. []
integration_name Intergration name
integration_extra_args Intergration extra arguments
internal_redhat_ca Inject Red Hat internal CAs and REQUESTS_CA_BUNDLE environment variable false
internal_redhat_ca_image The Red Hat internal CA image Internal one
internal_redhat_ca_container_platform The Red Hat internal CA container platform Default from environment
log_level Log level info
app_interface_path App-interface instance path. (Overrides env.app_interface_path)
app_interface_pr App-interface PR/MR number
app_interface_upstream Upstream remote name upstream
cache_image Cache (Redis) image redis:7-alpine
cache_container_platform Cache (Redis) container platform Default from environment
cache_compose_file Cache docker-compose file template cache.yml.j2
qontract_api_build_image Build qontract-api image true
qontract_api_image Qontract-api image quay.io/redhat-services-prod/.../qontract-api-master:latest
qontract_api_container_platform Qontract-api container platform Default from environment
qontract_api_compose_file Qontract-api docker-compose file template api.yml.j2
qontract_api_debugger_port Debugger port for qontract-api 5679
qontract_api_subscriber_build_image Build qontract-api-subscriber image true
qontract_api_subscriber_image Qontract-api-subscriber image quay.io/redhat-services-prod/.../qontract-api-master:latest
qontract_api_subscriber_container_platform Qontract-api-subscriber container platform Default from environment
qontract_api_subscriber_compose_file Qontract-api-subscriber docker-compose file template subscriber.yml.j2
qontract_api_subscriber_debugger_port Debugger port for qontract-api-subscriber 5681
qontract_api_worker_build_image Build qontract-api-worker image true
qontract_api_worker_image Qontract-api-worker image quay.io/redhat-services-prod/.../qontract-api-worker-master:latest
qontract_api_worker_container_platform Qontract-api-worker container platform Default from environment
qontract_api_worker_compose_file Qontract-api-worker docker-compose file template worker.yml.j2
qontract_api_worker_debugger_port Debugger port for qontract-api-worker 5680
qontract_reconcile_build_image Build qontract-reconcile image true
qontract_reconcile_image Qontract-reconcile image quay.io/redhat-services-prod/.../qontract-reconcile-master:latest
qontract_reconcile_container_platform Qontract-reconcile container platform Default from environment
qontract_reconcile_path Qontract-reconcile path ~/workspace/qontract-reconcile
qontract_reconcile_pr Qontract-reconcile PR/MR number
qontract_reconcile_upstream Upstream remote name upstream
qontract_reconcile_compose_file Qontract-reconcile docker-compose file template reconcile.yml.j2
qontract_reconcile_debugger_port Debugger port for qontract-reconcile 5678
qontract_server_build_image Build qontract-server image true
qontract_server_image Qontract-server image quay.io/redhat-services-prod/.../qontract-server-master:latest
qontract_server_container_platform Qontract-server container platform Default from environment
qontract_server_path Qontract-server path ~/workspace/qontract-server
qontract_server_compose_file Qontract-server docker-compose file template server.yml.j2
qontract_server_debugger_port Debugger port for qontract-server 6789
qontract_schemas_path Qontract-schemas path ~/workspace/qontract-schemas
qontract_schemas_pr Qontract-schemas PR/MR number
qontract_schemas_upstream Upstream remote name upstream
run_once If 'true', execute the integration once and exit true
sleep_duration_secs If not run_once, sleep duration until integration runs again 10
localstack Run localstack container and set AWS related environment variables false
localstack_compose_file Path to your Localstack docker-compose file qontract_reconcile_path / dev/localstack/docker-compose.yml
skip_initial_make_bundle Skip initial make bundle step false
vault_image Vault image vault:1.5.4
vault_container_platform Vault container platform Default from environment
vault_compose_file Vault docker-compose file template vault.yml.j2

👉 Bold keys are mandatory or should be customized.

Connecting your IDE to QR

Note that the Qontract Reconcile container will not start running until it is connected to by a debugger. You can use a config like this for VSCode:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python Debugger: Reconcile",
      "type": "debugpy",
      "request": "attach",
      "connect": { "host": "localhost", "port": 5678 },
      "pathMappings": [
        { "localRoot": "${workspaceFolder}", "remoteRoot": "/work" }
      ],
      "justMyCode": false,
      "autoReload": {
        "enable": true
      }
    },
    {
      "name": "Python Debugger: Api",
      "type": "debugpy",
      "request": "attach",
      "connect": { "host": "localhost", "port": 5679 },
      "pathMappings": [
        { "localRoot": "${workspaceFolder}", "remoteRoot": "/opt/app-root/src" }
      ],
      "justMyCode": false,
      "autoReload": {
        "enable": true
      }
    },
    {
      "name": "Python Debugger: Subscriber",
      "type": "debugpy",
      "request": "attach",
      "connect": { "host": "localhost", "port": 5681 },
      "pathMappings": [
        { "localRoot": "${workspaceFolder}", "remoteRoot": "/opt/app-root/src" }
      ],
      "justMyCode": true,
      "autoReload": {
        "enable": true
      }
    },
    {
      "name": "Python Debugger: Worker",
      "type": "debugpy",
      "request": "attach",
      "connect": { "host": "localhost", "port": 5680 },
      "pathMappings": [
        { "localRoot": "${workspaceFolder}", "remoteRoot": "/opt/app-root/src" }
      ],
      "justMyCode": true,
      "autoReload": {
        "enable": true
      }
    }
  ],
  "compounds": [
    {
      "name": "Debug: Reconcile + qontract-api",
      "configurations": [
        "Python Debugger: Reconcile",
        "Python Debugger: Api",
        "Python Debugger: Subscriber",
        "Python Debugger: Worker"
      ],
      "stopAll": true,
      "presentation": {
        "hidden": false,
        "group": "Full Stack",
        "order": 0
      }
    }
  ]
}

Please note that development does not currently work with PyCharm as debugpy is not yet supported. This issue is being tracked here

PR/MR support

It's a pretty handy feature to create a profile from a pull request (merge request). E.g.:

qd profile create --app-interface PATH_TO_YOUR_LOCAL/app-interface-dev-data --app-interface-pr NUMBER --qontract-schemas-pr NUMBER --qontract-reconcile-pr NUMBER --integration-name glitchtip --integration-extra-args '' glitchtip-pr-check

Which results in this profile:

$ qd profile show glitchtip-pr-check
---
app_interface_path: PATH_TO_YOUR_LOCAL/app-interface-dev-data
app_interface_pr: NUMBER
integration_name: glitchtip
qontract_reconcile_pr: NUMBER
qontract_schemas_pr: NUMBER

Running this profile will:

  • Create new git worktrees (see config.worktrees_dir) for app-interface-dev-data, qontract-schema, and qontract-reconcile PRs
  • Start the containers with the adapted path to these worktrees
  • Restarting the profile will fetch PR updates

👉 A git worktree cleanup isn't implemented yet

Development

Ruff Checked with mypy

Release

  • Bump the version in pyproject.toml
  • Update the CHANGELOG.md
  • Commit the changes

Metadata

Release files for qontract-development-cli 0.20.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qontract-development-cli 0.20.0
File Size Uploaded
qontract_development_cli-0.20.0.tar.gz 38.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qontract-development-cli 0.20.0
File Interpreter ABI Platform
qontract_development_cli-0.20.0-py3-none-any.whl Python 3 none any Details

Total release size: 85.9 kB

Release files / qontract_development_cli-0.20.0.tar.gz

Download URL qontract_development_cli-0.20.0.tar.gz
Size 38.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9488b281de85ad7a70924964ccc3d9e48c72c3a7e3c4fcaaa1de25594b4e545a
BLAKE2b-256 checksum
How to use checksums
9a4dd5be19ff42bae0ab32d6b1ff1ef09246ebd7381e50dac3a0f3f416d9b12f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Red Hat Enterprise Linux","version":"10.2","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / qontract_development_cli-0.20.0-py3-none-any.whl

Download URL qontract_development_cli-0.20.0-py3-none-any.whl
Size 47.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a381ee7a88a4c8516f6908eca183d10e078880a0b459b7b5dceb00025e60183e
BLAKE2b-256 checksum
How to use checksums
837641a1c516b5b530c05fc84f99d3e9f6e35060e9e0f3fd7f3f563a2d3dd5b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Red Hat Enterprise Linux","version":"10.2","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page