Skip to main content

PyPI version shields.io PyPI pyversions

GHGA Connector

GHGA Connector - A CLI client application for interacting with the GHGA system.

Description

The GHGA Connector is a command line client facilitating interaction with the file storage infrastructure of GHGA. To this end, it provides commands for the up- and download of files that interact with the RESTful APIs exposed by the Upload Controller Service (https://github.com/ghga-de/ghga/tree/main/services/ucs) and Download Controller Service (https://github.com/ghga-de/ghga/tree/main/services/dcs), respectively.

When uploading, the Connector expects an unencrypted file that is subsequently encrypted according to the Crypt4GH standard (https://www.ga4gh.org/news_item/crypt4gh-a-secure-method-for-sharing-human-genetic-data/) and only afterwards uploaded to the GHGA storage infrastructure.

When downloading, the resulting file is still encrypted in this manner and can be decrypted using the Connector's decrypt command. As the user is expected to download multiple files, this command takes a directory location as input and an optional output directory location can be provided, creating the directory if it does not yet exist (defaulting to the current working directory, if none is provided).

Most of the commands need the submitter's private key that matches the public key announced to GHGA. The private key is used for file encryption in the upload path and decryption of the work package access and work order tokens during download. Additionally, the decrypt command needs the private key to decrypt the downloaded file. If the private key is protected by a passphrase, the Connector prompts for it interactively (up to three attempts). The passphrase cannot be supplied via configuration.

Installation

We recommend installing the latest version of the GHGA Connector using pip:

pip install -U ghga-connector

To run it from a checkout of this repository instead:

# Execute in the repo's root dir:
uv run ghga-connector --help

Configuration

Parameters

The Connector accepts the following configuration parameters:

  • client_exponential_backoff_max (integer): Maximum number of seconds to wait between retries when using exponential backoff retry strategies. The client timeout might need to be adjusted accordingly. Minimum: 0. Default: 60.
  • client_num_retries (integer): Total number of attempts made per API call, so a value of 1 means no retries. Uploads are long-lived and cross the public internet, so the Connector allows more attempts than the service default. Minimum: 0. Default: 5.
  • client_retry_status_codes (array): List of status codes that should trigger retrying a request. Default: [408, 429, 500, 502, 503, 504].
    • Items (integer): Minimum: 0.
  • client_reraise_from_retry_error (boolean): Specifies if the exception wrapped in the final RetryError is reraised or the RetryError is returned as is. Default: true.
  • per_request_jitter (number): Max amount of jitter (in seconds) to add to each request. Minimum: 0. Default: 0.0.
  • retry_after_applicable_for_num_requests (integer): Amount of requests after which the stored delay from a 429 response is ignored again. Can be useful to adjust if concurrent requests are fired in quick succession. Exclusive minimum: 0. Default: 1.
  • max_concurrent_downloads (integer): Number of parallel download tasks for file parts. Exclusive minimum: 0. Default: 5.
  • max_concurrent_uploads (integer): Number of parallel upload tasks for file parts. Exclusive minimum: 0. Default: 5.
  • max_wait_time (integer): Maximum time in seconds to wait before quitting without a download. Exclusive minimum: 0. Default: 3600.
  • part_size (integer): The part size to use for download. Exclusive minimum: 0. Default: 67108864.
  • wkvs_api_url (string): URL to the root of the WKVS API. Should start with https://. Default: "https://data.ghga.de/.well-known".

Usage:

A template YAML file for configuring the Connector can be found at ./example_config.yaml. Please adapt it, rename it to .ghga_connector.yaml, and place it in one of the following locations:

  • in the current working directory where you run the Connector (on Linux: ./.ghga_connector.yaml)
  • in your home directory (on Linux: ~/.ghga_connector.yaml)

The config YAML file will be automatically parsed by the Connector.

All parameters mentioned in the ./example_config.yaml can also be set using environment variables or file secrets.

For naming the environment variables, just prefix the parameter name with ghga_connector_, e.g. for the host set an environment variable named ghga_connector_host (you may use both upper or lower cases, however, it is standard to define all env variables in upper cases).

To use file secrets, please refer to the corresponding section of the pydantic documentation.

Architecture and Design:

This is a Python-based client enabling interaction with GHGA's file services. Contrary to the design of the actual services, the client does not follow the triple-hexagonal architecture. The client is roughly structured into three parts:

  1. A command line interface using typer is provided at the highest level of the package, i.e. directly within the ghga_connector directory.
  2. Functionality dealing with intermediate transformations, delegating work and handling state is provided within the core module.
  3. core.api_calls provides abstractions over S3 and work package service interactions.

Development

This package is a member of the GHGA monorepo and is developed from the repository root rather than on its own. The repository ships a devcontainer with the whole toolchain: open it in VS Code and run Remote-Containers: Reopen in Container, or set the environment up directly with just sync.

The usual tasks, run from the repository root (see ADR-0015 for the full recipe list):

just sync                        # install every member plus the shared dev toolchain
just test tools/ghga-connector   # this member's test suite
just lint                        # ruff check + format check across the workspace

License

This repository is free to use and modify according to the Apache 2.0 License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ghga_connector-4.0.0.tar.gz (60.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ghga_connector-4.0.0-py3-none-any.whl (83.3 kB view details)

Uploaded Python 3

File details

Details for the file ghga_connector-4.0.0.tar.gz.

File metadata

  • Download URL: ghga_connector-4.0.0.tar.gz
  • Upload date:
  • Size: 60.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ghga_connector-4.0.0.tar.gz
Algorithm Hash digest
SHA256 84803e35dd7fabd60b3c950cf77384a4cb9d5125cb2a5cac46eda0432d394fc9
MD5 370a5d7042626e39d6ada008bfaf0eea
BLAKE2b-256 3740aec2d5a3db02c93aa399e3c56a098829a77d18b15f469fa1bae05b3e96e7

See more details on using hashes here.

File details

Details for the file ghga_connector-4.0.0-py3-none-any.whl.

File metadata

  • Download URL: ghga_connector-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 83.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ghga_connector-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 545106799bf2e16daf5dca81fd8aa7f8c47340ae719b3c0832528c9a07f0f027
MD5 a8a12fd15be0062e531d8c18e3c7161e
BLAKE2b-256 2dc4ea2312edeba3569d0e1b0a91e79f4aaa61c050ada761c82312a02c1d6f73

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

4.0.0 This release

2 files

3.1.1

2 files

3.1.0

2 files

3.0.2

2 files

3.0.1

2 files

3.0.0

2 files

2.1.1

2 files

2.1.0

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

2.0.0rc1

2 files

1.8.0

2 files

1.7.3

2 files

1.7.2

2 files

1.7.1

2 files

1.7.0

2 files

1.6.0

2 files

1.5.1

2 files

1.5.0

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.0

2 files

1.2.1

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.0

2 files

0.3.14

2 files

0.3.13

2 files

0.3.12

2 files

0.3.11

2 files

0.3.10

2 files

0.3.9

2 files

0.3.8

2 files

0.3.7

2 files

0.3.6

2 files

0.3.5

2 files

0.3.3

2 files

0.2.12

2 files

0.2.11

2 files

0.2.10

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.1.4

2 files

0.1.3

2 files

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