build_tools.pipeline_tui.core.state
Application state management for Pipeline TUI.
This module defines the state dataclasses that track pipeline configuration, job status, and UI state throughout the application lifecycle.
State Hierarchy:
PipelineState- Top-level application state -ExtractionConfig- Extractor settings (pyphen/nltk, options) -JobState- Current job execution status - UI state (current screen, last browsed directory, etc.)
Design Principles:
Immutable where possible (use dataclass frozen=True for config)
Centralized state prevents scattered UI state
State changes trigger UI updates via Textual reactivity
Classes
Available syllable extractor types. |
|
Pipeline job execution status. |
|
Configuration for a syllable extraction job. |
|
State for a running or completed pipeline job. |
|
Top-level application state for Pipeline TUI. |
Module Contents
- class build_tools.pipeline_tui.core.state.ExtractorType(*args, **kwds)[source]
Bases:
enum.EnumAvailable syllable extractor types.
- PYPHEN
- NLTK
- class build_tools.pipeline_tui.core.state.JobStatus(*args, **kwds)[source]
Bases:
enum.EnumPipeline job execution status.
- IDLE
- CONFIGURING
- RUNNING
- COMPLETED
- FAILED
- CANCELLED
- class build_tools.pipeline_tui.core.state.ExtractionConfig[source]
Configuration for a syllable extraction job.
- extractor_type
Which extractor to use (pyphen or nltk)
- source_path
Source directory path (for browsing and as fallback)
- selected_files
List of specific files to process. If empty, uses source_path with file_pattern.
- output_dir
Output directory for results
- language
Language code for pyphen (e.g., “en_US”, “de_DE”) or “auto” for automatic detection via langdetect
- min_syllable_length
Minimum syllable length filter
- max_syllable_length
Maximum syllable length filter
- extractor_type: ExtractorType
- source_path: pathlib.Path | None = None
- selected_files: list[pathlib.Path] = []
- output_dir: pathlib.Path | None = None
- class build_tools.pipeline_tui.core.state.JobState[source]
State for a running or completed pipeline job.
- status
Current job status
- config
Configuration used for this job
- start_time
When the job started
- end_time
When the job ended (if completed/failed/cancelled)
- current_stage
Current pipeline stage (extract/normalize/annotate)
- progress_percent
Estimated progress (0-100)
- log_messages
List of log messages from the job
- output_path
Path to output directory (set after job starts)
- error_message
Error message if job failed
- config: ExtractionConfig | None = None
- start_time: datetime.datetime | None = None
- end_time: datetime.datetime | None = None
- output_path: pathlib.Path | None = None
- class build_tools.pipeline_tui.core.state.PipelineState[source]
Top-level application state for Pipeline TUI.
This dataclass holds all state for the application, including configuration, job status, and UI state.
- config
Current extraction configuration
- job
Current or most recent job state
- last_source_dir
Last browsed source directory (for browser initial path)
- last_output_dir
Last browsed output directory
- run_normalize
Whether to run normalization after extraction
- run_annotate
Whether to run annotation after normalization
- config: ExtractionConfig
- last_source_dir: pathlib.Path
- last_output_dir: pathlib.Path
- start_job()[source]
Start a new job with current configuration.
Creates a new JobState with RUNNING status and current timestamp.
- complete_job(output_path)[source]
Mark job as completed successfully.
- Parameters:
output_path (pathlib.Path) – Path to the output directory