Skip to main content

Junban (順番) – Simple Sequential Python Workflows

Junban (english: order) is a lightweight library for defining and executing sequential (scientific) workflows in Python.

Installation

Junban is available via pypi:

pip install junban

Quick Example

Here is a simple example showing how to define a context and two steps. It showcases how context is passed between steps and how entry/exit assumptions (verification) are handled.

from dataclasses import dataclass
from junban.pipeline import Pipeline
from junban.pipeline_step import PipelineStep
from junban.pipeline_context import PipelineContext


# 1. Define your context by inheriting from PipelineContext
@dataclass
class MyContext(PipelineContext):
    value: int = 0
    is_processed: bool = False


# 2. Create pipeline steps by inheriting from PipelineStep
class IncrementStep(PipelineStep[MyContext]):
    def _check_entry_assumptions(self, context: MyContext) -> bool:
        # Verification before step execution
        return context.value == 0

    def _execute(self, context: MyContext) -> MyContext:
        # Core logic of the step
        context.value += 1
        return context

    def _check_exit_assumptions(self, context: MyContext) -> bool:
        # Verification after step execution
        return context.value == 1

    def get_start_message(self) -> str:
        return "Incrementing value..."

    def get_end_message(self) -> str:
        return "Value incremented."


class ProcessStep(PipelineStep[MyContext]):
    def _check_entry_assumptions(self, context: MyContext) -> bool:
        return context.value > 0

    def _execute(self, context: MyContext) -> MyContext:
        context.is_processed = True
        return context

    def _check_exit_assumptions(self, context: MyContext) -> bool:
        return context.is_processed is True

    def get_start_message(self) -> str:
        return "Processing..."

    def get_end_message(self) -> str:
        return "Processed."


# 3. Initialize and execute the pipeline
if __name__ == "__main__":
    context = MyContext()
    pipeline = Pipeline(
        steps=[IncrementStep(), ProcessStep()],
        name="ExamplePipeline"
    )

    final_context = pipeline.execute(context)
    print(f"Final value: {final_context.value}, Processed: {final_context.is_processed}")

Download files

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

Source Distribution

junban-1.0.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

junban-1.0.3-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file junban-1.0.3.tar.gz.

File metadata

  • Download URL: junban-1.0.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for junban-1.0.3.tar.gz
Algorithm Hash digest
SHA256 3d3affda7063faedc8de95682376030d7f0b872f8dd17bfc10f123718c627204
MD5 b8486e8c341358ee32a8ec6f010ec12f
BLAKE2b-256 ce6d38edb629286f07537a824290bf833bef9cb2e17915fb73c2c026ce78559a

See more details on using hashes here.

File details

Details for the file junban-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: junban-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for junban-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 60e0758f8861e7437b4e2313dd48ac79bfcdd8b2438d0c3a0cac7b1fff49e6a7
MD5 c82da158fc431ab6b715b97955233ea9
BLAKE2b-256 8b26325b784e23a4a7effb22c212bf39eb255db826fcbe2a831e84f7545df431

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page