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.

Feature/ruff preview (#491)

Thomas Hebrard2cc6d0e8fd70
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d0b237354..4ebd06c3a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,12 +1,12 @@
# Changelog
-### [v0.17.1] - 2025-11-27
+## [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.py
index 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.py
index 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.py
index 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.py
index 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 output
config_healthy: Whether config files check passed
config_message: Message about config files status
config_missing_count: Number of missing config files
diff --git a/pipelex/cli/commands/init/command.py b/pipelex/cli/commands/init/command.py
index 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 start
is_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.py
index 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)))
break
diff --git a/pipelex/cli/commands/init/ui/telemetry_ui.py b/pipelex/cli/commands/init/ui/telemetry_ui.py
index 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.py
index 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.py
index 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 to
output_multiplicity: Output multiplicity setting
dynamic_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 to
output_multiplicity: Output multiplicity setting
dynamic_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.py
index 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.py
index 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.py
index 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, Field
from 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.py
index 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.py
index 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.py
index 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
############################################################
@classmethod
diff --git a/pipelex/core/concepts/helpers.py b/pipelex/core/concepts/helpers.py
index 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_code
diff --git a/pipelex/core/memory/working_memory.py b/pipelex/core/memory/working_memory.py
index 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.py
index 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 ValidationError
from pydantic_core import ErrorDetails
from pipelex.core.exceptions import PipesAndConceptValidationErrorData
from pipelex.core.interpreter.validation_error_categorizer import ErrorCatKey
from 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 message
else:
diff --git a/pipelex/core/pipes/pipe_abstract.py b/pipelex/core/pipes/pipe_abstract.py
index 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/stuffs/image_field_search.py b/pipelex/core/stuffs/image_field_search.py
index 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 images
if 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 type
diff --git a/pipelex/core/stuffs/stuff_artefact.py b/pipelex/core/stuffs/stuff_artefact.py
index 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 first
diff --git a/pipelex/language/plx_factory.py b/pipelex/language/plx_factory.py
index 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" + normalized
if 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/pipe_controllers/batch/pipe_batch.py b/pipelex/pipe_controllers/batch/pipe_batch.py
index 8469b1344..6b9fea6d1 100644
--- a/pipelex/pipe_controllers/batch/pipe_batch.py
+++ b/pipelex/pipe_controllers/batch/pipe_batch.py
@@ -34,8 +34,7 @@ class PipeBatch(PipeController):
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)
+ required_variables.update(variable_name for variable_name, _ in pipe.inputs.items)
# 2. Check that the input_list_stuff_name is in the inputs of the pipe
required_variables.remove(self.batch_params.input_item_stuff_name)
required_variables.add(self.batch_params.input_list_stuff_name)
diff --git a/pipelex/pipe_controllers/condition/pipe_condition.py b/pipelex/pipe_controllers/condition/pipe_condition.py
index 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.py
index 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_name
for 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"}
}
@override
diff --git a/pipelex/pipe_operators/compose/pipe_compose_blueprint.py b/pipelex/pipe_operators/compose/pipe_compose_blueprint.py
index 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.py
index 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_name
for 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_blueprint.py b/pipelex/pipe_operators/llm/pipe_llm_blueprint.py
index 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 inputs
input_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.py
index 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 = True
Args:
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.py
index 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 = None
job_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
@property
diff --git a/pipelex/plugins/anthropic/anthropic_factory.py b/pipelex/plugins/anthropic/anthropic_factory.py
index 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_prompt
messages: 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.py
index 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 Plugin
from pipelex.tools.aws.aws_config import AwsCredentialsError
-async def bedrock_list_available_models(
+def bedrock_list_available_models(
plugin: Plugin, # noqa: ARG001
backend: InferenceBackend, # noqa: ARG001
) -> list[dict[str, Any]]:
diff --git a/pipelex/plugins/mistral/mistral_factory.py b/pipelex/plugins/mistral/mistral_factory.py
index 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.py
index 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.py
index 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.py
index 9b7b16338..2b0dc2eb4 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 files
base_class: Optional base class to filter registerable classes
is_recursive: Whether to search recursively in subdirectories
- include_imported: Whether to include classes imported from other modules
is_include_imported: Whether to include classes imported from other modules
"""
diff --git a/pipelex/tools/log/log_formatter.py b/pipelex/tools/log/log_formatter.py
index 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.py
index 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 | None
lines = 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 None
diff --git a/pipelex/tools/misc/file_utils.py b/pipelex/tools/misc/file_utils.py
index 7854aa795..281b7c839 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_directory
if 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:
diff --git a/pipelex/tools/misc/string_utils.py b/pipelex/tools/misc/string_utils.py
index 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.py
index 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:
continue
diff --git a/pipelex/tools/typing/module_inspector.py b/pipelex/tools/typing/module_inspector.py
index 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] | None
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}"
@@ -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.py
index 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 values
field_default = None
diff --git a/pyproject.toml b/pyproject.toml
index 68f1e79a7..4ccaa446a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -261,6 +261,7 @@ target-version = "py311"
[tool.ruff.format]
[tool.ruff.lint]
+preview = true
select = ["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` instead
diff --git a/tests/integration/pipelex/cogt/test_llm_report.py b/tests/integration/pipelex/cogt/test_llm_report.py
index 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.py
index 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_files
diff --git a/tests/integration/pipelex/pipes/conftest.py b/tests/integration/pipelex/pipes/conftest.py
index 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 pytest
from pipelex.core.pipes.pipe_output import PipeOutput
from 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.py
index 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, neutral
if 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 variation
assert 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 2
word_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 values
if 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.py
index 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 list
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.py
index 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/pipe_operators/pipe_func/data.py b/tests/unit/pipelex/pipe_operators/pipe_func/data.py
index 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/test_func_registry.py b/tests/unit/pipelex/tools/test_func_registry.py
index 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.py
index 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 well
func_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.py
index 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 path
long_path = tmp_path
for 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