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.

Silence datamodel-code-generator FutureWarning by selecting ruff formatters

Louis Choquel64da3aa684b0
diff --git a/pipelex/cogt/content_generation/schema_to_model_factory.py b/pipelex/cogt/content_generation/schema_to_model_factory.py
index 6a29bb9fe..a258721c8 100644
--- a/pipelex/cogt/content_generation/schema_to_model_factory.py
+++ b/pipelex/cogt/content_generation/schema_to_model_factory.py
@@ -162,6 +162,7 @@ class SchemaToModelFactory:
"""Generate Python source code from a JSON schema using datamodel-code-generator."""
from datamodel_code_generator import InputFileType, generate # noqa: PLC0415
from datamodel_code_generator.enums import DataModelType # noqa: PLC0415
+ from datamodel_code_generator.format import Formatter # noqa: PLC0415
cls._reject_unsafe_schema_extensions(schema)
@@ -176,6 +177,7 @@ class SchemaToModelFactory:
input_file_type=InputFileType.JsonSchema,
output=output_path,
output_model_type=DataModelType.PydanticV2BaseModel,
+ formatters=[Formatter.RUFF_FORMAT, Formatter.RUFF_CHECK],
)
return output_path.read_text(encoding="utf-8")
finally: