mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2026-04-28 03:30:10 +00:00
Fix all deprecation warnings on startup (#SKY-8131) (#5068)
This commit is contained in:
parent
0623d61d6a
commit
913b15d618
7 changed files with 59 additions and 49 deletions
|
|
@ -111,6 +111,7 @@ def run_server() -> None:
|
|||
port=port,
|
||||
log_level="info",
|
||||
factory=True,
|
||||
ws="websockets-sansio",
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -237,6 +238,8 @@ def run_dev() -> None:
|
|||
"--port",
|
||||
str(skyvern_settings.PORT),
|
||||
"--factory",
|
||||
"--ws",
|
||||
"websockets-sansio",
|
||||
],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
|
|
|
|||
|
|
@ -43,4 +43,5 @@ if __name__ == "__main__":
|
|||
f"{artifact_path_for_excludes}/{settings.ENV}/**/scripts/**/**/*.py",
|
||||
],
|
||||
factory=True,
|
||||
ws="websockets-sansio",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -282,11 +282,17 @@ async def create_credential(
|
|||
data: CreateCredentialRequest = Body(
|
||||
...,
|
||||
description="The credential data to create",
|
||||
example={
|
||||
"name": "My Credential",
|
||||
"credential_type": "PASSWORD",
|
||||
"credential": {"username": "user@example.com", "password": "securepassword123", "totp": "JBSWY3DPEHPK3PXP"},
|
||||
},
|
||||
examples=[
|
||||
{
|
||||
"name": "My Credential",
|
||||
"credential_type": "PASSWORD",
|
||||
"credential": {
|
||||
"username": "user@example.com",
|
||||
"password": "securepassword123",
|
||||
"totp": "JBSWY3DPEHPK3PXP",
|
||||
},
|
||||
},
|
||||
],
|
||||
openapi_extra={"x-fern-sdk-parameter-name": "data"},
|
||||
),
|
||||
current_org: Organization = Depends(org_auth_service.get_current_org),
|
||||
|
|
@ -1201,11 +1207,13 @@ async def update_credential(
|
|||
data: CreateCredentialRequest = Body(
|
||||
...,
|
||||
description="The new credential data to store",
|
||||
example={
|
||||
"name": "My Credential",
|
||||
"credential_type": "PASSWORD",
|
||||
"credential": {"username": "user@example.com", "password": "newpassword123"},
|
||||
},
|
||||
examples=[
|
||||
{
|
||||
"name": "My Credential",
|
||||
"credential_type": "PASSWORD",
|
||||
"credential": {"username": "user@example.com", "password": "newpassword123"},
|
||||
},
|
||||
],
|
||||
openapi_extra={"x-fern-sdk-parameter-name": "data"},
|
||||
),
|
||||
current_org: Organization = Depends(org_auth_service.get_current_org),
|
||||
|
|
|
|||
|
|
@ -5719,34 +5719,34 @@ class BranchCondition(BaseModel):
|
|||
is_default: bool = False
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_condition(cls, condition_obj: BranchCondition) -> BranchCondition:
|
||||
if isinstance(condition_obj.criteria, dict):
|
||||
criteria_type = condition_obj.criteria.get("criteria_type")
|
||||
def validate_condition(self) -> BranchCondition:
|
||||
if isinstance(self.criteria, dict):
|
||||
criteria_type = self.criteria.get("criteria_type")
|
||||
if criteria_type is None:
|
||||
# Infer criteria type from expression format
|
||||
expression = condition_obj.criteria.get("expression", "")
|
||||
expression = self.criteria.get("expression", "")
|
||||
if _is_pure_jinja_expression(expression):
|
||||
criteria_type = "jinja2_template"
|
||||
else:
|
||||
criteria_type = "prompt"
|
||||
if criteria_type == "prompt":
|
||||
condition_obj.criteria = PromptBranchCriteria(**condition_obj.criteria)
|
||||
self.criteria = PromptBranchCriteria(**self.criteria)
|
||||
else:
|
||||
condition_obj.criteria = JinjaBranchCriteria(**condition_obj.criteria)
|
||||
if condition_obj.criteria is None and not condition_obj.is_default:
|
||||
self.criteria = JinjaBranchCriteria(**self.criteria)
|
||||
if self.criteria is None and not self.is_default:
|
||||
raise ValueError("Branches without criteria must be marked as default.")
|
||||
if condition_obj.criteria is not None and condition_obj.is_default:
|
||||
if self.criteria is not None and self.is_default:
|
||||
raise ValueError("Default branches may not define criteria.")
|
||||
if condition_obj.criteria and isinstance(condition_obj.criteria, BranchCriteria):
|
||||
expression = condition_obj.criteria.expression
|
||||
criteria_dict = condition_obj.criteria.model_dump()
|
||||
if self.criteria and isinstance(self.criteria, BranchCriteria):
|
||||
expression = self.criteria.expression
|
||||
criteria_dict = self.criteria.model_dump()
|
||||
if _is_pure_jinja_expression(expression):
|
||||
criteria_dict["criteria_type"] = "jinja2_template"
|
||||
condition_obj.criteria = JinjaBranchCriteria(**criteria_dict)
|
||||
self.criteria = JinjaBranchCriteria(**criteria_dict)
|
||||
else:
|
||||
criteria_dict["criteria_type"] = "prompt"
|
||||
condition_obj.criteria = PromptBranchCriteria(**criteria_dict)
|
||||
return condition_obj
|
||||
self.criteria = PromptBranchCriteria(**criteria_dict)
|
||||
return self
|
||||
|
||||
|
||||
class ConditionalBlock(Block):
|
||||
|
|
@ -5759,15 +5759,15 @@ class ConditionalBlock(Block):
|
|||
branch_conditions: list[BranchCondition] = Field(default_factory=list)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_branches(cls, block: ConditionalBlock) -> ConditionalBlock:
|
||||
if not block.branch_conditions:
|
||||
def validate_branches(self) -> ConditionalBlock:
|
||||
if not self.branch_conditions:
|
||||
raise ValueError("Conditional blocks require at least one branch.")
|
||||
|
||||
default_branches = [branch for branch in block.branch_conditions if branch.is_default]
|
||||
default_branches = [branch for branch in self.branch_conditions if branch.is_default]
|
||||
if len(default_branches) > 1:
|
||||
raise ValueError("Only one default branch is permitted per conditional block.")
|
||||
|
||||
return block
|
||||
return self
|
||||
|
||||
def get_all_parameters(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class FolderBase(BaseModel):
|
||||
|
|
@ -22,15 +22,14 @@ class FolderUpdate(BaseModel):
|
|||
class Folder(FolderBase):
|
||||
"""Response model for a folder"""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
folder_id: str
|
||||
organization_id: str
|
||||
workflow_count: int = Field(0, description="Number of workflows in this folder")
|
||||
created_at: datetime
|
||||
modified_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class UpdateWorkflowFolderRequest(BaseModel):
|
||||
"""Request model for updating a workflow's folder assignment"""
|
||||
|
|
|
|||
|
|
@ -654,12 +654,12 @@ class BranchConditionYAML(BaseModel):
|
|||
is_default: bool = False
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_condition(cls, condition: "BranchConditionYAML") -> "BranchConditionYAML":
|
||||
if condition.criteria is None and not condition.is_default:
|
||||
def validate_condition(self) -> "BranchConditionYAML":
|
||||
if self.criteria is None and not self.is_default:
|
||||
raise ValueError("Branches without criteria must be marked as default.")
|
||||
if condition.criteria is not None and condition.is_default:
|
||||
if self.criteria is not None and self.is_default:
|
||||
raise ValueError("Default branches may not define criteria.")
|
||||
return condition
|
||||
return self
|
||||
|
||||
|
||||
class ConditionalBlockYAML(BlockYAML):
|
||||
|
|
@ -668,15 +668,15 @@ class ConditionalBlockYAML(BlockYAML):
|
|||
branch_conditions: list[BranchConditionYAML] = Field(default_factory=list)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_branches(cls, block: "ConditionalBlockYAML") -> "ConditionalBlockYAML":
|
||||
if not block.branch_conditions:
|
||||
def validate_branches(self) -> "ConditionalBlockYAML":
|
||||
if not self.branch_conditions:
|
||||
raise ValueError("Conditional blocks require at least one branch.")
|
||||
|
||||
default_branches = [branch for branch in block.branch_conditions if branch.is_default]
|
||||
default_branches = [branch for branch in self.branch_conditions if branch.is_default]
|
||||
if len(default_branches) > 1:
|
||||
raise ValueError("Only one default branch is permitted per conditional block.")
|
||||
|
||||
return block
|
||||
return self
|
||||
|
||||
|
||||
class CodeBlockYAML(BlockYAML):
|
||||
|
|
@ -1039,8 +1039,8 @@ class WorkflowDefinitionYAML(BaseModel):
|
|||
finally_block_label: str | None = None
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_unique_block_labels(cls, workflow: "WorkflowDefinitionYAML") -> "WorkflowDefinitionYAML":
|
||||
labels = [block.label for block in workflow.blocks]
|
||||
def validate_unique_block_labels(self) -> "WorkflowDefinitionYAML":
|
||||
labels = [block.label for block in self.blocks]
|
||||
duplicates = [label for label in labels if labels.count(label) > 1]
|
||||
|
||||
if duplicates:
|
||||
|
|
@ -1050,13 +1050,13 @@ class WorkflowDefinitionYAML(BaseModel):
|
|||
f"Found duplicate label(s): {', '.join(unique_duplicates)}"
|
||||
)
|
||||
|
||||
if workflow.finally_block_label and workflow.finally_block_label not in labels:
|
||||
if self.finally_block_label and self.finally_block_label not in labels:
|
||||
raise ValueError(
|
||||
f"finally_block_label '{workflow.finally_block_label}' does not reference a valid block. "
|
||||
f"finally_block_label '{self.finally_block_label}' does not reference a valid block. "
|
||||
f"Available labels: {', '.join(labels) if labels else '(none)'}"
|
||||
)
|
||||
|
||||
return workflow
|
||||
return self
|
||||
|
||||
|
||||
class WorkflowCreateYAMLRequest(BaseModel):
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import enum
|
|||
import typing as t
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from skyvern.client.types.workflow_definition_yaml_blocks_item import (
|
||||
WorkflowDefinitionYamlBlocksItem_Action,
|
||||
|
|
@ -103,10 +103,9 @@ class TargetInfo(BaseModel):
|
|||
|
||||
|
||||
class CdpEventFrame(BaseModel):
|
||||
url: str | None = None
|
||||
model_config = ConfigDict(extra="allow")
|
||||
|
||||
class Config:
|
||||
extra = "allow"
|
||||
url: str | None = None
|
||||
|
||||
|
||||
class ExfiltratedEventCdpParams(BaseModel):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue