Skip to content

Commit a60c052

Browse files
authored
Add ruff format to CI checks (#128)
1 parent f599f82 commit a60c052

File tree

3 files changed

+63
-19
lines changed

3 files changed

+63
-19
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ jobs:
4646
- name: Install dependencies
4747
run: uv sync
4848

49+
- name: Check formatting
50+
run: uv run ruff format --check
51+
4952
- name: Run ruff
5053
run: uv run ruff check
5154

@@ -75,6 +78,9 @@ jobs:
7578
- name: Install dependencies
7679
run: uv sync --directory everyrow-mcp
7780

81+
- name: Check formatting
82+
run: uv run --directory everyrow-mcp ruff format --check
83+
7884
- name: Run ruff
7985
run: uv run --directory everyrow-mcp ruff check
8086

src/everyrow/ops.py

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ async def create_scalar_artifact(input: BaseModel, session: Session) -> UUID:
112112
data=CreateArtifactRequestDataType1.from_dict(input.model_dump()),
113113
session_id=session.session_id,
114114
)
115-
response = await create_artifact_artifacts_post.asyncio(client=session.client, body=body)
115+
response = await create_artifact_artifacts_post.asyncio(
116+
client=session.client, body=body
117+
)
116118
response = handle_response(response)
117119
return response.artifact_id
118120

@@ -124,7 +126,9 @@ async def create_table_artifact(input: DataFrame, session: Session) -> UUID:
124126
data=[CreateArtifactRequestDataType0Item.from_dict(r) for r in records],
125127
session_id=session.session_id,
126128
)
127-
response = await create_artifact_artifacts_post.asyncio(client=session.client, body=body)
129+
response = await create_artifact_artifacts_post.asyncio(
130+
client=session.client, body=body
131+
)
128132
response = handle_response(response)
129133
return response.artifact_id
130134

@@ -228,25 +232,35 @@ async def single_agent_async[T: BaseModel](
228232
return_table: bool = False,
229233
) -> EveryrowTask[T]:
230234
"""Submit a single_agent task asynchronously."""
231-
input_data = _prepare_single_input(input, SingleAgentOperationInputType1Item, SingleAgentOperationInputType2)
235+
input_data = _prepare_single_input(
236+
input, SingleAgentOperationInputType1Item, SingleAgentOperationInputType2
237+
)
232238

233239
# Build the operation body with either preset or custom params
234240
body = SingleAgentOperation(
235241
input_=input_data, # type: ignore
236242
task=task,
237243
session_id=session.session_id,
238-
response_schema=SingleAgentOperationResponseSchemaType0.from_dict(response_model.model_json_schema()),
239-
effort_level=PublicEffortLevel(effort_level.value) if effort_level is not None else UNSET,
244+
response_schema=SingleAgentOperationResponseSchemaType0.from_dict(
245+
response_model.model_json_schema()
246+
),
247+
effort_level=PublicEffortLevel(effort_level.value)
248+
if effort_level is not None
249+
else UNSET,
240250
llm=LLMEnumPublic(llm.value) if llm is not None else UNSET,
241251
iteration_budget=iteration_budget if iteration_budget is not None else UNSET,
242252
include_research=include_research if include_research is not None else UNSET,
243253
return_list=return_table,
244254
)
245255

246-
response = await single_agent_operations_single_agent_post.asyncio(client=session.client, body=body)
256+
response = await single_agent_operations_single_agent_post.asyncio(
257+
client=session.client, body=body
258+
)
247259
response = handle_response(response)
248260

249-
cohort_task: EveryrowTask[T] = EveryrowTask(response_model=response_model, is_map=False, is_expand=return_table)
261+
cohort_task: EveryrowTask[T] = EveryrowTask(
262+
response_model=response_model, is_map=False, is_expand=return_table
263+
)
250264
cohort_task.set_submitted(response.task_id, response.session_id, session.client)
251265
return cohort_task
252266

@@ -336,19 +350,27 @@ async def agent_map_async(
336350
input_=input_data, # type: ignore
337351
task=task,
338352
session_id=session.session_id,
339-
response_schema=AgentMapOperationResponseSchemaType0.from_dict(response_model.model_json_schema()),
340-
effort_level=PublicEffortLevel(effort_level.value) if effort_level is not None else UNSET,
353+
response_schema=AgentMapOperationResponseSchemaType0.from_dict(
354+
response_model.model_json_schema()
355+
),
356+
effort_level=PublicEffortLevel(effort_level.value)
357+
if effort_level is not None
358+
else UNSET,
341359
llm=LLMEnumPublic(llm.value) if llm is not None else UNSET,
342360
iteration_budget=iteration_budget if iteration_budget is not None else UNSET,
343361
include_research=include_research if include_research is not None else UNSET,
344362
join_with_input=True,
345363
enforce_row_independence=enforce_row_independence,
346364
)
347365

348-
response = await agent_map_operations_agent_map_post.asyncio(client=session.client, body=body)
366+
response = await agent_map_operations_agent_map_post.asyncio(
367+
client=session.client, body=body
368+
)
349369
response = handle_response(response)
350370

351-
cohort_task = EveryrowTask(response_model=response_model, is_map=True, is_expand=False)
371+
cohort_task = EveryrowTask(
372+
response_model=response_model, is_map=True, is_expand=False
373+
)
352374
cohort_task.set_submitted(response.task_id, response.session_id, session.client)
353375
return cohort_task
354376

@@ -387,7 +409,9 @@ async def screen[T: BaseModel](
387409
if isinstance(result, TableResult):
388410
return result
389411
raise EveryrowError("Screen task did not return a table result")
390-
cohort_task = await screen_async(task=task, session=session, input=input, response_model=response_model)
412+
cohort_task = await screen_async(
413+
task=task, session=session, input=input, response_model=response_model
414+
)
391415
result = await cohort_task.await_result()
392416
if isinstance(result, TableResult):
393417
return result
@@ -408,10 +432,14 @@ async def screen_async[T: BaseModel](
408432
input_=input_data, # type: ignore
409433
task=task,
410434
session_id=session.session_id,
411-
response_schema=ScreenOperationResponseSchemaType0.from_dict(actual_response_model.model_json_schema()),
435+
response_schema=ScreenOperationResponseSchemaType0.from_dict(
436+
actual_response_model.model_json_schema()
437+
),
412438
)
413439

414-
response = await screen_operations_screen_post.asyncio(client=session.client, body=body)
440+
response = await screen_operations_screen_post.asyncio(
441+
client=session.client, body=body
442+
)
415443
response = handle_response(response)
416444

417445
cohort_task: EveryrowTask[T] = EveryrowTask(
@@ -498,7 +526,9 @@ async def rank_async[T: BaseModel](
498526
# Validate that field_name exists in the model
499527
properties = response_schema.get("properties", {})
500528
if field_name not in properties:
501-
raise ValueError(f"Field {field_name} not in response model {response_model.__name__}")
529+
raise ValueError(
530+
f"Field {field_name} not in response model {response_model.__name__}"
531+
)
502532
else:
503533
# Build a minimal JSON schema with just the sort field
504534
json_type_map = {
@@ -509,7 +539,9 @@ async def rank_async[T: BaseModel](
509539
}
510540
response_schema = {
511541
"type": "object",
512-
"properties": {field_name: {"type": json_type_map.get(field_type, field_type)}},
542+
"properties": {
543+
field_name: {"type": json_type_map.get(field_type, field_type)}
544+
},
513545
"required": [field_name],
514546
}
515547

@@ -625,7 +657,9 @@ async def merge_async(
625657
session_id=session.session_id,
626658
)
627659

628-
response = await merge_operations_merge_post.asyncio(client=session.client, body=body)
660+
response = await merge_operations_merge_post.asyncio(
661+
client=session.client, body=body
662+
)
629663
response = handle_response(response)
630664

631665
merge_task = MergeTask()
@@ -720,7 +754,9 @@ async def dedupe_async(
720754
strategy_prompt=strategy_prompt if strategy_prompt is not None else UNSET,
721755
)
722756

723-
response = await dedupe_operations_dedupe_post.asyncio(client=session.client, body=body)
757+
response = await dedupe_operations_dedupe_post.asyncio(
758+
client=session.client, body=body
759+
)
724760
response = handle_response(response)
725761

726762
cohort_task = EveryrowTask(response_model=BaseModel, is_map=True, is_expand=False)

src/everyrow/session.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ async def create_session(
6363
try:
6464
response = await create_session_endpoint_sessions_post.asyncio(
6565
client=client,
66-
body=CreateSession(name=name or f"everyrow-sdk-session-{datetime.now().isoformat()}"),
66+
body=CreateSession(
67+
name=name or f"everyrow-sdk-session-{datetime.now().isoformat()}"
68+
),
6769
)
6870
response = handle_response(response)
6971
session = Session(client=client, session_id=response.session_id)

0 commit comments

Comments
 (0)