Skip to content

Commit 76c9266

Browse files
committed
Fix pydoctor warnings and raise warnings as errors when generating docs
1 parent 4f4af2c commit 76c9266

File tree

16 files changed

+34
-34
lines changed

16 files changed

+34
-34
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ intersphinx = [
158158
"https://docs.python.org/3/objects.inv",
159159
"https://googleapis.dev/python/protobuf/latest/objects.inv",
160160
"https://opentelemetry-python.readthedocs.io/en/latest/objects.inv",
161+
"https://nexus-rpc.github.io/sdk-python/objects.inv",
161162
]
162163
privacy = [
163164
"PRIVATE:temporalio.bridge",
@@ -177,6 +178,7 @@ privacy = [
177178
]
178179
project-name = "Temporal Python"
179180
sidebar-expand-depth = 2
181+
warnings-as-errors = true
180182

181183
[tool.pyright]
182184
enableTypeIgnoreComments = true

temporalio/activity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def wait_sync(self, timeout: Optional[float] = None) -> None:
288288
def client() -> Client:
289289
"""Return a Temporal Client for use in the current activity.
290290
291-
The client is only available in `async def` activities.
291+
The client is only available in ``async def`` activities.
292292
293293
In tests it is not available automatically, but you can pass a client when creating a
294294
:py:class:`temporalio.testing.ActivityEnvironment`.

temporalio/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ def to_canonical_string(self) -> str:
10881088
@staticmethod
10891089
def from_canonical_string(canonical: str) -> WorkerDeploymentVersion:
10901090
"""Parse a version from a canonical string, which must be in the format
1091-
`<deployment_name>.<build_id>`. Deployment name must not have a `.` in it.
1091+
`<deployment_name>.<build_id>`. Deployment name must not have a ``.`` in it.
10921092
"""
10931093
parts = canonical.split(".", maxsplit=1)
10941094
if len(parts) != 2:

temporalio/contrib/openai_agents/workflow.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ def activity_as_tool(
6060
of inputs and outputs between the agent and the activity. Note that if you take a context,
6161
mutation will not be persisted, as the activity may not be running in the same location.
6262
63+
For undocumented arguments, refer to :py:mod:`workflow` and :py:meth:`start_activity`
64+
6365
Args:
6466
fn: A Temporal activity function to convert to a tool.
6567
strict_json_schema: Whether the tool should follow a strict schema.
6668
See https://openai.github.io/openai-agents-python/ref/tool/#agents.tool.FunctionTool.strict_json_schema
67-
For other arguments, refer to :py:mod:`workflow` :py:meth:`start_activity`
69+
6870
6971
Returns:
7072
An OpenAI agent tool that wraps the provided activity.
@@ -178,7 +180,7 @@ def nexus_operation_as_tool(
178180
of inputs and outputs between the agent and the operation.
179181
180182
Args:
181-
fn: A Nexus operation to convert into a tool.
183+
operation: A Nexus operation to convert into a tool.
182184
service: The Nexus service class that contains the operation.
183185
endpoint: The Nexus endpoint to use for the operation.
184186
strict_json_schema: Whether the tool should follow a strict schema

temporalio/envconfig.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class ClientConfigProfile:
184184
"""Represents a client configuration profile.
185185
186186
This class holds the configuration as loaded from a file or environment.
187-
See `to_connect_config` to transform the profile to `ClientConnectConfig`,
187+
See `to_client_connect_config` to transform the profile to `ClientConnectConfig`,
188188
which can be used to create a client.
189189
190190
.. warning::
@@ -304,8 +304,8 @@ class ClientConfig:
304304
"""Client configuration loaded from TOML and environment variables.
305305
306306
This contains a mapping of profile names to client profiles. Use
307-
`ClientConfigProfile.to_connect_config` to create a `ClientConnectConfig`
308-
from a profile. See `load_profile` to load an individual profile.
307+
`ClientConfigProfile.to_client_connect_config` to create a `ClientConnectConfig`
308+
from a profile. See `ClientConfigProfile.load` to load an individual profile.
309309
310310
.. warning::
311311
Experimental API.

temporalio/nexus/_operation_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async def _cancel_workflow(
9191
9292
Args:
9393
token: The token of the workflow to cancel. kwargs: Additional keyword arguments
94-
to pass to the workflow cancel method.
94+
to pass to the workflow cancel method.
9595
"""
9696
try:
9797
nexus_workflow_handle = WorkflowHandle[Any].from_token(token)

temporalio/nexus/_util.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def get_workflow_run_start_method_input_and_output_type_annotations(
3939
]:
4040
"""Return operation input and output types.
4141
42-
`start` must be a type-annotated start method that returns a
42+
``start`` must be a type-annotated start method that returns a
4343
:py:class:`temporalio.nexus.WorkflowHandle`.
4444
"""
4545
input_type, output_type = _get_start_method_input_and_output_type_annotations(start)
@@ -125,7 +125,7 @@ def get_operation_factory(
125125
Optional[Callable[[Any], Any]],
126126
Optional[nexusrpc.Operation[Any, Any]],
127127
]:
128-
"""Return the :py:class:`Operation` for the object along with the factory function.
128+
"""Return the :py:class:`nexusrpc.Operation` for the object along with the factory function.
129129
130130
``obj`` should be a decorated operation start method.
131131
"""
@@ -145,7 +145,7 @@ def set_operation_factory(
145145
obj: Any,
146146
operation_factory: Callable[[Any], Any],
147147
) -> None:
148-
"""Set the :py:class:`OperationHandler` factory for this object.
148+
"""Set the :py:class:`nexusrpc.handler.OperationHandler` factory for this object.
149149
150150
``obj`` should be an operation start method.
151151
"""
@@ -158,7 +158,7 @@ def set_operation_factory(
158158
#
159159
# This file is licensed under the MIT License.
160160
def is_async_callable(obj: Any) -> bool:
161-
"""Return True if `obj` is an async callable.
161+
"""Return True if ``obj`` is an async callable.
162162
163163
Supports partials of async callable class instances.
164164
"""

temporalio/runtime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Runtime:
6969
thread pool is created.
7070
7171
Runtimes do not work across forks. Advanced users should consider using
72-
:py:meth:`prevent_default` and `:py:meth`set_default` to ensure each
72+
:py:meth:`prevent_default` and :py:meth:`set_default` to ensure each
7373
fork creates it's own runtime.
7474
7575
"""

temporalio/service.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,8 @@ async def check_health(
230230
metadata: Mapping[str, Union[str, bytes]] = {},
231231
timeout: Optional[timedelta] = None,
232232
) -> bool:
233-
"""Check whether the WorkflowService is up.
234-
235-
In addition to accepting which service to check health on, this accepts
236-
some of the same parameters as other RPC calls. See
237-
:py:meth:`ServiceCall.__call__`.
233+
"""Check whether the provided service is up. If no service is specified,
234+
the WorkflowService is used.
238235
239236
Returns:
240237
True when available, false if the server is running but the service

temporalio/worker/_interceptor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,5 +469,5 @@ def start_local_activity(
469469
async def start_nexus_operation(
470470
self, input: StartNexusOperationInput[InputT, OutputT]
471471
) -> temporalio.workflow.NexusOperationHandle[OutputT]:
472-
"""Called for every :py:func:`temporalio.workflow.start_nexus_operation` call."""
472+
"""Called for every :py:func:`temporalio.workflow.NexusClient.start_operation` call."""
473473
return await self.next.start_nexus_operation(input)

0 commit comments

Comments
 (0)