Fitz: Workflow Management for Neuroimaging
Fitz is an extremely early development library (version 0.0.1.dev2) for managing complex workflows, particularly in the context of neuroimaging data analysis. It provides basic components like DAGs, Nodes, and Workflows. The project appears to be abandoned, with no active development for over two years.
Common errors
-
AttributeError: module 'fitz' has no attribute 'open'
cause Attempting to use the `fitz` neuroimaging package as if it were the PyMuPDF library (which is commonly imported as `fitz`). This `fitz` package does not contain PDF-related functionality.fixIf you intended to use a PDF library, install PyMuPDF (`pip install pymupdf`) and then `import fitz` from that package. If you meant this `fitz` package, this error confirms you're trying to use PyMuPDF functionality that does not exist here. -
ModuleNotFoundError: No module named 'fitz'
cause The `fitz` package has not been installed in the current Python environment.fixInstall the package using pip: `pip install fitz`. -
AttributeError: module 'fitz.workflow' has no attribute 'Workflow'
cause The specific class or attribute you are trying to import (`Workflow` in this example) may not exist, has been renamed, or its import path has changed. Given the highly unstable and abandoned nature of this development package, API changes are common and undocumented.fixInspect the project's source code on GitHub (e.g., `fitz/workflow.py`) to verify the exact class name and its availability. However, it is strongly recommended to avoid using this package due to its instability and lack of maintenance.
Warnings
- breaking This `fitz` package (PyPI slug `fitz`) is *not* the popular PDF library PyMuPDF. PyMuPDF users commonly import it as `import fitz` after `pip install pymupdf`. This `fitz` package is an unrelated, abandoned neuroimaging workflow library, leading to severe confusion and unexpected behavior if mistaken for PyMuPDF.
- breaking This project is in an extremely early development stage (version 0.0.1.dev2) and appears to be abandoned, with no commits in over two years. Its APIs are highly unstable, largely undocumented, and subject to arbitrary change or removal without warning. It is not suitable for production use.
- gotcha There is no formal documentation, active community, or official support for this package. Usage patterns must be derived directly from the GitHub repository's source code and test files, which may be incomplete, outdated, or difficult to interpret for general use cases.
Install
-
pip install fitz
Imports
- Workflow
from fitz.workflow import Workflow
- Node
from fitz.node import Node
- DAG
from fitz.dag import DAG
Quickstart
import os
# NOTE: This library is in an extremely early development stage (0.0.1.dev2)
# and appears to be abandoned. The following example is derived from internal tests
# and may not be functional or representative of a stable API.
# It is NOT recommended for production use.
from fitz.workflow import Workflow
from fitz.node import Node
from fitz.dag import DAG
# Define simple nodes (tasks)
class SimpleNode(Node):
def __init__(self, name, func=None):
super().__init__(name)
self.func = func or (lambda: print(f"Executing {name}"))
def execute(self):
self.func()
# Create nodes
node_a = SimpleNode('A')
node_b = SimpleNode('B')
node_c = SimpleNode('C')
# Create a workflow and add nodes
workflow = Workflow('MyExampleWorkflow')
workflow.add_node(node_a)
workflow.add_node(node_b)
workflow.add_node(node_c)
# Define dependencies (A -> B, A -> C)
workflow.add_edge(node_a, node_b)
workflow.add_edge(node_a, node_c)
print(f"Workflow '{workflow.name}' created with nodes: {[n.name for n in workflow.nodes]}")
print(f"Edges: {workflow.dag.edges}")
# Attempt to run the workflow (functionality is limited and untested for general use)
# For a real run, you'd likely need more complex node logic and an executor.
# The project's tests suggest running tasks, but no clear 'workflow.run()' method exists at this level.
# This is purely illustrative of structure.
print("\n--- Attempting to show node execution order (conceptual) ---")
for node in workflow.dag.topological_sort():
print(f"Ready to execute: {node.name}")
# node.execute() # Actual execution requires more setup than this quickstart provides