Skip to content

Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.

Prep for debug

Louis Choquel5550b32ef27c
diff --git a/pipelex/create/build_blueprint.py b/pipelex/create/build_blueprint.py
index affce8844..722e6df8b 100644
--- a/pipelex/create/build_blueprint.py
+++ b/pipelex/create/build_blueprint.py
@@ -7,7 +7,7 @@ from typing import Any, Dict, Optional, cast
import typer
from pydantic import ValidationError
-from pipelex import pretty_print
+from pipelex import log, pretty_print
from pipelex.create.helpers import get_support_file
from pipelex.create.pipeline_toml import save_pipeline_blueprint_toml_to_path
from pipelex.exceptions import PipeDefinitionError, PipelexCLIError
@@ -63,7 +63,11 @@ async def do_build_blueprint(
generated_pipe_codes = list(blueprint.pipe.keys())
if not generated_pipe_codes:
raise PipelexCLIError("No pipe found in generated blueprint to validate")
+ log.info(f"Loaded pipes: {generated_pipe_codes}")
+
+ log.info("Validating pipes...")
asyncio.run(dry_run_pipe_codes(pipe_codes=generated_pipe_codes))
+ log.info(f"Pipes validated: {generated_pipe_codes}")
def _load_pipes_from_generated_blueprint(blueprint: PipelineBlueprint) -> None:
@@ -80,15 +84,19 @@ def _load_pipes_from_generated_blueprint(blueprint: PipelineBlueprint) -> None:
details_dict: Dict[str, Any] = details.copy()
# Build the concrete PipeBlueprint via LibraryManager helper
- try:
- pipe_blueprint = LibraryManager.make_pipe_blueprint_from_details(
- domain_code=domain_code,
- details_dict=details_dict,
- )
- except ValidationError as exc:
- error_msg = format_pydantic_validation_error(exc=exc)
- raise PipeDefinitionError(f"Failed to build pipe blueprint for pipe '{pipe_code}': {error_msg}") from exc
+ # try:
+ # pipe_blueprint = LibraryManager.make_pipe_blueprint_from_details(
+ # domain_code=domain_code,
+ # details_dict=details_dict,
+ # )
+ # except ValidationError as exc:
+ # error_msg = format_pydantic_validation_error(exc=exc)
+ # raise PipeDefinitionError(f"Failed to build pipe blueprint for pipe '{pipe_code}': {error_msg}\n{exc}") from exc
+ pipe_blueprint = LibraryManager.make_pipe_blueprint_from_details(
+ domain_code=domain_code,
+ details_dict=details_dict,
+ )
# Create pipe and register in library
pipe = LibraryManager.load_pipe_from_blueprint(
pipe_code=pipe_code,
diff --git a/pipelex/libraries/library_manager.py b/pipelex/libraries/library_manager.py
index b6e0a56e1..4ce896929 100644
--- a/pipelex/libraries/library_manager.py
+++ b/pipelex/libraries/library_manager.py
@@ -456,18 +456,24 @@ Old syntax will be removed in v0.3.0.
new and legacy formats), locates the corresponding <PipeClassName>Blueprint
in the factory module, and validates the blueprint.
"""
+ log.dev("Making Pipe blueprint")
# Determine pipe class name from details
if "type" in details_dict and "definition" in details_dict:
pipe_class_name = details_dict["type"]
normalized_details = details_dict.copy()
+ log.dev(f"New format, pipe_class_name: {pipe_class_name}")
+ log.dev(f"Normalized details: {normalized_details}")
else:
try:
pipe_class_name, legacy_definition = next(iter(details_dict.items()))
normalized_details = {"definition": legacy_definition}
+ log.dev(f"Legacy format, pipe_class_name: {pipe_class_name}")
+ log.dev(f"Normalized details: {normalized_details}")
except StopIteration as empty_err:
raise PipeFactoryError("Pipe details are empty; cannot determine pipe type") from empty_err
factory_class_name = f"{pipe_class_name}Factory"
+ log.dev(f"Factory class name: {factory_class_name}")
# Resolve factory to locate its module (where the Blueprint class is defined)
try:
@@ -486,6 +492,7 @@ Old syntax will be removed in v0.3.0.
factory_module = importlib.import_module(pipe_factory.__module__)
blueprint_class_name = f"{pipe_class_name}Blueprint"
+ log.dev(f"Blueprint class name: {blueprint_class_name}")
try:
blueprint_cls: Type[PipeBlueprint] = getattr(factory_module, blueprint_class_name)
@@ -495,4 +502,5 @@ Old syntax will be removed in v0.3.0.
details_with_domain = normalized_details.copy()
details_with_domain["domain"] = domain_code
+ log.dev(f"Making Pipe blueprint for class {blueprint_class_name} from details: {details_with_domain}")
return blueprint_cls.model_validate(details_with_domain)