Feature Parity Matrix: flywheel-gear-toolkit vs. fw-gear
1. Overview
This document compares key features across five major components between flywheel-gear-toolkit and fw-gear. The goal is to assess feature parity, highlight any changes, and identify any known limitations.
2. Feature Parity Table
| Feature Category | flywheel-gear-toolkit (Legacy) | fw-gear (Current) | Status | Notes / Limitations |
|---|---|---|---|---|
| Context Management | GearToolkitContext provides an all-in-one class for managing config, manifest, and metadata | GearContext is used, but configuration handling is offloaded to Config | ⚠️ Updated | Context management exists, but now follows a modular approach |
| Configuration Handling | GearToolkitContext directly manages config.json | Config class now encapsulates configuration parsing, input management, and destination handling | ✅ Same, but modularized | Configuration handling is now in a dedicated class (Config) |
| Logging Setup | init_logging() method applies _recursive_update() to configure logs dynamically | Uses configure_logging(), directly referencing manifest values | ✅ Same | No major differences |
| Flywheel SDK Client Handling | Managed within GearToolkitContext | Now handled within Config | ✅ Same, but refactored | SDK initialization logic moved inside Config |
| Metadata Management | Metadata class is used for .metadata.json handling | Metadata class remains, but methods are now accessed within GearContext | ✅ Same | No major differences |
| Input & File Handling | Methods like get_input(), get_input_path(), open_input() exist within GearToolkitContext | Moved to Config for better modularity | ✅ Same, but modularized | Input file handling is now part of Config |
| File Object Representation | File class used for representing Flywheel files | File class remains, but fw_type replaces type | ⚠️ Modified | fw_type replaces type, which may require minor updates in some cases |
| Manifest Management | manifest.json is read directly in GearToolkitContext | Dedicated Manifest class now handles parsing and validation | ✅ Same, but modularized | Manifest parsing is now separate from the context |
| Destination Container & Hierarchy | get_container_from_ref(), get_destination_container(), get_parent() | Now handled within Config | ✅ Same, but modularized | Destination management is now part of Config |
| BIDS Data Handling | download_project_bids(), download_session_bids() (deprecated) | No BIDS-specific methods | ❌ Removed | BIDS download functions now supported in a separate, BIDS suite |
| Logging Configuration | Reads log_config from manifest.json | Retrieves log settings from manifest.get_value("custom") | ✅ Same | No major differences |
| Deprecation Warnings | deprecated() decorator warns about deprecated functions | No explicit deprecation warnings; removed in favor of restructuring | ⚠️ Modified | Deprecated functions removed; restructuring replaces them |
| Error Handling | Uses try/except with broad exception handling | Introduces GearContextError for structured error handling | ✅ Same, but improved | Better error management with GearContextError |
| Output Directory Management | _clean_output() cleans directories on errors | _clean_output() still exists, with improved logging | ✅ Same | Minor improvements in logging |
3. Key Changes
⚠️ Breaking Changes
-
Renamed Context Class:
GearToolkitContexthas been renamed toGearContextinfw_gear, requiring updates to imports and usage. -
New
ConfigClass for Managingconfig.json: Previously, configuration data was handled as a dictionary inflywheel_gear_toolkit. Now, thefw_gearpackage includes a dedicatedConfigclass, providing a structured approach to managingconfig.json. -
Methods Moved from
GearToolkitContexttoConfig: The following methods have been moved fromGearToolkitContextto theConfigclass infw_gear. They should now be accessed asgear_context.config.<method>instead ofgear_toolkit_context.<method>: -
get_input() get_input_path()get_input_filename()get_input_file_object()get_input_file_object_value()get_destination_container()get_destination_parent()-
open_input() -
Changes in the
MetadataClass: -
Modified Methods:
update_container()andupdate_file_metadata()now enforce validation to ensure only valid Flywheel container types are provided.clean()now includes a metadata size check and issues a warning if the size exceeds 16MB.
-
New Method:
add_qc_result_to_analysis()allows users to add QC results directly to the analysis container via.metadata.json.
-
Module Reorganizations and Renames:
flywheel_gear_toolkit.utils.zip_toolshas been renamed and reorganized intofw_gear.utils.archive.zip_manager.- Methods previously found in
flywheel_gear_toolkit.utils.decoratorsare now located infw_gear.utils.contextutils. sdk_post_retry_handler()andsdk_delete_404_handler(), originally inflywheel_gear_toolkit.utils, have been moved tofw_gear.utils.contextutils.flywheel_gear_toolkit.licenses.freesurferhas been moved tofw_gear.utils.licenses.freesurfer.get_parent()andget_container_from_ref(), which were originally inflywheel_gear_toolkit.GearContext, are now located infw_gear.utils.sdk_helpers.- The
flywheel_gear_toolkit.interfacespackage, which containedflywheel_gear_toolkit.interfaces.command_lineandflywheel_gear_toolkit.interfaces.nipype, has been moved to:fw_gear.utils.wrapper.command(previouslycommand_line).fw_gear.utils.wrapper.nipype(previouslynipype).
✅ Enhancements
- Improved Flywheel SDK Handling:
get_client()now raisesGearContextErrorif the Flywheel SDK is missing or the API key is invalid.- New Method:
- Added
is_fw_context()method in theGearContextclass to check if it is running in a Flywheel Gear environment. - Added
setup_gear_run()underfw_gear.utils.sdk_helpers, which gathers necessary information for running the specified gear with the provided gear inputs and configuration.
❌ Removals
- BIDS-related Methods:
download_project_bids()anddownload_session_bids()have been removed fromGearToolkitContext.-
BIDS-related utilities will be available in a newly restructure bids-client library (repo TBD).
-
Temporary Directory (
tempdir): - The
tempdirfeature has been removed fromGearContext. -
It was originally meant for testing purposes. However, its usage has been deprecated and no longer serves its intended purposes.
-
Removed
datatypesSubmodule: -
The
datatypessubmodule underflywheel_gear_toolkit.utilshas been removed. -
Curator and Reporters Migration:
- The
curator,reporters, andwalkersubmodules fromflywheel_gear_toolkit.utilshave been moved to a separate Python package namedfw-curation.
4. Known Limitations
| Limitation | Impact |
|---|---|
| No BIDS Support | Refer to the BIDS App Toolkit or Template for updated handling of BIDS dataset workflows. |
| File Object Changes | The change from type to fw_type in the File class may require minor updates in existing codebases. |
| More Explicit Error Handling | While beneficial, developers may need to update their error handling logic to accommodate GearContextError. |
5. Summary
The fw-gear package introduces better modularization, improved error handling, and structured configuration management. While most functionalities remain unchanged or improved, some legacy features such as BIDS support and deprecated functions have been removed.
This feature parity matrix provides a reference for tracking changes between the two packages.