Core Module
Core functionality for ModuFlow.
This package provides the core functionality for ModuFlow, including configuration handling and path management.
Config
Configuration management for ModuFlow.
This module provides functionality for working with YAML configuration files, including reading, writing, and merging section configurations.
- class moduflow.core.config.ConfigManager(project_root: str | None = None)[source]
Bases:
objectManager for ModuFlow configuration files.
- add_file_to_sections(file_path: str, section_names: List[str]) None[source]
Add a file to multiple sections.
- Parameters:
file_path – Path to the file.
section_names – List of section names.
- compile_config() Dict[str, Any][source]
Compile all section configurations into a single configuration.
- Returns:
Dictionary containing the compiled configuration.
- find_files_in_multiple_sections() Dict[str, List[str]][source]
Find files that are used in multiple sections.
- Returns:
Dictionary mapping file paths to lists of section names.
- read_all_section_configs() Dict[str, Dict[str, Any]][source]
Read all section configuration files.
- Returns:
Dictionary mapping section names to their configurations.
- read_compiled_config() Dict[str, Any][source]
Read the compiled configuration file.
- Returns:
Dictionary containing the compiled configuration.
- read_section_config(section_name: str) Dict[str, Any][source]
Read a section configuration file.
- Parameters:
section_name – Name of the section.
- Returns:
Dictionary containing the section configuration.
- Raises:
FileNotFoundError – If the section config doesn’t exist.
Exceptions
Exceptions for ModuFlow.
This module provides custom exceptions for ModuFlow.
- exception moduflow.core.exceptions.CompilationError[source]
Bases:
ModuFlowErrorError during compilation.
- exception moduflow.core.exceptions.ConfigError[source]
Bases:
ModuFlowErrorError in configuration.
- exception moduflow.core.exceptions.FileError[source]
Bases:
ModuFlowErrorError related to files.
- exception moduflow.core.exceptions.ModuFlowError[source]
Bases:
ExceptionBase exception for all ModuFlow errors.
- exception moduflow.core.exceptions.SectionError[source]
Bases:
ModuFlowErrorError related to sections.
- exception moduflow.core.exceptions.SectionNotFoundError[source]
Bases:
SectionErrorSection not found.
Paths
Path management for ModuFlow.
This module provides utilities for working with paths in ModuFlow projects.
- class moduflow.core.paths.PathManager(project_root: str | None = None)[source]
Bases:
objectManager for paths in a ModuFlow project.
- get_compiled_config_path() Path[source]
Get the path to the compiled configuration file.
- Returns:
Path to the compiled configuration file.
- get_design_file_path(section_name: str) Path[source]
Get the path to a section design file.
- Parameters:
section_name – Name of the section.
- Returns:
Path to the section design file.
- get_file_paths_by_pattern(pattern: str) list[Path][source]
Get paths to files matching a pattern.
- Parameters:
pattern – Glob pattern to match files.
- Returns:
List of matching file paths.
- get_project_output_dir() Path[source]
Get the output directory for the entire project.
- Returns:
Path to the project output directory.
- get_relative_path(path: Path) str[source]
Get a path relative to the project root.
- Parameters:
path – Absolute path.
- Returns:
Path relative to the project root.