Skip to content

gear-toolkit

Introduction

flywheel-gear-toolkit is a Python package that provides utilities for developing Flywheel gears. It offers a set of tools to simplify common gear operations such as configuration management, input/output handling, and logging. This package is maintained by Flywheel and is open-sourced to support the Flywheel developer community.

Key Features

  • Configuration Management: Tools for parsing and validating gear configuration
  • Input/Output Handling: Utilities for working with gear inputs and outputs
  • Logging: Standardized logging setup for gears
  • Metadata Management: Functions for working with Flywheel metadata
  • Error Handling: Consistent error handling patterns

Installation

The package can be installed using pip:

pip install flywheel-gear-toolkit

Basic Usage

Here's a simple example of using gear-toolkit in a gear:

import flywheel_gear_toolkit
from flywheel_gear_toolkit import GearToolkitContext

def main():
    # Initialize the gear toolkit context
    with GearToolkitContext() as context:
        # Setup basic logging
        context.init_logging()

        # Get the configuration
        config = context.config

        # Get input files
        input_file = context.get_input_path('input')

        # Process the input file
        # ...

        # Write output
        output_file = os.path.join(context.output_dir, 'output.txt')
        with open(output_file, 'w') as f:
            f.write('Hello, Flywheel!')

if __name__ == '__main__':
    main()

Resources