Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

gbatchkit-python

Google Cloud Platform Batch Kit (GBK)

Why GBatchKit?

GCP Batch is a powerful serverless computing platform. gbatchkit provides lightweight tools to use Batch more effectively.

Key features:

  • Create a straightforward job easily. This will run my-script.py in the given container on Batch.

    container_uri = "container_uri"
    runnable = ContainerRunnable(
      image_uri=container_uri,
      entrypoint="python",
      commands=["my-script.py"]
    )
    task_count = 1
    job = create_standard_job(region, compute_config, task_count, [runnable])
    submit_job(job, "my_unique_job_id", region)
    
    • Also supports:
      • Customize the service_account and network_interface used to run the job.
      • Allocate a persistent disk for temp files.
      • Add dependency to other jobs (GCP Batch public preview feature).
  • Create multi-task jobs (for one or multiple runnables).

    • Uses Google Cloud Storage to store task arguments.
    task_arguments = [{"a": 1, "b": 2}, {"a": 3, "b": 4}]
    job = create_standard_job(region, compute_config, len(task_arguments), runnable)
    working_directory = "gs://a-bucket/a-directory/jobs"
    prepare_multitask_job(job, working_directory, tasks=task_arguments)
    submit_job(job, "my_unique_job_id", region)
    
    • Supports different arguments per runnable. In this example, the 1st runnable python script takes arguments a and b and the second runnable python script takes arguments c and d. Note that Batch requires all runnables to have the same number of tasks.

      container_uri = "container_uri"
      runnable1 = ContainerRunnable(
        image_uri=container_uri,
        entrypoint="python",
        commands=["script1.py"]
      )
      runnable2 = ContainerRunnable(
        image_uri=container_uri,
        entrypoint="python",
        commands=["script2.py"]
      )
      task_arguments = [
        [{"a": 1, "b": 2}, {"a": 3, "b": 4}],
        [{"c": 1, "d": 2}, {"c": 3, "d": 4}],
      ]
      
      job = create_standard_job(region, compute_config, task_count=2, runnables=[runnable1, runnable2])
      working_directory = "gs://a-bucket/a-directory/jobs"
      prepare_multitask_job(job, working_directory, tasks=task_arguments)
      
      submit_job(job, "my_unique_job_id", region)
      

Authentication & In-Memory Credentials

By default, functions in gbatchkit fall back to Application Default Credentials (ADC).

For environments where credentials are held in memory (such as web servers handling per-session credentials), you can pass an explicit credentials argument to submit_job, prepare_multitask_job, write_tasks, or get_task_arguments.

The credentials parameter accepts either a google.auth.credentials.Credentials object or a raw parsed JSON dictionary (e.g. from a service account key file).

# In-memory service account credentials JSON dict
credentials_json = {
    "type": "service_account",
    "project_id": "my-project",
    "private_key_id": "...",
    "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
    "client_email": "service-account@my-project.iam.gserviceaccount.com",
    "client_id": "...",
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://oauth2.googleapis.com/token",
}

# The credential drives both GCP Batch job submission and GCS task-file I/O
prepare_multitask_job(
    job,
    working_directory="gs://a-bucket/jobs",
    tasks=task_arguments,
    credentials=credentials_json,
)

submit_job(
    job,
    job_id="my_unique_job_id",
    region=region,
    credentials=credentials_json,
)

Metadata

Release files for gbatchkit 1.0a11

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

Source distribution (sdist)

Source distribution for gbatchkit 1.0a11
File Size Uploaded Provenance Actions
gbatchkit-1.0a11.tar.gz 11.6 kB With provenance Details for gbatchkit-1.0a11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gbatchkit 1.0a11
File Interpreter ABI Platform Actions
gbatchkit-1.0a11-py3-none-any.whl Python 3 none any Details for gbatchkit-1.0a11-py3-none-any.whl

Total release size: 22.6 kB

Release files / gbatchkit-1.0a11.tar.gz

Download URL gbatchkit-1.0a11.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bca9359bb23f7738c08d6ce4ff36dafb99aa9572df6522b53b225533c47d370d
BLAKE2b-256 checksum
How to use checksums
45b4d0a05be4a46990268cc22ead63a75702ddf763a7a32f1802e3dce5c4c7b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release files / gbatchkit-1.0a11-py3-none-any.whl

Download URL gbatchkit-1.0a11-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f7244397a8b3cd95d3cd0d7f2349ad1f19d0640c5683deedb521df00f71bcdb
BLAKE2b-256 checksum
How to use checksums
67fa97a7c2f176ad12b522331a5b26fb472bdf5f764daf0cc187a46520925149
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Security for gbatchkit 1.0a11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gbatchkit-1.0a11.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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