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}")
Metadata
Release files for junban 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| junban-1.0.3.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| junban-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.6 kB
Release files / junban-1.0.3.tar.gz
| Download URL | junban-1.0.3.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d3affda7063faedc8de95682376030d7f0b872f8dd17bfc10f123718c627204
|
|
BLAKE2b-256 checksum How to use checksums |
ce6d38edb629286f07537a824290bf833bef9cb2e17915fb73c2c026ce78559a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / junban-1.0.3-py3-none-any.whl
| Download URL | junban-1.0.3-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60e0758f8861e7437b4e2313dd48ac79bfcdd8b2438d0c3a0cac7b1fff49e6a7
|
|
BLAKE2b-256 checksum How to use checksums |
8b26325b784e23a4a7effb22c212bf39eb255db826fcbe2a831e84f7545df431
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|