Skip to content

bsubio/bsubio-python

Repository files navigation

bsubio-python (beta)

Python SDK for bsub.io — zero-setup batch execution for compute-intensive workloads.

No infrastructure management. No setup headaches. Just submit your files and retrieve results.

Perfect for:

  • 📄 PDF extraction — pull text and data from documents
  • 🎬 Video transcoding — convert media formats at scale
  • 🎤 Audio transcription — speech to text
  • 🖼️ Image processing — resize, convert, optimize
  • ...and any other compute-heavy tasks you can throw at it!

Quick Start

Installation

pip install bsubio

That's it! No infrastructure to configure, no servers to manage.

Basic Usage

import os
import bsubio

# Configure with your API key (grab it from https://app.bsub.io)
config = bsubio.Configuration(
    access_token=os.environ["BSUB_API_KEY"]
)

# Create a client and start submitting jobs!
with bsubio.ApiClient(config) as client:
    jobs_api = bsubio.JobsApi(client)

    # Create a job
    job = jobs_api.create_job({
        "type": "pdf-extract",
        "name": "Extract invoice data"
    })

    # Upload your file
    jobs_api.upload_job_data(job.id, file=open("invoice.pdf", "rb"))

    # Submit for processing
    jobs_api.submit_job(job.id)

    # Check status
    status = jobs_api.get_job(job.id)
    print(f"Job status: {status.state}")

    # Get results when ready
    if status.state == "finished":
        output = jobs_api.get_job_output(job.id)
        print(output)

That's the entire workflow. Create → Upload → Submit → Retrieve. No queues to manage, no workers to provision.

How It Works

bsub.io handles the heavy lifting:

  1. Create a job with POST /v1/jobs — get back a job ID and upload token
  2. Upload your data with POST /v1/upload/{jobId} — send files for processing
  3. Submit for processing with POST /v1/jobs/{jobId}/submit — kick off the work
  4. Monitor status with GET /v1/jobs/{jobId} — track progress
  5. Retrieve results with GET /v1/jobs/{jobId}/output — get your output

Job States

Your job progresses through these states:

  • created → Job created, awaiting upload
  • loaded → Data uploaded successfully
  • pending → Waiting in queue
  • processing → Work in progress
  • finished → All done!
  • failed → Something went wrong (check logs)

Authentication

Get your API key from the bsub.io dashboard and pass it as a Bearer token:

config = bsubio.Configuration(
    access_token="your-api-key-here"
)

Requirements

  • Python 3.9+
  • That's it!

API Reference

All URIs are relative to https://app.bsub.io

Endpoints

Class Method HTTP request Description
JobsApi cancel_job POST /v1/jobs/{jobId}/cancel Cancel a job
JobsApi create_job POST /v1/jobs Create a new job
JobsApi delete_job DELETE /v1/jobs/{jobId} Delete a job
JobsApi get_job GET /v1/jobs/{jobId} Get job details
JobsApi list_jobs GET /v1/jobs List jobs
JobsApi submit_job POST /v1/jobs/{jobId}/submit Submit job for processing
JobsApi upload_job_data POST /v1/upload/{jobId} Upload data to a job
OutputApi get_job_logs GET /v1/jobs/{jobId}/logs Get job logs (stderr)
OutputApi get_job_output GET /v1/jobs/{jobId}/output Get job output (stdout)
SystemApi get_types GET /v1/types Get available processing types
SystemApi get_version GET /v1/version Get API version

Models

Additional Info

Generated SDK

This Python SDK is automatically generated from the bsub.io OpenAPI spec using OpenAPI Generator.

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Development

Want to run tests?

pytest

Alternative installation from source:

pip install git+https://github.com/bsubio/bsubio-python.git

Get Help

Author

Adam Koszek Email: contact@bsub.io Web: bsub.io

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors