Caliber Documentation

website·Indexed 30 days ago

https://multiconsult-group.github.io/caliber/

A Python package for managing workflows, processes, and tasks. Caliber provides tools for workflow orchestration, including a command line interface (CLI), global data object management, and Speckle integration via classes like SpeckleWorkflow and SpeckleTask. It supports Python 3.10 through 3.13.

Tokens
13.2K
Snippets
86
Records
113
Agent score
75%

What's inside Caliber

  1. Overview of Caliber engineering workflow package

    Caliber is a Python package used to create and run engineering workflows. It provides a structured approach to writing Python scripts as tasks and workflows to improve code readability and collaboration. Key features include built-in automatic storage for input files, output files, and generated data to ensure traceability, as well as tight integration with the Speckle data platform for remote calculations and result storage.
  2. Overview of Caliber features and benefits

    Caliber is a framework for running Python functions organized as tasks and workflows. It provides several key advantages for developers:

    • Code Structure: Enforces a task-and-workflow architecture, improving readability and providing clear direction and flow to Python scripts.
    • Collaboration: Standardizes how workflows are defined, making it easier for teams to share and collaborate on code.
    • Automated Data Management: Includes built-in support for the automatic storage of input files, output files, and generated data. Input files are stored alongside results to ensure traceability for post-processing.
    • Speckle Integration: Tightly integrated with the Speckle data platform, allowing users to exchange workflows for remote calculations and store results externally.
  3. Overview of Caliber engineering workflow package

    Caliber is a Python package used to create and run engineering workflows. It provides a structured approach to coding by defining scripts as tasks and workflows, which improves readability and collaboration. Key features include:

    • Automatic Data Storage: Built-in support for storing input files, output files, and generated data to ensure traceability and facilitate post-processing.
    • Speckle Integration: Tightly connected to the Speckle data platform, allowing users to exchange workflows for remote calculations and store results.
  4. Benefits of using Caliber for structural design workflows

    Using Caliber and Python instead of traditional batch scripts for structural design provides several advantages:

    • Reusability: Standardized workflow definitions and Python interfaces in packages promote collaboration and reusable code.
    • Flexibility: Tasks or branches can be easily omitted to run only specific parts of the workflow (e.g., updating a subset of load cases).
    • Extensibility: The workflow can be easily extended with additional Python functionality, such as data visualizations or optimizations.
  5. Get started with the Caliber CLI

    The Caliber CLI allows users to interact with the library without full knowledge of the API. Running the base caliber command displays the installed version, available global options (flags), and available sub-commands.
    caliber
  6. Use caliber.print for TUI and Rich integration

    caliber.print is a custom implementation of the builtin print function. It behaves like both the standard Python print and rich.print. Its primary purpose is to integrate with the Caliber TUI; when a workflow is run via the Caliber CLI, any output sent via caliber.print is routed to a dedicated 'Task activity' panel rather than the standard stdout. This panel accumulates messages during a task's execution and clears when a new task starts.
    from caliber import print
    
    # Standard text
    print('Hello, World!')
    
    # Rich console markup
    print('[bold italic blue]Hello[/bold italic blue], [red]World[/red]!')
  7. Install Caliber from source

    Caliber is compatible with Python 3.10, 3.11, 3.12, and 3.13. It is installed directly from the GitHub source repository. It is recommended to use the python -m pip pattern rather than calling pip directly to ensure the correct Python version is targeted.
    # Using Python launcher
    py -m pip install git+https://github.com/multiconsult-group/caliber@main
    
    # Using Python
    python -m pip install git+https://github.com/multiconsult-group/caliber@main
  8. Visualize a workflow via CLI

    The caliber workflow show command generates a visualization of the workflow based on its JSON definition. This is used to verify that the workflow definition is correct and that all required modules/packages are imported correctly. Use the -t flag to view the visualization directly in the terminal.
    # Standard visualization
    caliber workflow show pasta.json
    
    # Terminal-based visualization
    caliber workflow show pasta.json -t
  9. Run a workflow using a JSON definition

    Workflows can be executed via the CLI using a JSON file that describes the workflow. This JSON file can be created manually or generated using the Workflow.to_json() method in Python. When running a workflow, Caliber activates a Text User Interface (TUI) powered by Textual for rendering output. Use ctrl+d to toggle dark mode in the TUI.
    caliber workflow run [OPTIONS] JSONFILE
    
    # Example with the bell notification flag
    caliber workflow run --bell pasta.json
  10. Automate bridge foundation design workflows with Caliber and Python

    Caliber can be used to automate the iterative data exchange between geotechnical and structural disciplines during bridge foundation design. This is particularly useful for slender superstructures sensitive to second-order effects where soil stiffness calculations must be fed into structural finite element analyses (FEA).

    Key implementation steps include:

    1. Creating Python interfaces to run engineering computer programs in batch mode.
    2. Using Caliber Workflows to collect and orchestrate these functions.
    3. Utilizing a Speckle server to handle data exchange between disciplines.
    4. Implementing a Plotly Dash dashboard to visualize soil stiffnesses stored on the Speckle server.
    5. Automating the generation of analysis report appendices.