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.
dev to release/v0.17.2 (#496)
Thomas Hebrarda0370e90d6a7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d0b237354..859ed1730 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,12 +1,18 @@# Changelog-### [v0.17.1] - 2025-11-27+### Unreleased++### Added++- Added `force_include_dirs` parameter to the `find_files_in_dir` function. This allows specific directories to be force included in the search even when they are nested within excluded directories. For example, you can now exclude `.venv` while still including `.venv/lib/python3.11/site-packages/pipelex` for loading Pipelex libraries from installed packages.++## [v0.17.1] - 2025-11-27### Fixed- Fixed a bug in the `find_files_in_dir` function.-### [v0.17.0] - 2025-11-27+## [v0.17.0] - 2025-11-27**Highlights:** - Previously, in the pipelex config files (`.toml` files in the `.pipelex/` directory, such as `.pipelex/pipelex.toml`, but also the routing profiles files, backends, etc.), when an array was overridden, the new array was concatenated to the old array. Now, the new array overrides the old array.diff --git a/pipelex/builder/builder.py b/pipelex/builder/builder.pyindex 95707e099..8e196988f 100644--- a/pipelex/builder/builder.py+++ b/pipelex/builder/builder.py@@ -46,7 +46,7 @@ def _convert_pipe_spec(pipe_spec: PipeSpecUnion) -> PipeSpecUnion:@pipe_func()-async def assemble_pipelex_bundle_spec(working_memory: WorkingMemory) -> PipelexBundleSpec:+def assemble_pipelex_bundle_spec(working_memory: WorkingMemory) -> PipelexBundleSpec:"""Construct a PipelexBundleSpec from working memory containing concept and pipe blueprints.Args:diff --git a/pipelex/builder/pipe/pipe_spec.py b/pipelex/builder/pipe/pipe_spec.pyindex b56e0ef40..70787256f 100644--- a/pipelex/builder/pipe/pipe_spec.py+++ b/pipelex/builder/pipe/pipe_spec.py@@ -125,7 +125,7 @@ class PipeSpec(StructuredContent):def to_blueprint(self) -> PipeBlueprint:return PipeBlueprint(description=self.description,- inputs=self.inputs if self.inputs else None,+ inputs=self.inputs or None,output=self.output,type=self.type,pipe_category=self.pipe_category,diff --git a/pipelex/cli/_cli.py b/pipelex/cli/_cli.pyindex 26034ccb6..e75239b2a 100644--- a/pipelex/cli/_cli.py+++ b/pipelex/cli/_cli.py@@ -66,7 +66,7 @@ def app_callback(ctx: typer.Context) -> None:""")# Skip checks if no command is being run (e.g., just --help) or if running init/doctor command- if ctx.invoked_subcommand is None or ctx.invoked_subcommand in ("init", "doctor"):+ if ctx.invoked_subcommand is None or ctx.invoked_subcommand in {"init", "doctor"}:return# Check system readiness (dependencies and venv for dev installs)diff --git a/pipelex/cli/commands/doctor_cmd.py b/pipelex/cli/commands/doctor_cmd.pyindex 5d60042b7..0afd794b4 100644--- a/pipelex/cli/commands/doctor_cmd.py+++ b/pipelex/cli/commands/doctor_cmd.py@@ -355,7 +355,6 @@ def display_health_report("""Display a comprehensive health report.Args:- console: Rich Console instance for outputconfig_healthy: Whether config files check passedconfig_message: Message about config files statusconfig_missing_count: Number of missing config filesdiff --git a/pipelex/cli/commands/init/command.py b/pipelex/cli/commands/init/command.pyindex cc8801f6c..1deedeab5 100644--- a/pipelex/cli/commands/init/command.py+++ b/pipelex/cli/commands/init/command.py@@ -256,10 +256,10 @@ def init_cmd(routing_profiles_toml_path = os.path.join(pipelex_config_dir, "inference", "routing_profiles.toml")# Determine what to check based on focus parameter- check_config = focus in (InitFocus.ALL, InitFocus.CONFIG)- check_inference = focus in (InitFocus.ALL, InitFocus.INFERENCE)+ check_config = focus in {InitFocus.ALL, InitFocus.CONFIG}+ check_inference = focus in {InitFocus.ALL, InitFocus.INFERENCE}check_routing = focus == InitFocus.ROUTING- check_telemetry = focus in (InitFocus.ALL, InitFocus.TELEMETRY)+ check_telemetry = focus in {InitFocus.ALL, InitFocus.TELEMETRY}# Track if backends.toml existed before we startis_first_time_backends_setup = not path_exists(backends_toml_path)diff --git a/pipelex/cli/commands/init/ui/backends_ui.py b/pipelex/cli/commands/init/ui/backends_ui.pyindex f75fbd989..1d2a31c6f 100644--- a/pipelex/cli/commands/init/ui/backends_ui.py+++ b/pipelex/cli/commands/init/ui/backends_ui.py@@ -182,12 +182,12 @@ def prompt_backend_indices(choice_input = choice_str.strip().lower()# Handle quit option- if choice_input in ("q", "quit"):+ if choice_input in {"q", "quit"}:console.print("\n[yellow]Exiting without configuring backends.[/yellow]")raise typer.Exit(code=0)# Handle all option- if choice_input in ("a", "all"):+ if choice_input in {"a", "all"}:selected_indices = list(range(len(backend_options)))breakdiff --git a/pipelex/cli/commands/init/ui/telemetry_ui.py b/pipelex/cli/commands/init/ui/telemetry_ui.pyindex 0a338d74d..f9b891696 100644--- a/pipelex/cli/commands/init/ui/telemetry_ui.py+++ b/pipelex/cli/commands/init/ui/telemetry_ui.py@@ -68,7 +68,7 @@ def prompt_telemetry_mode(console: Console) -> TelemetryMode:choice_input = choice_str.lower().strip()# Handle quit option- if choice_input in ("q", "quit"):+ if choice_input in {"q", "quit"}:console.print("\n[yellow]Exiting without configuring telemetry.[/yellow]")raise typer.Exit(code=0)diff --git a/pipelex/cli/commands/show_cmd.py b/pipelex/cli/commands/show_cmd.pyindex f8b8568e3..125e212d1 100644--- a/pipelex/cli/commands/show_cmd.py+++ b/pipelex/cli/commands/show_cmd.py@@ -118,7 +118,7 @@ def do_show_backends(show_all: bool = False) -> None:backends_table.add_column("Models", style="cyan", justify="right")for backend in sorted(backends_to_display, key=lambda b: b.name):- endpoint = backend.endpoint if backend.endpoint else "[dim]N/A[/dim]"+ endpoint = backend.endpoint or "[dim]N/A[/dim]"model_count = str(len(backend.model_specs))if show_all:diff --git a/pipelex/client/client.py b/pipelex/client/client.pyindex 7f01a2a1b..169357abf 100644--- a/pipelex/client/client.py+++ b/pipelex/client/client.py@@ -96,9 +96,9 @@ class PipelexClient(PipelexProtocol):output_name: Name of the output slot to write tooutput_multiplicity: Output multiplicity settingdynamic_output_concept_code: Override for the dynamic output concept code- Returns:- PipelineResponse: Complete execution results including pipeline state and output+ Returns:+ Complete execution results including pipeline state and output"""if not pipe_code and not plx_content:msg = "Either pipe_code or plx_content must be provided to the API execute_pipeline."@@ -142,8 +142,9 @@ class PipelexClient(PipelexProtocol):output_name: Name of the output slot to write tooutput_multiplicity: Output multiplicity settingdynamic_output_concept_code: Override for the dynamic output concept code+Returns:- PipelineResponse: Initial response with pipeline_run_id and created_at timestamp+ Initial response with pipeline_run_id and created_at timestamp"""if not pipe_code and not plx_content:msg = "Either pipe_code or plx_content must be provided to the API start_pipeline."diff --git a/pipelex/cogt/extract/extract_job_components.py b/pipelex/cogt/extract/extract_job_components.pyindex 9371ea85f..0c8c4676a 100644--- a/pipelex/cogt/extract/extract_job_components.py+++ b/pipelex/cogt/extract/extract_job_components.py@@ -28,7 +28,7 @@ class ExtractJobConfig(ConfigModel):########################################################################-### Outputs+# Outputs########################################################################diff --git a/pipelex/cogt/img_gen/img_gen_job_components.py b/pipelex/cogt/img_gen/img_gen_job_components.pyindex 902231e5c..451a35d42 100644--- a/pipelex/cogt/img_gen/img_gen_job_components.py+++ b/pipelex/cogt/img_gen/img_gen_job_components.py@@ -100,7 +100,7 @@ class ImgGenJobConfig(ConfigModel):########################################################################-### Outputs+# Outputs########################################################################diff --git a/pipelex/cogt/llm/llm_job_components.py b/pipelex/cogt/llm/llm_job_components.pyindex d43af1f43..3711b8ac1 100644--- a/pipelex/cogt/llm/llm_job_components.py+++ b/pipelex/cogt/llm/llm_job_components.py@@ -3,7 +3,7 @@ from pydantic import BaseModel, Fieldfrom pipelex.cogt.llm.llm_report import LLMTokensUsage########################################################################-### Inputs+# Inputs########################################################################@@ -19,7 +19,7 @@ class LLMJobConfig(BaseModel):########################################################################-### Outputs+# Outputs########################################################################diff --git a/pipelex/cogt/llm/llm_worker_internal_abstract.py b/pipelex/cogt/llm/llm_worker_internal_abstract.pyindex 09aedf2d4..0356b3a5a 100644--- a/pipelex/cogt/llm/llm_worker_internal_abstract.py+++ b/pipelex/cogt/llm/llm_worker_internal_abstract.py@@ -20,7 +20,6 @@ class LLMWorkerInternalAbstract(LLMWorkerAbstract):Args:inference_model (InferenceModelSpec): The inference model to be used by the worker.- structure_method (StructureMethod | None): The structure method to be used by the worker.reporting_delegate (ReportingProtocol | None): An optional report delegate for reporting unit jobs."""diff --git a/pipelex/cogt/model_backends/model_lists.py b/pipelex/cogt/model_backends/model_lists.pyindex ddccdcf5a..24e280fdd 100644--- a/pipelex/cogt/model_backends/model_lists.py+++ b/pipelex/cogt/model_backends/model_lists.py@@ -326,7 +326,7 @@ class ModelLister:try:# List available models using the plugin-specific function- bedrock_models_list = await bedrock_list_available_models(+ bedrock_models_list = bedrock_list_available_models(plugin=plugin,backend=backend,)diff --git a/pipelex/cogt/models/model_deck.py b/pipelex/cogt/models/model_deck.pyindex 56817e35c..f95b3dfee 100644--- a/pipelex/cogt/models/model_deck.py+++ b/pipelex/cogt/models/model_deck.py@@ -151,7 +151,7 @@ class ModelDeck(ConfigModel):raise ModelDeckValidatonError(msg) from exc############################################################- #### ModelDeck validations+ # ModelDeck validations############################################################@classmethoddiff --git a/pipelex/core/concepts/helpers.py b/pipelex/core/concepts/helpers.pyindex f4f449233..3945fb5c8 100644--- a/pipelex/core/concepts/helpers.py+++ b/pipelex/core/concepts/helpers.py@@ -8,5 +8,5 @@ def strip_multiplicity_from_concept_string_or_code(concept_string_or_code: str)The concept string or code without multiplicity"""if "[" in concept_string_or_code:- return concept_string_or_code.split("[")[0]+ return concept_string_or_code.split("[", maxsplit=1)[0]return concept_string_or_codediff --git a/pipelex/core/memory/working_memory.py b/pipelex/core/memory/working_memory.pyindex 9a4a66cd1..621f18c59 100644--- a/pipelex/core/memory/working_memory.py+++ b/pipelex/core/memory/working_memory.py@@ -51,7 +51,7 @@ class WorkingMemory(BaseModel, ContextProviderAbstract):if not stuff.stuff_name:self.root[key].stuff_name = key- elif key not in (MAIN_STUFF_NAME, stuff.stuff_name):+ elif key not in {MAIN_STUFF_NAME, stuff.stuff_name}:log.warning(f"Stuff name '{stuff.stuff_name}' does not match the key '{key}'")elif stuff.stuff_name.startswith("_") and stuff.stuff_name != BATCH_ITEM_STUFF_NAME:log.warning(f"Stuff name '{stuff.stuff_name}' starts with '_', which is reserved for params")diff --git a/pipelex/core/pipes/handle_pipe_errors.py b/pipelex/core/pipes/handle_pipe_errors.pyindex a80979231..0a4993230 100644--- a/pipelex/core/pipes/handle_pipe_errors.py+++ b/pipelex/core/pipes/handle_pipe_errors.py@@ -1,14 +1,13 @@-from enum import Enum-from pydantic import ValidationErrorfrom pydantic_core import ErrorDetailsfrom pipelex.core.exceptions import PipesAndConceptValidationErrorDatafrom pipelex.core.interpreter.validation_error_categorizer import ErrorCatKeyfrom pipelex.core.pipes.exceptions import PipeValidationError, PipeValidationErrorType+from pipelex.types import StrEnum-class ModelScope(str, Enum):+class ModelScope(StrEnum):"""Indicates which type of model is being validated."""PIPE = "pipe"@@ -43,10 +42,10 @@ def categorize_pipe_validation_error(if loc:field_name = str(loc[0])# Concept-specific fields- if field_name in ("structure_class_name", "refines"):+ if field_name in {"structure_class_name", "refines"}:model_scope = ModelScope.CONCEPT# Pipe-specific fields- elif field_name in ("type", "inputs", "output", "pipe_category"):+ elif field_name in {"type", "inputs", "output", "pipe_category"}:model_scope = ModelScope.PIPE# Ambiguous fields - try to infer from error messageelse:diff --git a/pipelex/core/pipes/pipe_abstract.py b/pipelex/core/pipes/pipe_abstract.pyindex 5d01b2533..6772324f7 100644--- a/pipelex/core/pipes/pipe_abstract.py+++ b/pipelex/core/pipes/pipe_abstract.py@@ -154,7 +154,7 @@ class PipeAbstract(ABC, BaseModel):# Allow mismatch if the needed requirement is a flexible type (Dynamic or Anything)if (- needed_requirement.concept.code not in (NativeConceptCode.DYNAMIC, NativeConceptCode.ANYTHING)+ needed_requirement.concept.code not in {NativeConceptCode.DYNAMIC, NativeConceptCode.ANYTHING}and declared_requirement != needed_requirement):# Identify the specific mismatched field(s)diff --git a/pipelex/core/pipes/pipe_blueprint.py b/pipelex/core/pipes/pipe_blueprint.pyindex 95e2a8a52..340784a51 100644--- a/pipelex/core/pipes/pipe_blueprint.py+++ b/pipelex/core/pipes/pipe_blueprint.py@@ -188,13 +188,6 @@ class PipeBlueprint(ABC, BaseModel):msg = f"Invalid concept string or code '{concept_string_or_code}' when trying to validate the input of a pipe blueprint: {exc}"raise ValueError(msg) from exc- # Check that every input_name is unique- input_names = list(self.inputs.keys())- if len(input_names) != len(set(input_names)):- duplicates = [name for name in input_names if input_names.count(name) > 1]- msg = f"Duplicate input names found: {duplicates}. Input names must be unique."- raise ValueError(msg)-self.validate_inputs()@finaldiff --git a/pipelex/core/stuffs/image_field_search.py b/pipelex/core/stuffs/image_field_search.pyindex 8823c2f05..1b93c914e 100644--- a/pipelex/core/stuffs/image_field_search.py+++ b/pipelex/core/stuffs/image_field_search.py@@ -55,7 +55,7 @@ def search_for_nested_image_fields(current_field_type = potential_field_types[idx]# Check if it's a list or tuple generic type (e.g., list[ImageContent], tuple[ImageContent, ...])- if hasattr(field_specific_type, "__origin__") and field_specific_type.__origin__ in (list, tuple): # type: ignore[union-attr]+ if hasattr(field_specific_type, "__origin__") and field_specific_type.__origin__ in {list, tuple}: # type: ignore[union-attr]# Check if this container or its nested contents have imagesif check_generic_container_for_images(field_specific_type):paths.append(field_path)@@ -144,7 +144,7 @@ def check_generic_container_for_images(container_type: Any) -> bool:container_args = getattr(container_type, "__args__", ())for arg_type in container_args:# Check if arg_type is itself a generic (nested list/tuple) - recurse!- if hasattr(arg_type, "__origin__") and arg_type.__origin__ in (list, tuple): # type: ignore[union-attr]+ if hasattr(arg_type, "__origin__") and arg_type.__origin__ in {list, tuple}: # type: ignore[union-attr]if check_generic_container_for_images(arg_type):return True# Check if it's a regular typediff --git a/pipelex/core/stuffs/stuff_artefact.py b/pipelex/core/stuffs/stuff_artefact.pyindex e381a6728..c26dca02f 100644--- a/pipelex/core/stuffs/stuff_artefact.py+++ b/pipelex/core/stuffs/stuff_artefact.py@@ -38,7 +38,7 @@ class StuffArtefact(RootModel[dict[str, Any]], Jinja2TaggableAbstract):instead of getting the dict.items() method."""# Allow access to special attributes, 'root', and model-related attributes- if key.startswith("_") or key in ("root", "model_dump", "model_config"):+ if key.startswith("_") or key in {"root", "model_dump", "model_config"}:return object.__getattribute__(self, key)# Check if it's a key in the root dict firstdiff --git a/pipelex/language/plx_factory.py b/pipelex/language/plx_factory.pyindex 02582ef94..6eaaf07c0 100644--- a/pipelex/language/plx_factory.py+++ b/pipelex/language/plx_factory.py@@ -47,7 +47,7 @@ class PlxFactory:if strings_config.ensure_leading_blank_line and not normalized.startswith("\n"):normalized = "\n" + normalizedif strings_config.ensure_trailing_newline and not normalized.endswith("\n"):- normalized = normalized + "\n"+ normalized += "\n"use_literal = strings_config.prefer_literal and ("'''" not in normalized)return tomlkit_string(normalized, multiline=needs_multiline, literal=use_literal)diff --git a/pipelex/libraries/library_utils.py b/pipelex/libraries/library_utils.pyindex 7cae920b9..5d8d1ec4a 100644--- a/pipelex/libraries/library_utils.py+++ b/pipelex/libraries/library_utils.py@@ -77,6 +77,7 @@ def get_pipelex_plx_files_from_dirs(dirs: set[Path]) -> list[Path]:dir_path=str(dir_path),pattern="*.plx",excluded_dirs=list(get_config().pipelex.scan_config.excluded_dirs),+ force_include_dirs=[str(dir_path) for dir_path in dirs],)# Filter to only include valid Pipelex filesdiff --git a/pipelex/pipe_controllers/batch/pipe_batch.py b/pipelex/pipe_controllers/batch/pipe_batch.pyindex 8469b1344..da477ee9d 100644--- a/pipelex/pipe_controllers/batch/pipe_batch.py+++ b/pipelex/pipe_controllers/batch/pipe_batch.py@@ -32,11 +32,13 @@ class PipeBatch(PipeController):@overridedef required_variables(self) -> set[str]:required_variables: set[str] = set()- # 1. Check that the inputs of the pipe branch_pipe_code are in the inputs of the pipe- pipe = get_required_pipe(pipe_code=self.branch_pipe_code)- for variable_name, _ in pipe.inputs.items:- required_variables.add(variable_name)+ # 1. Check that the inputs of the branch_pipe are in the inputs of the pipe+ branch_pipe = get_required_pipe(pipe_code=self.branch_pipe_code)+ required_variables.update(branch_pipe.inputs.variables)# 2. Check that the input_list_stuff_name is in the inputs of the pipe+ if self.batch_params.input_item_stuff_name not in required_variables:+ msg = f"Input item name '{self.batch_params.input_item_stuff_name}' not found in inputs of branch pipe '{self.branch_pipe_code}'"+ raise ValueError(msg)required_variables.remove(self.batch_params.input_item_stuff_name)required_variables.add(self.batch_params.input_list_stuff_name)return required_variables@@ -55,7 +57,11 @@ class PipeBatch(PipeController):@overridedef validate_inputs_with_library(self):- pass+ # Check that the item name is in the inputs of the branch_pipe+ branch_pipe = get_required_pipe(pipe_code=self.branch_pipe_code)+ if self.batch_params.input_item_stuff_name not in branch_pipe.inputs.variables:+ msg = f"Input item name '{self.batch_params.input_item_stuff_name}' not found in inputs of branch pipe '{self.branch_pipe_code}'"+ raise ValueError(msg)@overridedef validate_output_static(self):diff --git a/pipelex/pipe_controllers/batch/pipe_batch_blueprint.py b/pipelex/pipe_controllers/batch/pipe_batch_blueprint.pyindex 9f31a06cc..f0dcf59ff 100644--- a/pipelex/pipe_controllers/batch/pipe_batch_blueprint.py+++ b/pipelex/pipe_controllers/batch/pipe_batch_blueprint.py@@ -20,7 +20,18 @@ class PipeBatchBlueprint(PipeBlueprint):@overridedef validate_inputs(self):- pass+ # The PipeBatch will iterate over a list and pass each item to the branch pipe,+ # so we must have the list's name as part of the batch inputs+ # and conversely, we must not have the item's name as part of the batch inputs+ if not self.inputs or self.input_list_name not in self.inputs:+ msg = f"Input list name '{self.input_list_name}' not found in inputs: {self.inputs}"+ raise ValueError(msg)+ if not self.input_item_name:+ msg = "Empty input item name is not allowed"+ raise ValueError(msg)+ if self.input_item_name in self.inputs:+ msg = f"Input item name '{self.input_item_name}' found in inputs: {self.inputs}"+ raise ValueError(msg)@overridedef validate_output(self):diff --git a/pipelex/pipe_controllers/condition/pipe_condition.py b/pipelex/pipe_controllers/condition/pipe_condition.pyindex 056788446..bcebbe029 100644--- a/pipelex/pipe_controllers/condition/pipe_condition.py+++ b/pipelex/pipe_controllers/condition/pipe_condition.py@@ -130,11 +130,11 @@ class PipeCondition(PipeController):"""for pipe_code in self.mapped_pipe_codes:pipe = get_required_pipe(pipe_code=pipe_code)- if self.output.concept_string not in (+ if self.output.concept_string not in {pipe.output.concept_string,NativeConceptCode.DYNAMIC.concept_string,NativeConceptCode.ANYTHING.concept_string,- ):+ }:msg = (f"The output concept code '{self.output.concept_string}' of the pipe '{self.code}' is not "f"matching the output concept code '{pipe.output.concept_string}' of the pipe '{pipe_code}'"diff --git a/pipelex/pipe_operators/compose/pipe_compose.py b/pipelex/pipe_operators/compose/pipe_compose.pyindex 306eb487c..2171fc4bd 100644--- a/pipelex/pipe_operators/compose/pipe_compose.py+++ b/pipelex/pipe_operators/compose/pipe_compose.py@@ -63,7 +63,7 @@ class PipeCompose(PipeOperator[PipeComposeOutput]):return {variable_namefor variable_name in required_variables- if not variable_name.startswith("_") and variable_name not in ("preliminary_text", "place_holder")+ if not variable_name.startswith("_") and variable_name not in {"preliminary_text", "place_holder"}}@overridediff --git a/pipelex/pipe_operators/compose/pipe_compose_blueprint.py b/pipelex/pipe_operators/compose/pipe_compose_blueprint.pyindex 13492ac56..ccee5f68a 100644--- a/pipelex/pipe_operators/compose/pipe_compose_blueprint.py+++ b/pipelex/pipe_operators/compose/pipe_compose_blueprint.py@@ -61,7 +61,7 @@ class PipeComposeBlueprint(PipeBlueprint):template_category=self.template_category,template_source=preprocessed_template,)- if not variable_name.startswith("_") and variable_name not in ("preliminary_text", "place_holder")+ if not variable_name.startswith("_") and variable_name not in {"preliminary_text", "place_holder"}}for required_variable_name in required_variables:if required_variable_name not in self.input_names:diff --git a/pipelex/pipe_operators/llm/llm_prompt_blueprint.py b/pipelex/pipe_operators/llm/llm_prompt_blueprint.pyindex c7ba93f2c..ba9ee9111 100644--- a/pipelex/pipe_operators/llm/llm_prompt_blueprint.py+++ b/pipelex/pipe_operators/llm/llm_prompt_blueprint.py@@ -51,7 +51,7 @@ class LLMPromptBlueprint(BaseModel):return {variable_namefor variable_name in required_variables- if not variable_name.startswith("_") and variable_name not in ("preliminary_text", "place_holder")+ if not variable_name.startswith("_") and variable_name not in {"preliminary_text", "place_holder"}}# TODO: make this consistent with `LLMPromptFactoryAbstract` or `LLMPromptTemplate`,diff --git a/pipelex/pipe_operators/llm/pipe_llm.py b/pipelex/pipe_operators/llm/pipe_llm.pyindex fa75e71ab..3591505a9 100644--- a/pipelex/pipe_operators/llm/pipe_llm.py+++ b/pipelex/pipe_operators/llm/pipe_llm.py@@ -227,9 +227,15 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):msg = f"Error generating text with LLM {location}: {error_details}"raise PipeRunError(message=msg, run_mode=pipe_run_params.run_mode) from exc- the_content = TextContent(- text=generated_text,- )+ try:+ the_content = TextContent(+ text=generated_text,+ )+ except ValidationError as exc:+ location = self._format_error_location(pipe_run_params=pipe_run_params)+ error_details = format_pydantic_validation_error(exc)+ msg = f"Error generating text content with in PipeLLM {location}: {error_details}"+ raise PipeRunError(message=msg, run_mode=pipe_run_params.run_mode) from excelse:if is_multiple_output:log.verbose(f"PipeLLM generating {fixed_nb_output} output(s)" if fixed_nb_output else "PipeLLM generating a list of output(s)")diff --git a/pipelex/pipe_operators/llm/pipe_llm_blueprint.py b/pipelex/pipe_operators/llm/pipe_llm_blueprint.pyindex 9aeef6590..867c446cd 100644--- a/pipelex/pipe_operators/llm/pipe_llm_blueprint.py+++ b/pipelex/pipe_operators/llm/pipe_llm_blueprint.py@@ -60,7 +60,7 @@ class PipeLLMBlueprint(PipeBlueprint):raise ValueError(msg) from exc# Filter out internal variables that start with underscore and special variables# TODO: replace magic strings by StrEnum and also, make this check clearer and more readable- required_variables = {var for var in required_variables if not var.startswith("_") and var not in ("preliminary_text", "place_holder")}+ required_variables = {var for var in required_variables if not var.startswith("_") and var not in {"preliminary_text", "place_holder"}}# Check that all required variables are in inputsinput_names: set[str] = set(self.inputs.keys()) if self.inputs else set()diff --git a/pipelex/pipe_run/dry_run.py b/pipelex/pipe_run/dry_run.pyindex e95d272a2..2b3bb1ec2 100644--- a/pipelex/pipe_run/dry_run.py+++ b/pipelex/pipe_run/dry_run.py@@ -69,7 +69,6 @@ async def dry_run_pipes(pipes: list[PipeAbstract], raise_on_failure: bool = TrueArgs:pipes: List of pipes to dry run- run_in_parallel: If True, run pipes in parallel using ThreadPoolExecutor. If False, run sequentially.raise_on_failure: If True, raise an exception if any pipe fails.For each pipe, this method:diff --git a/pipelex/pipeline/job_metadata.py b/pipelex/pipeline/job_metadata.pyindex 86e58b2b2..8bd1ae443 100644--- a/pipelex/pipeline/job_metadata.py+++ b/pipelex/pipeline/job_metadata.py@@ -30,7 +30,7 @@ class JobMetadata(BaseModel):unit_job_id: str | None = Nonejob_category: JobCategory | None = None- started_at: datetime | None = Field(default_factory=lambda: datetime.now())+ started_at: datetime | None = Field(default_factory=datetime.now)completed_at: datetime | None = None@propertydiff --git a/pipelex/plugins/anthropic/anthropic_factory.py b/pipelex/plugins/anthropic/anthropic_factory.pyindex 45cab7124..3c3470518 100644--- a/pipelex/plugins/anthropic/anthropic_factory.py+++ b/pipelex/plugins/anthropic/anthropic_factory.py@@ -198,7 +198,7 @@ class AnthropicFactory:"""Makes a list of messages with a system message (if provided) and followed by a user message."""llm_prompt = llm_job.llm_promptmessages: list[ChatCompletionMessageParam] = []- #### System message ####+ # System message ####if system_content := llm_prompt.system_text:messages.append(ChatCompletionSystemMessageParam(role="system", content=system_content))@@ -209,10 +209,10 @@ class AnthropicFactory:else:prepped_user_images = None- #### Concatenation ####+ # Concatenation ####messages.append(AnthropicFactory.openai_typed_user_message(- user_content_txt=llm_prompt.user_text if llm_prompt.user_text else "",+ user_content_txt=llm_prompt.user_text or "",prepped_user_images=prepped_user_images,),)diff --git a/pipelex/plugins/bedrock/bedrock_llms.py b/pipelex/plugins/bedrock/bedrock_llms.pyindex ce39eae6d..b92cf87ab 100644--- a/pipelex/plugins/bedrock/bedrock_llms.py+++ b/pipelex/plugins/bedrock/bedrock_llms.py@@ -7,7 +7,7 @@ from pipelex.plugins.plugin_sdk_registry import Pluginfrom pipelex.tools.aws.aws_config import AwsCredentialsError-async def bedrock_list_available_models(+def bedrock_list_available_models(plugin: Plugin, # noqa: ARG001backend: InferenceBackend, # noqa: ARG001) -> list[dict[str, Any]]:diff --git a/pipelex/plugins/mistral/mistral_factory.py b/pipelex/plugins/mistral/mistral_factory.pyindex d4d542ff4..ea65210fa 100644--- a/pipelex/plugins/mistral/mistral_factory.py+++ b/pipelex/plugins/mistral/mistral_factory.py@@ -147,7 +147,7 @@ class MistralFactory:top_left_y=mistral_ocr_image_obj.top_left_y,bottom_right_x=mistral_ocr_image_obj.bottom_right_x,bottom_right_y=mistral_ocr_image_obj.bottom_right_y,- base_64=mistral_ocr_image_obj.image_base64 if mistral_ocr_image_obj.image_base64 else None,+ base_64=mistral_ocr_image_obj.image_base64 or None,)#########################################################diff --git a/pipelex/system/configuration/config_loader.py b/pipelex/system/configuration/config_loader.pyindex 2d55dc22f..fea64e9d3 100644--- a/pipelex/system/configuration/config_loader.py+++ b/pipelex/system/configuration/config_loader.py@@ -87,16 +87,16 @@ class ConfigLoader:Dict[str, Any]: The merged configuration dictionary"""- #################### 1. Load pipelex base config ####################+ # 1. Load pipelex base config ####################pipelex_config = self.get_pipelex_config()- #################### 2. Load local (current project) config ####################+ # 2. Load local (current project) config ####################if not self.is_in_pipelex_config:local_config = self.get_local_config()if local_config:deep_update(pipelex_config, local_config)- #################### 3. Load overrides for the current project ####################+ # 3. Load overrides for the current project ####################list_of_overrides: list[str] = [*CONFIG_BASE_OVERRIDES_BEFORE_ENV,runtime_manager.environment,diff --git a/pipelex/system/environment.py b/pipelex/system/environment.pyindex aebc2abef..f14ca87e6 100644--- a/pipelex/system/environment.py+++ b/pipelex/system/environment.py@@ -47,4 +47,4 @@ def set_env(key: str, value: str) -> None:def is_env_var_truthy(key: str) -> bool:"""Return True if the env var is set and not a falsy sentinel ("false" or "0")."""value = get_optional_env(key)- return (value is not None) and (value.lower() not in ["false", "0"])+ return (value is not None) and (value.lower() not in {"false", "0"})diff --git a/pipelex/system/registries/class_registry_utils.py b/pipelex/system/registries/class_registry_utils.pyindex 9b7b16338..474615597 100644--- a/pipelex/system/registries/class_registry_utils.py+++ b/pipelex/system/registries/class_registry_utils.py@@ -51,7 +51,6 @@ class ClassRegistryUtils:folder_path: Path to folder containing Python filesbase_class: Optional base class to filter registerable classesis_recursive: Whether to search recursively in subdirectories- include_imported: Whether to include classes imported from other modulesis_include_imported: Whether to include classes imported from other modules"""@@ -98,6 +97,7 @@ class ClassRegistryUtils:pattern="*.py",is_recursive=is_recursive,excluded_dirs=list(get_config().pipelex.scan_config.excluded_dirs),+ force_include_dirs=[folder_path],)for python_file in python_files:diff --git a/pipelex/system/registries/func_registry_utils.py b/pipelex/system/registries/func_registry_utils.pyindex f71b2e9cd..668920e91 100644--- a/pipelex/system/registries/func_registry_utils.py+++ b/pipelex/system/registries/func_registry_utils.py@@ -87,6 +87,7 @@ class FuncRegistryUtils:pattern="*.py",is_recursive=is_recursive,excluded_dirs=list(get_config().pipelex.scan_config.excluded_dirs),+ force_include_dirs=[folder_path],)for python_file in python_files:diff --git a/pipelex/tools/log/log_formatter.py b/pipelex/tools/log/log_formatter.pyindex fea7a3191..0f8302bde 100644--- a/pipelex/tools/log/log_formatter.py+++ b/pipelex/tools/log/log_formatter.py@@ -86,7 +86,7 @@ class LevelAndEmojiLogFormatter(logging.Formatter):log_fmt = f"{color}{tag}:%(name)s{RESET_FONT} %(message)s"formatter = logging.Formatter(log_fmt)- if record.levelno in [logging.WARNING, logging.ERROR, logging.CRITICAL]:+ if record.levelno in {logging.WARNING, logging.ERROR, logging.CRITICAL}:record.msg = f"{color}{BOLD_FONT}{record.msg}{RESET_FONT}"return formatter.format(record)diff --git a/pipelex/tools/misc/diff.py b/pipelex/tools/misc/diff.pyindex 53542222b..e7e8ef6cf 100644--- a/pipelex/tools/misc/diff.py+++ b/pipelex/tools/misc/diff.py@@ -85,7 +85,7 @@ def _generate_diff_summary(diff_content: str, left_is_newer: bool) -> str | Nonelines = diff_content.split("\n")# Skip header lines (---, +++, @@)- change_lines = [line for line in lines if line and line[0] in ("+", "-") and not line.startswith(("---", "+++"))]+ change_lines = [line for line in lines if line and line[0] in {"+", "-"} and not line.startswith(("---", "+++"))]if not change_lines:return Nonediff --git a/pipelex/tools/misc/file_utils.py b/pipelex/tools/misc/file_utils.pyindex 7854aa795..7e67ffb11 100644--- a/pipelex/tools/misc/file_utils.py+++ b/pipelex/tools/misc/file_utils.py@@ -25,8 +25,7 @@ def save_bytes_to_binary_file(file_path: str, byte_data: bytes, create_directoryif create_directory:ensure_directory_exists(os.path.dirname(file_path))- with open(file_path, "wb") as file:- file.write(byte_data)+ Path(file_path).write_bytes(byte_data)return file_path@@ -51,8 +50,7 @@ def save_text_to_path(text: str, path: str, create_directory: bool = False):if directory:ensure_directory_exists(directory)- with open(path, "w", encoding="utf-8") as file:- file.write(text)+ Path(path).write_text(text, encoding="utf-8")def load_text_from_path(path: str) -> str:@@ -347,14 +345,23 @@ def get_incremental_file_path(########################################################-def find_files_in_dir(dir_path: str, pattern: str, is_recursive: bool = True, excluded_dirs: list[str] | None = None) -> list[Path]:+def find_files_in_dir(+ dir_path: str,+ pattern: str,+ is_recursive: bool = True,+ excluded_dirs: list[str] | None = None,+ force_include_dirs: list[str] | None = None,+) -> list[Path]:"""Find files matching a pattern in a directory.Args:dir_path: Directory path to search inpattern: File pattern to match (e.g. "*.py")is_recursive: Whether to search recursively in subdirectories- excluded_dirs: List of directories to exclude from the search+ excluded_dirs: List of directory names to exclude from the search (e.g. [".venv", "node_modules"])+ force_include_dirs: List of directories to force include even if they are within excluded_dirs.+ Can be either full absolute paths or directory names.+Returns:List of matching Path objects@@ -368,6 +375,29 @@ def find_files_in_dir(dir_path: str, pattern: str, is_recursive: bool = True, exfiles = list(path.glob(pattern))for file in files:- if excluded_dirs is None or not any(part in excluded_dirs for part in file.parts):+ is_excluded = excluded_dirs is not None and any(excluded_dir in file.parts for excluded_dir in excluded_dirs)++ # Check if file is in a force include directory (forced inclusion despite exclusions)+ # Force include dirs can be full paths or directory names+ should_force_include = False+ if force_include_dirs is not None:+ for force_include_dir in force_include_dirs:+ force_include_path = Path(force_include_dir)+ # If force_include_dir is an absolute path, check if file is under it+ if force_include_path.is_absolute():+ try:+ file.relative_to(force_include_path)+ should_force_include = True+ break+ except ValueError:+ # file is not relative to force_include_path+ continue+ # If force_include_dir is just a directory name, check if it's in the file path parts+ elif force_include_dir in file.parts:+ should_force_include = True+ break++ # Include if not excluded, or if force included+ if not is_excluded or should_force_include:filtered_files.append(file)return filtered_filesdiff --git a/pipelex/tools/misc/string_utils.py b/pipelex/tools/misc/string_utils.pyindex 8a37db202..47870b40a 100644--- a/pipelex/tools/misc/string_utils.py+++ b/pipelex/tools/misc/string_utils.py@@ -93,8 +93,8 @@ def camel_to_snake_case(name: str) -> str:'this_is_a_test'"""- s1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", name)- return re.sub("([a-z0-9])([A-Z])", r"\1_\2", s1).lower()+ s1 = re.sub(r"(.)([A-Z][a-z]+)", r"\1_\2", name)+ return re.sub(r"([a-z0-9])([A-Z])", r"\1_\2", s1).lower()def pascal_case_to_snake_case(name: str) -> str:diff --git a/pipelex/tools/typing/class_utils.py b/pipelex/tools/typing/class_utils.pyindex 0d2dd7f28..0541aba97 100644--- a/pipelex/tools/typing/class_utils.py+++ b/pipelex/tools/typing/class_utils.py@@ -61,7 +61,7 @@ def has_compatible_field(class_1: type[Any], class_2: type[Any]) -> bool:origin = get_origin(type_param)# Handle unions, including PEP 604 (T | None)- if origin in (Union, _UnionType):+ if origin in {Union, _UnionType}:for arg in get_args(type_param):if arg is _NoneType:continuediff --git a/pipelex/tools/typing/module_inspector.py b/pipelex/tools/typing/module_inspector.pyindex 4c1818d78..58da80e9f 100644--- a/pipelex/tools/typing/module_inspector.py+++ b/pipelex/tools/typing/module_inspector.py@@ -134,8 +134,7 @@ def find_class_names_in_file(file_path: str, base_class_names: list[str] | Nonetry:# Read and parse the file- with open(file_path, encoding="utf-8") as file:- source = file.read()+ source = Path(file_path).read_text(encoding="utf-8")tree = ast.parse(source, filename=file_path)except Exception as exc:msg = f"Failed to parse {file_path}: {exc}"@@ -198,8 +197,7 @@ def find_decorated_function_names_in_file(try:# Read and parse the file- with open(file_path, encoding="utf-8") as file:- source = file.read()+ source = Path(file_path).read_text(encoding="utf-8")tree = ast.parse(source, filename=file_path)except Exception as exc:msg = f"Failed to parse {file_path}: {exc}"diff --git a/pipelex/tools/typing/structure_printer.py b/pipelex/tools/typing/structure_printer.pyindex 7cc8c4a0e..f2eaba9db 100644--- a/pipelex/tools/typing/structure_printer.py+++ b/pipelex/tools/typing/structure_printer.py@@ -20,7 +20,7 @@ class StructurePrinter:args = get_args(tp)# was: if origin is Union and args:- if origin in (Union, types.UnionType) and args:+ if origin in {Union, types.UnionType} and args:non_none = [a for a in args if a is not type(None)]if len(args) == 2 and len(non_none) == 1:return f"{self.pretty_type(non_none[0])} | None"@@ -39,9 +39,9 @@ class StructurePrinter:return "Literal[\n " + ",\n ".join(values) + ",\n ]"return f"Literal[{', '.join(values)}]"- if (origin is list or origin is list) and args:+ if origin is list and args:return f"List[{self.pretty_type(args[0])}]"- if (origin is dict or origin is dict) and args:+ if origin is dict and args:return f"Dict[{self.pretty_type(args[0])}, {self.pretty_type(args[1])}]"return str(tp)@@ -80,7 +80,7 @@ class StructurePrinter:args = get_args(tp)# was: if origin is Union:- if origin in (Union, types.UnionType):+ if origin in {Union, types.UnionType}:non_none = [a for a in args if a is not type(None)]if len(args) == 2 and len(non_none) == 1:return f"{format_type(non_none[0])} | None"@@ -106,9 +106,9 @@ class StructurePrinter:return "Literal[\n " + ",\n ".join(lines) + ",\n ]"return f"Literal[{', '.join(values)}]"- if origin in (list, list):+ if origin is list:return f"List[{format_type(args[0])}]"- if origin in (dict, dict):+ if origin is dict:return f"Dict[{format_type(args[0])}, {format_type(args[1])}]"return str(tp)@@ -121,7 +121,7 @@ class StructurePrinter:if origin:# was: if origin is Union:- if origin in (Union, types.UnionType):+ if origin in {Union, types.UnionType}:for arg in args:if arg is type(None):continue@@ -152,7 +152,7 @@ class StructurePrinter:if (issubclass(base, BaseModel)and base is not BaseModel- and base.__module__ not in ("pydantic.main", "abc")+ and base.__module__ not in {"pydantic.main", "abc"}and not base.__module__.startswith("pipelex.core")):collect_types(base)@@ -262,7 +262,7 @@ class StructurePrinter:field_origin = get_origin(field_type)field_args = get_args(field_type)- is_optional = field_origin in (Union, types.UnionType) and type(None) in field_args+ is_optional = field_origin in {Union, types.UnionType} and type(None) in field_args# Handle default valuesfield_default = Nonediff --git a/pyproject.toml b/pyproject.tomlindex 68f1e79a7..4ccaa446a 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -261,6 +261,7 @@ target-version = "py311"[tool.ruff.format][tool.ruff.lint]+preview = trueselect = ["ALL"]ignore = ["ANN201", # Missing return type annotation for public function `my_func`@@ -269,10 +270,15 @@ ignore = ["ANN206", # Missing return type annotation for classmethod `my_func`"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in `...`"ASYNC230", # Async functions should not open files with blocking methods like `open`+ "ASYNC240", # Async functions should not use pathlib.Path methods, use trio.Path or anyio.path++ "B903", # Class could be dataclass or namedtuple"C901", # Is to complex"COM812", # Checks for the absence of trailing commas.+ "CPY001", # Missing copyright notice at top of file+"D100", # Missing docstring in public module"D101", # Missing docstring in public class"D102", # Missing docstring in public method@@ -286,6 +292,12 @@ ignore = ["D404", # First word of the docstring should not be "This""D415", # First line should end with a period, question mark, or exclamation point+ "DOC201", # `return` is not documented in docstring+ "DOC202", # Docstring should not have a returns section because the function doesn't return anything+ "DOC402", # `yield` is not documented in docstring+ "DOC502", # Raised exception is not explicitly raised: `FileNotFoundError`+ "DOC501", # Raised exception `ModuleFileError` missing from docstring+"DTZ001", # `datetime.datetime()` called without a `tzinfo` argument"DTZ005", # `datetime.datetime.now()` called without a `tz` argument@@ -297,13 +309,25 @@ ignore = ["FIX002", # Line contains TODO, consider resolving the issue+ "FURB101", # `open` and `read` should be replaced by `Path(file_path.path).read_text(encoding="utf-8")`+ "FURB113", # Checks for consecutive calls to append.+ "FURB152", # Checks for literals that are similar to constants in math module.++ "LOG004", # `.exception()` call outside exception handlers+"PLC0105", # `TypeVar` name "SomethingType" does not reflect its covariance; consider renaming it to "SomethingType_co"+ "PLC1901", # Checks for comparisons to empty strings.+ "PLR0904", # Too many public methods ( > 20)"PLR0911", # Too many return statements (/6)"PLR0912", # Too many branches (/12)"PLR0913", # Too many arguments in function definition (/5)+ "PLR0914", # Too many local variables ( /15)"PLR0915", # Too many statements (/50)+ "PLR0917", # Too many positional arguments ( /5)"PLR2004", # Magic value used in comparison, consider replacing `2` with a constant variable+ "PLR6301", # Too many return statements in `for` loop+ "PLR1702", # Too many nested blocks ( > 5)"PT013", # Incorrect import of `pytest`; use `import pytest` insteaddiff --git a/tests/integration/pipelex/cogt/test_llm_report.py b/tests/integration/pipelex/cogt/test_llm_report.pyindex 0c9c3cb86..2350a0d7a 100644--- a/tests/integration/pipelex/cogt/test_llm_report.py+++ b/tests/integration/pipelex/cogt/test_llm_report.py@@ -11,7 +11,7 @@ from tests.integration.pipelex.cogt.test_data import LLMTestCases@pytest.mark.asyncio-async def test_llm_report_without_running_anything():+def test_llm_report_without_running_anything():get_report_delegate().generate_report()diff --git a/tests/integration/pipelex/kit/test_cursor_rules_update.py b/tests/integration/pipelex/kit/test_cursor_rules_update.pyindex d5a08a82d..70eac2e92 100644--- a/tests/integration/pipelex/kit/test_cursor_rules_update.py+++ b/tests/integration/pipelex/kit/test_cursor_rules_update.py@@ -49,12 +49,10 @@ class TestUpdateCursorRules:cursor_rules_dir = repo_root / ".cursor" / "rules"exported_files: set[str] = set()- for mdc_file in cursor_rules_dir.glob("*.mdc"):- exported_files.add(mdc_file.name)+ exported_files.update(mdc_file.name for mdc_file in cursor_rules_dir.glob("*.mdc"))expected_files: set[str] = set()- for file_name in kit_index.agent_rules.sets[agent_set]:- expected_files.add(f"{file_name.removesuffix('.md')}.mdc")+ expected_files.update(f"{file_name.removesuffix('.md')}.mdc" for file_name in kit_index.agent_rules.sets[agent_set])assert exported_files == expected_filesdiff --git a/tests/integration/pipelex/pipes/conftest.py b/tests/integration/pipelex/pipes/conftest.pyindex 3e040bc71..296b4f45f 100644--- a/tests/integration/pipelex/pipes/conftest.py+++ b/tests/integration/pipelex/pipes/conftest.py@@ -1,15 +1,15 @@import os-from collections.abc import Awaitable, Callable+from collections.abc import Callable-import pytest_asyncio+import pytestfrom pipelex.core.pipes.pipe_output import PipeOutputfrom pipelex.tools.misc.json_utils import save_as_json_to_path-@pytest_asyncio.fixture # pyright: ignore[reportUntypedFunctionDecorator, reportUnknownMemberType]-async def save_working_memory() -> Callable[[PipeOutput, str], Awaitable[None]]:- async def _save_working_memory(pipe_output: PipeOutput, result_dir_path: str) -> None:+def save_working_memory() -> Callable[[PipeOutput, str], None]:+ def _save_working_memory(pipe_output: PipeOutput, result_dir_path: str) -> None:pipe_output.working_memory.pretty_print()working_memory_path = os.path.join(result_dir_path, "working_memory.json")save_as_json_to_path(object_to_save=pipe_output.working_memory, path=working_memory_path)diff --git a/tests/integration/pipelex/pipes/controller/pipe_parallel/test_pipe_parallel_simple.py b/tests/integration/pipelex/pipes/controller/pipe_parallel/test_pipe_parallel_simple.pyindex 5b1e74b5a..500a54db7 100644--- a/tests/integration/pipelex/pipes/controller/pipe_parallel/test_pipe_parallel_simple.py+++ b/tests/integration/pipelex/pipes/controller/pipe_parallel/test_pipe_parallel_simple.py@@ -105,7 +105,7 @@ class TestPipeParallelSimple:assert isinstance(sentiment_result.content, TextContent)# Should return one of: positive, negative, neutralif pipe_run_mode != PipeRunMode.DRY:- assert sentiment_result.content.text.lower() in ["positive", "negative", "neutral"]+ assert sentiment_result.content.text.lower() in {"positive", "negative", "neutral"}assert f"{sentiment_result.concept.domain}.{sentiment_result.concept.code}" == f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}"# Verify word count result@@ -115,7 +115,7 @@ class TestPipeParallelSimple:# Should be a number (as text)word_count_text = word_count_result.content.text.strip()if pipe_run_mode != PipeRunMode.DRY:- assert word_count_text.isdigit() or word_count_text in ["12", "thirteen", "twelve"] # Allow for some variation+ assert word_count_text.isdigit() or word_count_text in {"12", "thirteen", "twelve"} # Allow for some variationassert word_count_result.concept.code == "Text"assert word_count_result.concept.domain == "native"@@ -212,8 +212,8 @@ class TestPipeParallelSimple:# For "Hello world" - word count should be around 2word_count_text = word_count_result.content.text.strip()if pipe_run_mode != PipeRunMode.DRY:- assert word_count_text in ["2", "two"] or word_count_text.isdigit()+ assert word_count_text in {"2", "two"} or word_count_text.isdigit()# Sentiment should be one of the valid valuesif pipe_run_mode != PipeRunMode.DRY:- assert sentiment_result.content.text.lower() in ["positive", "negative", "neutral"]+ assert sentiment_result.content.text.lower() in {"positive", "negative", "neutral"}diff --git a/tests/integration/pipelex/pipes/test_bracket_notation_operators/test_bracket_notation_operators.py b/tests/integration/pipelex/pipes/test_bracket_notation_operators/test_bracket_notation_operators.pyindex 4a4e4f999..86df66086 100644--- a/tests/integration/pipelex/pipes/test_bracket_notation_operators/test_bracket_notation_operators.py+++ b/tests/integration/pipelex/pipes/test_bracket_notation_operators/test_bracket_notation_operators.py@@ -21,7 +21,7 @@ from pipelex.system.registries.func_registry import pipe_func# Test function for PipeFunc bracket notation test@pipe_func(name="process_function")-async def process_function(working_memory: WorkingMemory) -> ListContent[TextContent]:+def process_function(working_memory: WorkingMemory) -> ListContent[TextContent]:"""Test function that processes items and returns a list."""items = working_memory.get_stuff_as_list(name="two_texts", item_type=TextContent).items# Process items and return as listdiff --git a/tests/unit/pipelex/builder/pipe/pipe_controller/pipe_batch/test_data.py b/tests/unit/pipelex/builder/pipe/pipe_controller/pipe_batch/test_data.pyindex f9479d303..646080209 100644--- a/tests/unit/pipelex/builder/pipe/pipe_controller/pipe_batch/test_data.py+++ b/tests/unit/pipelex/builder/pipe/pipe_controller/pipe_batch/test_data.py@@ -10,19 +10,19 @@ class PipeBatchTestCases:PipeBatchSpec(pipe_code="named_batch",description="Batch with custom names",- inputs={"data": "DataList"},+ inputs={"widgets": "Widget[]"},output="Results",branch_pipe_code="transform_data",- input_list_name="data_list",- input_item_name="current_data",+ input_list_name="widgets",+ input_item_name="widget",),PipeBatchBlueprint(description="Batch with custom names",- inputs={"data": "DataList"},+ inputs={"widgets": "Widget[]"},output="Results",branch_pipe_code="transform_data",- input_list_name="data_list",- input_item_name="current_data",+ input_list_name="widgets",+ input_item_name="widget",),)diff --git a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_func/test_data.py b/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_func/test_data.pyindex 1b8f6ab61..55faff67f 100644--- a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_func/test_data.py+++ b/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_func/test_data.py@@ -33,7 +33,6 @@ class PipeFuncTestCases:),PipeFuncBlueprint(description="Generate data",- inputs=None,output="GeneratedData",function_name="generate_data",),diff --git a/tests/unit/pipelex/core/bundles/test_data_pipe_sorter.py b/tests/unit/pipelex/core/bundles/test_data_pipe_sorter.pyindex ce04e1ff0..e217a41f1 100644--- a/tests/unit/pipelex/core/bundles/test_data_pipe_sorter.py+++ b/tests/unit/pipelex/core/bundles/test_data_pipe_sorter.py@@ -103,7 +103,7 @@ class PipeSorterTestCases:PIPE_BATCH_PIPES: ClassVar[dict[str, PipeBlueprintUnion]] = {"batch_pipe": PipeBatchBlueprint(description="Batch depends on process",- inputs={},+ inputs={"items": "Item[]"},output="Text",branch_pipe_code="process_item",input_list_name="items",diff --git a/tests/unit/pipelex/core/test_data/pipes/controllers/batch/pipe_batch.py b/tests/unit/pipelex/core/test_data/pipes/controllers/batch/pipe_batch.pyindex 7a9525584..1e0680cf2 100644--- a/tests/unit/pipelex/core/test_data/pipes/controllers/batch/pipe_batch.py+++ b/tests/unit/pipelex/core/test_data/pipes/controllers/batch/pipe_batch.py@@ -9,6 +9,7 @@ description = "Domain with batch pipe"[pipe.batch_process]type = "PipeBatch"description = "Process items in batch"+inputs = { items = "Item[]" }output = "ProcessedData"branch_pipe_code = "process_item"input_list_name = "items"@@ -21,6 +22,7 @@ input_item_name = "current_item""batch_process": PipeBatchBlueprint(type="PipeBatch",description="Process items in batch",+ inputs={"items": "Item[]"},output="ProcessedData",branch_pipe_code="process_item",input_list_name="items",diff --git a/tests/unit/pipelex/pipe_operators/pipe_func/data.py b/tests/unit/pipelex/pipe_operators/pipe_func/data.pyindex 650398bd0..38f6c3330 100644--- a/tests/unit/pipelex/pipe_operators/pipe_func/data.py+++ b/tests/unit/pipelex/pipe_operators/pipe_func/data.py@@ -8,20 +8,20 @@ from pipelex.system.registries.func_registry import pipe_func# Register test functions for validation tests@pipe_func(name="my_function")-async def my_function(working_memory: WorkingMemory) -> TextContent: # noqa: ARG001 # pyright: ignore[reportUnusedParameter]+def my_function(working_memory: WorkingMemory) -> TextContent: # noqa: ARG001 # pyright: ignore[reportUnusedParameter]"""Test function with no inputs."""return TextContent(text="test output")@pipe_func(name="process_text")-async def process_text(working_memory: WorkingMemory) -> TextContent:+def process_text(working_memory: WorkingMemory) -> TextContent:"""Test function with single text input."""input_data = working_memory.get_stuff_as_str("input_data")return TextContent(text=f"processed: {input_data}")@pipe_func(name="combine_data")-async def combine_data(working_memory: WorkingMemory) -> TextContent:+def combine_data(working_memory: WorkingMemory) -> TextContent:"""Test function with multiple inputs."""text_input = working_memory.get_stuff_as_str("text_input")number_input = working_memory.get_stuff_as_number("number_input")@@ -29,14 +29,14 @@ async def combine_data(working_memory: WorkingMemory) -> TextContent:@pipe_func(name="process_image")-async def process_image(working_memory: WorkingMemory) -> TextContent:+def process_image(working_memory: WorkingMemory) -> TextContent:"""Test function with image input."""image = working_memory.get_stuff_as_image("image")return TextContent(text=f"processed image: {image.url}")@pipe_func(name="process_all")-async def process_all(working_memory: WorkingMemory) -> TextContent:+def process_all(working_memory: WorkingMemory) -> TextContent:"""Test function with mixed inputs."""text = working_memory.get_stuff_as_str("text")image = working_memory.get_stuff_as_image("image")diff --git a/tests/unit/pipelex/tools/misc/test_find_files_in_dir.py b/tests/unit/pipelex/tools/misc/test_find_files_in_dir.pyindex eee007216..67725a2c2 100644--- a/tests/unit/pipelex/tools/misc/test_find_files_in_dir.py+++ b/tests/unit/pipelex/tools/misc/test_find_files_in_dir.py@@ -64,3 +64,386 @@ class TestFindFilesInDir:files = find_files_in_dir(temp_dir, "*.py", is_recursive=False)assert len(files) == 0++ def test_find_files_with_excluded_dirs_single(self):+ """Test finding files with a single excluded directory."""+ with tempfile.TemporaryDirectory() as temp_dir:+ # Create files in root+ (Path(temp_dir) / "root.py").touch()++ # Create excluded directory+ excluded_dir = Path(temp_dir) / ".venv"+ excluded_dir.mkdir()+ (excluded_dir / "excluded.py").touch()++ # Create nested structure in excluded dir+ nested_excluded = excluded_dir / "lib" / "python3.11"+ nested_excluded.mkdir(parents=True)+ (nested_excluded / "nested_excluded.py").touch()++ # Create normal subdirectory+ normal_dir = Path(temp_dir) / "src"+ normal_dir.mkdir()+ (normal_dir / "normal.py").touch()++ files = find_files_in_dir(temp_dir, "*.py", is_recursive=True, excluded_dirs=[".venv"])++ assert len(files) == 2+ file_names = [f.name for f in files]+ assert "root.py" in file_names+ assert "normal.py" in file_names+ assert "excluded.py" not in file_names+ assert "nested_excluded.py" not in file_names++ def test_find_files_with_excluded_dirs_multiple(self):+ """Test finding files with multiple excluded directories."""+ with tempfile.TemporaryDirectory() as temp_dir:+ # Create files in root+ (Path(temp_dir) / "root.py").touch()++ # Create multiple excluded directories+ venv_dir = Path(temp_dir) / ".venv"+ venv_dir.mkdir()+ (venv_dir / "venv_file.py").touch()++ node_modules = Path(temp_dir) / "node_modules"+ node_modules.mkdir()+ (node_modules / "node_file.py").touch()++ pycache = Path(temp_dir) / "src" / "__pycache__"+ pycache.mkdir(parents=True)+ (pycache / "cache_file.py").touch()++ # Create normal subdirectory+ src_dir = Path(temp_dir) / "src"+ (src_dir / "normal.py").touch()++ files = find_files_in_dir(temp_dir, "*.py", is_recursive=True, excluded_dirs=[".venv", "node_modules", "__pycache__"])++ assert len(files) == 2+ file_names = [f.name for f in files]+ assert "root.py" in file_names+ assert "normal.py" in file_names+ assert "venv_file.py" not in file_names+ assert "node_file.py" not in file_names+ assert "cache_file.py" not in file_names++ def test_find_files_with_force_include_dirs_full_path(self):+ """Test finding files with force force include directories using full paths."""+ with tempfile.TemporaryDirectory() as temp_dir:+ # Create files in root+ (Path(temp_dir) / "root.py").touch()++ # Create excluded directory structure+ venv_dir = Path(temp_dir) / ".venv"+ venv_lib = venv_dir / "lib" / "python3.11" / "site-packages"+ venv_lib.mkdir(parents=True)+ (venv_lib / "excluded.py").touch()++ # Create include directory within excluded+ force_include_dir = venv_lib / "pipelex"+ force_include_dir.mkdir()+ (force_include_dir / "important.py").touch()++ # Create nested file in include dir+ include_nested = force_include_dir / "builder"+ include_nested.mkdir()+ (include_nested / "builder.py").touch()++ # Create another file in venv but outside include dir+ other_venv = venv_lib / "other_package"+ other_venv.mkdir()+ (other_venv / "other.py").touch()++ files = find_files_in_dir(+ temp_dir,+ "*.py",+ is_recursive=True,+ excluded_dirs=[".venv"],+ force_include_dirs=[str(force_include_dir)],+ )++ file_names = [f.name for f in files]+ file_paths_str = [str(f) for f in files]++ # Should include root and include dir files, but not other venv files+ assert len(files) == 3+ assert "root.py" in file_names+ assert "important.py" in file_names+ assert "builder.py" in file_names+ assert "excluded.py" not in file_names+ assert "other.py" not in file_names++ # Verify the full paths are correct+ assert any(str(force_include_dir / "important.py") in path for path in file_paths_str)+ assert any(str(include_nested / "builder.py") in path for path in file_paths_str)++ def test_find_files_with_force_include_dirs_directory_name(self):+ """Test finding files with force force include directories using directory names."""+ with tempfile.TemporaryDirectory() as temp_dir:+ # Create files in root+ (Path(temp_dir) / "root.py").touch()++ # Create excluded directory structure+ venv_dir = Path(temp_dir) / ".venv"+ venv_lib = venv_dir / "lib"+ venv_lib.mkdir(parents=True)+ (venv_lib / "excluded.py").touch()++ # Create include directory by name within excluded+ pipelex_dir = venv_lib / "pipelex"+ pipelex_dir.mkdir()+ (pipelex_dir / "important.py").touch()++ # Create another pipelex directory elsewhere to test name matching+ src_pipelex = Path(temp_dir) / "src" / "pipelex"+ src_pipelex.mkdir(parents=True)+ (src_pipelex / "also_important.py").touch()++ files = find_files_in_dir(+ temp_dir,+ "*.py",+ is_recursive=True,+ excluded_dirs=[".venv"],+ force_include_dirs=["pipelex"],+ )++ file_names = [f.name for f in files]++ # Should include root, both pipelex directories (one from venv as included, one from src)+ assert len(files) == 3+ assert "root.py" in file_names+ assert "important.py" in file_names+ assert "also_important.py" in file_names+ assert "excluded.py" not in file_names++ def test_find_files_with_force_include_dirs_mixed_types(self):+ """Test finding files with force force include directories using both full paths and names."""+ with tempfile.TemporaryDirectory() as temp_dir:+ # Create files in root+ (Path(temp_dir) / "root.py").touch()++ # Create excluded directory structure+ venv_dir = Path(temp_dir) / ".venv"+ venv_packages = venv_dir / "lib" / "site-packages"+ venv_packages.mkdir(parents=True)++ # Include by full path+ pipelex_dir = venv_packages / "pipelex"+ pipelex_dir.mkdir()+ (pipelex_dir / "pipelex_file.py").touch()++ # Another excluded directory+ node_modules = Path(temp_dir) / "node_modules"+ node_modules.mkdir()+ (node_modules / "node_file.py").touch()++ # Include by name within node_modules+ special_dir = node_modules / "special"+ special_dir.mkdir()+ (special_dir / "special_file.py").touch()++ # Regular file in node_modules+ (node_modules / "regular_node.py").touch()++ files = find_files_in_dir(+ temp_dir,+ "*.py",+ is_recursive=True,+ excluded_dirs=[".venv", "node_modules"],+ force_include_dirs=[str(pipelex_dir), "special"],+ )++ file_names = [f.name for f in files]++ # Should include root, pipelex (full path include), and special (name include)+ assert len(files) == 3+ assert "root.py" in file_names+ assert "pipelex_file.py" in file_names+ assert "special_file.py" in file_names+ assert "node_file.py" not in file_names+ assert "regular_node.py" not in file_names++ def test_find_files_with_multiple_force_include_dirs_full_paths(self):+ """Test finding files with multiple force include directories using full paths."""+ with tempfile.TemporaryDirectory() as temp_dir:+ # Create files in root+ (Path(temp_dir) / "root.py").touch()++ # Create excluded directory+ venv_dir = Path(temp_dir) / ".venv"+ packages = venv_dir / "site-packages"+ packages.mkdir(parents=True)++ # First include directory+ pkg1 = packages / "package1"+ pkg1.mkdir()+ (pkg1 / "pkg1_file.py").touch()++ # Second include directory+ pkg2 = packages / "package2"+ pkg2.mkdir()+ (pkg2 / "pkg2_file.py").touch()++ # Non-included directory+ pkg3 = packages / "package3"+ pkg3.mkdir()+ (pkg3 / "pkg3_file.py").touch()++ files = find_files_in_dir(+ temp_dir,+ "*.py",+ is_recursive=True,+ excluded_dirs=[".venv"],+ force_include_dirs=[str(pkg1), str(pkg2)],+ )++ file_names = [f.name for f in files]++ assert len(files) == 3+ assert "root.py" in file_names+ assert "pkg1_file.py" in file_names+ assert "pkg2_file.py" in file_names+ assert "pkg3_file.py" not in file_names++ def test_find_files_with_deeply_nested_force_include(self):+ """Test finding files with deeply nested force include directories."""+ with tempfile.TemporaryDirectory() as temp_dir:+ # Create deeply nested structure+ deep_path = Path(temp_dir) / ".venv" / "lib" / "python3.11" / "site-packages" / "pipelex" / "builder"+ deep_path.mkdir(parents=True)+ (deep_path / "deep_file.py").touch()++ # Create file at intermediate level that should be excluded+ intermediate = Path(temp_dir) / ".venv" / "lib" / "python3.11" / "site-packages"+ (intermediate / "intermediate.py").touch()++ # Create file at root+ (Path(temp_dir) / "root.py").touch()++ files = find_files_in_dir(+ temp_dir,+ "*.py",+ is_recursive=True,+ excluded_dirs=[".venv"],+ force_include_dirs=[str(deep_path)],+ )++ file_names = [f.name for f in files]++ assert len(files) == 2+ assert "root.py" in file_names+ assert "deep_file.py" in file_names+ assert "intermediate.py" not in file_names++ def test_find_files_no_excluded_dirs(self):+ """Test that passing None for excluded_dirs works correctly."""+ with tempfile.TemporaryDirectory() as temp_dir:+ # Create files+ (Path(temp_dir) / "file1.py").touch()++ venv_dir = Path(temp_dir) / ".venv"+ venv_dir.mkdir()+ (venv_dir / "venv_file.py").touch()++ files = find_files_in_dir(temp_dir, "*.py", is_recursive=True, excluded_dirs=None)++ # Should find all files when no exclusions+ assert len(files) == 2+ file_names = [f.name for f in files]+ assert "file1.py" in file_names+ assert "venv_file.py" in file_names++ def test_find_files_no_force_include_dirs(self):+ """Test that passing None for force_include_dirs works correctly."""+ with tempfile.TemporaryDirectory() as temp_dir:+ # Create files+ (Path(temp_dir) / "file1.py").touch()++ venv_dir = Path(temp_dir) / ".venv"+ venv_dir.mkdir()+ (venv_dir / "venv_file.py").touch()++ files = find_files_in_dir(temp_dir, "*.py", is_recursive=True, excluded_dirs=[".venv"], force_include_dirs=None)++ # Should exclude all venv files when no includes+ assert len(files) == 1+ assert files[0].name == "file1.py"++ def test_find_files_force_include_not_in_excluded_dir(self):+ """Test that force include directories outside excluded directories are handled correctly."""+ with tempfile.TemporaryDirectory() as temp_dir:+ # Create normal directory+ src_dir = Path(temp_dir) / "src"+ src_dir.mkdir()+ (src_dir / "src_file.py").touch()++ # Create excluded directory+ venv_dir = Path(temp_dir) / ".venv"+ venv_dir.mkdir()+ (venv_dir / "venv_file.py").touch()++ # Include directory is in src, not in excluded dir+ files = find_files_in_dir(+ temp_dir,+ "*.py",+ is_recursive=True,+ excluded_dirs=[".venv"],+ force_include_dirs=[str(src_dir)],+ )++ # Should find src file (not excluded) but not venv file+ assert len(files) == 1+ assert files[0].name == "src_file.py"++ def test_find_files_pattern_matching(self):+ """Test that file pattern matching works correctly with exclusions."""+ with tempfile.TemporaryDirectory() as temp_dir:+ # Create various file types+ (Path(temp_dir) / "script.py").touch()+ (Path(temp_dir) / "data.json").touch()+ (Path(temp_dir) / "config.toml").touch()++ venv_dir = Path(temp_dir) / ".venv"+ venv_dir.mkdir()+ (venv_dir / "venv_script.py").touch()+ (venv_dir / "venv_data.json").touch()++ # Find only .py files+ py_files = find_files_in_dir(temp_dir, "*.py", is_recursive=True, excluded_dirs=[".venv"])+ assert len(py_files) == 1+ assert py_files[0].name == "script.py"++ # Find only .json files+ json_files = find_files_in_dir(temp_dir, "*.json", is_recursive=True, excluded_dirs=[".venv"])+ assert len(json_files) == 1+ assert json_files[0].name == "data.json"++ def test_find_files_empty_excluded_list(self):+ """Test that passing an empty list for excluded_dirs works correctly."""+ with tempfile.TemporaryDirectory() as temp_dir:+ (Path(temp_dir) / "file1.py").touch()++ venv_dir = Path(temp_dir) / ".venv"+ venv_dir.mkdir()+ (venv_dir / "venv_file.py").touch()++ files = find_files_in_dir(temp_dir, "*.py", is_recursive=True, excluded_dirs=[])++ # Empty list should behave like None - no exclusions+ assert len(files) == 2++ def test_find_files_empty_force_include_list(self):+ """Test that passing an empty list for force_include_dirs works correctly."""+ with tempfile.TemporaryDirectory() as temp_dir:+ (Path(temp_dir) / "file1.py").touch()++ venv_dir = Path(temp_dir) / ".venv"+ venv_dir.mkdir()+ (venv_dir / "venv_file.py").touch()++ files = find_files_in_dir(temp_dir, "*.py", is_recursive=True, excluded_dirs=[".venv"], force_include_dirs=[])++ # Empty include list should exclude all venv files+ assert len(files) == 1+ assert files[0].name == "file1.py"diff --git a/tests/unit/pipelex/tools/test_func_registry.py b/tests/unit/pipelex/tools/test_func_registry.pyindex aa6c41c4c..1e37e822e 100644--- a/tests/unit/pipelex/tools/test_func_registry.py+++ b/tests/unit/pipelex/tools/test_func_registry.py@@ -24,7 +24,7 @@ def valid_function(working_memory: WorkingMemory) -> TextContent: # noqa: ARG00# Valid async function for testing (should also be eligible)-async def valid_async_function(working_memory: WorkingMemory) -> TextContent: # noqa: ARG001 # pyright: ignore[reportUnknownParameterType,reportMissingParameterType, reportUnusedParameter]+async def valid_async_function(working_memory: WorkingMemory) -> TextContent: # noqa: ARG001,RUF029 # pyright: ignore[reportUnknownParameterType,reportMissingParameterType, reportUnusedParameter]return TextContent(text="test")diff --git a/tests/unit/pipelex/tools/test_func_registry_utils.py b/tests/unit/pipelex/tools/test_func_registry_utils.pyindex b69c696a1..20070cc0d 100644--- a/tests/unit/pipelex/tools/test_func_registry_utils.py+++ b/tests/unit/pipelex/tools/test_func_registry_utils.py@@ -229,7 +229,7 @@ async def nested_function(working_memory: WorkingMemory) -> TextContent:def test_eligibility_check_directly(self):# Valid async function- async def valid_async_function(working_memory: WorkingMemory) -> TextContent: # noqa: ARG001 # pyright: ignore[reportUnknownParameterType,reportMissingParameterType, reportUnusedParameter]+ async def valid_async_function(working_memory: WorkingMemory) -> TextContent: # noqa: ARG001,RUF029 # pyright: ignore[reportUnknownParameterType,reportMissingParameterType, reportUnusedParameter]return TextContent(text="test")# Valid sync function@@ -244,7 +244,7 @@ async def nested_function(working_memory: WorkingMemory) -> TextContent:func_registry.teardown()# Valid async function- async def valid_async_function(working_memory: WorkingMemory) -> TextContent: # noqa: ARG001 # pyright: ignore[reportUnknownParameterType,reportMissingParameterType, reportUnusedParameter]+ async def valid_async_function(working_memory: WorkingMemory) -> TextContent: # noqa: ARG001,RUF029 # pyright: ignore[reportUnknownParameterType,reportMissingParameterType, reportUnusedParameter]return TextContent(text="valid")# Valid sync function@@ -262,7 +262,7 @@ async def nested_function(working_memory: WorkingMemory) -> TextContent:# Test register_functions method as wellfunc_registry.teardown()- async def another_valid_async_function(working_memory: WorkingMemory) -> TextContent: # noqa: ARG001 # pyright: ignore[reportUnknownParameterType,reportMissingParameterType, reportUnusedParameter]+ async def another_valid_async_function(working_memory: WorkingMemory) -> TextContent: # noqa: ARG001,RUF029 # pyright: ignore[reportUnknownParameterType,reportMissingParameterType, reportUnusedParameter]return TextContent(text="another_valid_async")def another_valid_sync_function(working_memory: WorkingMemory) -> TextContent: # noqa: ARG001 # pyright: ignore[reportUnknownParameterType,reportMissingParameterType, reportUnusedParameter]diff --git a/tests/unit/pipelex/tools/typing/test_convert_file_path_to_module_path.py b/tests/unit/pipelex/tools/typing/test_convert_file_path_to_module_path.pyindex 262306b07..b410187d5 100644--- a/tests/unit/pipelex/tools/typing/test_convert_file_path_to_module_path.py+++ b/tests/unit/pipelex/tools/typing/test_convert_file_path_to_module_path.py@@ -156,7 +156,7 @@ class TestConvertFilePathToModulePath:# Create a deeply nested pathlong_path = tmp_pathfor i in range(10):- long_path = long_path / f"dir{i}"+ long_path /= f"dir{i}"file_path = str(long_path / "module.py")result = convert_file_path_to_module_path(file_path)# Should contain elements from all directory levels