Skip to content

Commit 25ba606

Browse files
Add inline ignores for obvious unused argument cases
- Deprecated functions, framework callbacks, future extension parameters - Fixed import type checking issue by moving import out of TYPE_CHECKING - Added noqa comments for legitimate unused parameters
1 parent 058c70e commit 25ba606

File tree

9 files changed

+130
-9
lines changed

9 files changed

+130
-9
lines changed

LINTING-CALLOUTS.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Linting Callouts and Remaining Issues
2+
3+
## Summary
4+
Fixed 213 out of 335 linting issues (63% improvement). Remaining 122 issues are mostly in tutorial files and specific edge cases.
5+
6+
## Questions/Decisions Needed
7+
8+
### 1. Tutorial Print Statements (T201)
9+
**Status**: Left as-is
10+
**Issue**: Many tutorial notebooks and example files contain `print()` statements
11+
**Question**: Should tutorial `print()` statements be left for educational purposes, or converted to logger calls?
12+
**Files**: All tutorial dev.ipynb files, tutorial project files
13+
14+
### 2. Unused Arguments in Workflow/Activity Functions (ARG001/ARG002)
15+
**Status**: Partially fixed
16+
**Issue**: Many temporal workflow and activity functions have unused `context` parameters that are required by the framework
17+
**Question**: Should these be prefixed with underscore or left as-is since they're part of the temporal interface?
18+
**Files**:
19+
- `examples/tutorials/10_agentic/10_temporal/*/project/workflow.py`
20+
- Various activity and handler functions
21+
22+
### 3. Test File Print Statements
23+
**Status**: Left as-is
24+
**Issue**: Test runner and dev tools intentionally use print for user output
25+
**Files**:
26+
- `src/agentex/lib/sdk/fastacp/tests/run_tests.py`
27+
- `src/agentex/lib/utils/dev_tools/async_messages.py`
28+
29+
### 4. Debug Template Import Error Setup
30+
**Status**: Left error print statements
31+
**Issue**: Debug setup in templates still uses print() for error cases (ImportError, Exception)
32+
**Question**: Should error messages stay as print() to ensure they're visible even if logging isn't set up?
33+
34+
## Remaining Issues by Category
35+
36+
### Print Statements (T201) - 85 issues
37+
- **Tutorial notebooks**: 67 issues across example/tutorial dev.ipynb files
38+
- **Test/Dev tools**: 15 issues in test runners and dev utilities
39+
- **Template error handling**: 3 issues in Jinja template error cases
40+
41+
### Unused Arguments (ARG*) - 36 issues
42+
- **Temporal workflows**: Required by framework but unused
43+
- **Test fixtures**: Standard pytest/test patterns
44+
- **CLI init functions**: Legacy parameters
45+
- **Lambda functions**: Anonymous function parameters
46+
47+
### Import Issues (I001, F401, TC004) - 1 issue
48+
- **Type checking import**: One import used outside type checking block
49+
50+
## Fixed Issues (213 total)
51+
- ✅ Import sorting (I001): 190+ issues
52+
- ✅ Unused imports (F401): Multiple files
53+
- ✅ Exception handling (B904): Added proper exception chaining
54+
- ✅ Return in finally (B012): Restructured exception handling
55+
- ✅ Bare except (E722): Specified Exception type
56+
- ✅ Blind exception assert (B017): Specified exact exception types
57+
- ✅ Core library print statements: Converted to logger calls
58+
- ✅ Template print statements: Fixed debug logging in Jinja templates
59+
60+
## Recommendations for PR Discussion
61+
62+
1. **Tutorial Policy**: Establish whether tutorials should use print() or logger
63+
2. **Framework Interface**: Decide on unused parameter naming for temporal/framework interfaces
64+
3. **Test Output**: Confirm test runners should keep print() for user visibility
65+
4. **Error Handling**: Review if debug setup errors should remain as print() statements
66+
67+
## Files with Significant Remaining Issues
68+
- Tutorial notebooks: All dev.ipynb files (print statements)
69+
- `examples/tutorials/10_agentic/00_base/090_multi_agent_non_temporal/project/state_machines/content_workflow.py` (8 unused arguments)
70+
- `examples/tutorials/10_agentic/10_temporal/050_agent_chat_guardrails/project/workflow.py` (10 unused arguments)
71+
- Various test files (unused test fixture parameters)

examples/tutorials/10_agentic/00_base/080_batch_events/dev.ipynb

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,56 @@
5050
"id": "3",
5151
"metadata": {},
5252
"outputs": [],
53-
"source": "from agentex.lib.utils.dev_tools import subscribe_to_async_task_messages\nfrom agentex.types import Event\nfrom agentex.types.agent_rpc_params import ParamsSendEventRequest\n\n# The response is expected to be a list of TaskMessage objects, which is a union of the following types:\n# - TextContent: A message with just text content \n# - DataContent: A message with JSON-serializable data content\n# - ToolRequestContent: A message with a tool request, which contains a JSON-serializable request to call a tool\n# - ToolResponseContent: A message with a tool response, which contains response object from a tool call in its content\n\n# When processing the message/send response, if you are expecting more than TextContent, such as DataContent, ToolRequestContent, or ToolResponseContent, you can process them as well\n\nconcurrent_event_messages: list[ParamsSendEventRequest] = [\n {\n \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Hello, what can you do?\"},\n \"task_id\": task.id,\n },\n {\n \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Can you tell me a joke?\"},\n \"task_id\": task.id,\n },\n {\n \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"What is the capital of France?\"},\n \"task_id\": task.id,\n },\n {\n \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Write a short story about a cat\"},\n \"task_id\": task.id,\n },\n {\n \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Tell me how an LLM works\"},\n \"task_id\": task.id,\n },\n]\n\nevents: list[Event] = []\n\nfor event_message in concurrent_event_messages:\n rpc_response = client.agents.send_event(\n agent_name=AGENT_NAME,\n params=event_message\n )\n\n event = rpc_response.result\n events.append(event)\n\nfor event in events:\n print(event)"
53+
"source": [
54+
"from agentex.types import Event\n",
55+
"from agentex.lib.utils.dev_tools import subscribe_to_async_task_messages\n",
56+
"from agentex.types.agent_rpc_params import ParamsSendEventRequest\n",
57+
"\n",
58+
"# The response is expected to be a list of TaskMessage objects, which is a union of the following types:\n",
59+
"# - TextContent: A message with just text content \n",
60+
"# - DataContent: A message with JSON-serializable data content\n",
61+
"# - ToolRequestContent: A message with a tool request, which contains a JSON-serializable request to call a tool\n",
62+
"# - ToolResponseContent: A message with a tool response, which contains response object from a tool call in its content\n",
63+
"\n",
64+
"# When processing the message/send response, if you are expecting more than TextContent, such as DataContent, ToolRequestContent, or ToolResponseContent, you can process them as well\n",
65+
"\n",
66+
"concurrent_event_messages: list[ParamsSendEventRequest] = [\n",
67+
" {\n",
68+
" \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Hello, what can you do?\"},\n",
69+
" \"task_id\": task.id,\n",
70+
" },\n",
71+
" {\n",
72+
" \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Can you tell me a joke?\"},\n",
73+
" \"task_id\": task.id,\n",
74+
" },\n",
75+
" {\n",
76+
" \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"What is the capital of France?\"},\n",
77+
" \"task_id\": task.id,\n",
78+
" },\n",
79+
" {\n",
80+
" \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Write a short story about a cat\"},\n",
81+
" \"task_id\": task.id,\n",
82+
" },\n",
83+
" {\n",
84+
" \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Tell me how an LLM works\"},\n",
85+
" \"task_id\": task.id,\n",
86+
" },\n",
87+
"]\n",
88+
"\n",
89+
"events: list[Event] = []\n",
90+
"\n",
91+
"for event_message in concurrent_event_messages:\n",
92+
" rpc_response = client.agents.send_event(\n",
93+
" agent_name=AGENT_NAME,\n",
94+
" params=event_message\n",
95+
" )\n",
96+
"\n",
97+
" event = rpc_response.result\n",
98+
" events.append(event)\n",
99+
"\n",
100+
"for event in events:\n",
101+
" print(event)"
102+
]
54103
},
55104
{
56105
"cell_type": "code",

src/agentex/lib/cli/commands/init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def create_project_structure(
8686
console.print(f"\n[green]✓[/green] Created project structure at: {project_dir}")
8787

8888

89-
def get_project_context(answers: Dict[str, Any], project_path: Path, manifest_root: Path) -> Dict[str, Any]:
89+
def get_project_context(answers: Dict[str, Any], project_path: Path, manifest_root: Path) -> Dict[str, Any]: # noqa: ARG001
9090
"""Get the project context from user answers"""
9191
# Use agent_directory_name as project_name
9292
project_name = answers["agent_directory_name"].replace("-", "_")

src/agentex/lib/cli/debug/debug_handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
from typing import TYPE_CHECKING, Dict
1010
from pathlib import Path
1111

12+
import asyncio.subprocess
1213
from rich.console import Console
1314

1415
if TYPE_CHECKING:
15-
import asyncio.subprocess
16+
pass
1617

1718
from agentex.lib.utils.logging import make_logger
1819

src/agentex/lib/cli/utils/auth_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# DEPRECATED: Old function for backward compatibility
1010
# Will be removed in future version
11-
def _encode_principal_context(manifest: AgentManifest) -> str | None:
11+
def _encode_principal_context(manifest: AgentManifest) -> str | None: # noqa: ARG001
1212
"""
1313
DEPRECATED: This function is deprecated as AgentManifest no longer contains auth.
1414
Use _encode_principal_context_from_env_config instead.

src/agentex/lib/core/temporal/activities/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import httpx
22
from scale_gp import SGPClient, SGPClientError
33

4-
from agentex import AsyncAgentex
4+
from agentex import AsyncAgentex # noqa: F401
55
from agentex.lib.core.tracing import AsyncTracer
66
from agentex.lib.core.services.adk.state import StateService
77
from agentex.lib.core.services.adk.tasks import TasksService

src/agentex/lib/core/tracing/processors/agentex_tracing_processor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
class AgentexSyncTracingProcessor(SyncTracingProcessor):
14-
def __init__(self, config: AgentexTracingProcessorConfig):
14+
def __init__(self, config: AgentexTracingProcessorConfig): # noqa: ARG002
1515
self.client = Agentex()
1616

1717
@override
@@ -65,7 +65,7 @@ def shutdown(self) -> None:
6565

6666

6767
class AgentexAsyncTracingProcessor(AsyncTracingProcessor):
68-
def __init__(self, config: AgentexTracingProcessorConfig):
68+
def __init__(self, config: AgentexTracingProcessorConfig): # noqa: ARG002
6969
self.client = create_async_agentex_client()
7070

7171
@override

src/agentex/lib/sdk/fastacp/base/base_acp_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def _setup_handlers(self):
7373

7474
def get_lifespan_function(self):
7575
@asynccontextmanager
76-
async def lifespan_context(app: FastAPI):
76+
async def lifespan_context(app: FastAPI): # noqa: ARG001
7777
env_vars = EnvironmentVariables.refresh()
7878
if env_vars.AGENTEX_BASE_URL:
7979
await register_agent(env_vars)

src/agentex/lib/sdk/fastacp/fastacp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class FastACP:
3333

3434
@staticmethod
3535
# Note: the config is optional and not used right now but is there to be extended in the future
36-
def create_sync_acp(config: SyncACPConfig | None = None, **kwargs) -> SyncACP:
36+
def create_sync_acp(config: SyncACPConfig | None = None, **kwargs) -> SyncACP: # noqa: ARG004
3737
"""Create a SyncACP instance"""
3838
return SyncACP.create(**kwargs)
3939

0 commit comments

Comments
 (0)