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.0a10

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.0a10
File Size Uploaded Provenance Actions
gbatchkit-1.0a10.tar.gz 11.3 kB With provenance Details for gbatchkit-1.0a10.tar.gz

Built distribution (wheel)

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

Total release size: 21.9 kB

Release files / gbatchkit-1.0a10.tar.gz

Download URL gbatchkit-1.0a10.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
729144d404f45ea6d3ee76310eecbe65bdf71ff8726e8b36746fd678fcb90e5f
BLAKE2b-256 checksum
How to use checksums
80f93541e00c50db827a040d09b467b84f2a1a7ca812001bf35b3845a73d9e2f
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 2, 2026.

Transparency log

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

Download URL gbatchkit-1.0a10-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a76e37b954f6ef36e6bbdd0a6567612e8f4c5475fa43dd4bdb4f29eb3f1b5a27
BLAKE2b-256 checksum
How to use checksums
588c2fb78e770af36282ad39a6441dbfaa8f7e1062318d8a9976dbae9b9fa18a
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 2, 2026.

Transparency log

Security for gbatchkit 1.0a10

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.0a10.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 2, 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