Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions docs/source/actions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,8 @@ parameter is the function's return value. Type hints on both arguments and
return value are used to document the action in the OpenAPI description and
the Thing Description, so it is important to use them consistently.

There are some function arguments that are not considered input parameters.
The first is ``self`` (the first positional argument), which is always the
`.Thing` on which the argument is defined. The other special arguments are
:ref:`dependencies`, which use annotated type hints to tell LabThings to
supply resources needed by the action. Most often, this is a way of accessing
other `.Things` on the same server.
The ``self`` parameter of action methods is not an input: this is a standard
Python construct giving access to the object on which the action is defined.

.. _action_logging:

Expand Down Expand Up @@ -112,6 +108,6 @@ If an action raises an unhandled exception, the action will terminate with an Er
status and LabThings will log the error and the traceback.

In the case where the error has been handled, but the job needs to terminate the action
should raise an InvocationError (or a error which subclasses this). The message from
should raise an `.InvocationError` (or a error which subclasses this). The message from
this exceptions will be logged, but the full traceback will not be logged as this error
has been handled.
2 changes: 0 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@

convenience_modules = {
"labthings_fastapi": labthings_fastapi.__all__,
"labthings_fastapi.deps": labthings_fastapi.deps.__all__,
}
canonical_fq_names = [
"labthings_fastapi.descriptors.action.ActionDescriptor",
Expand All @@ -79,7 +78,6 @@
"labthings_fastapi.outputs.blob.BlobIOContextDep",
"labthings_fastapi.actions.ActionManager",
"labthings_fastapi.descriptors.endpoint.EndpointDescriptor",
"labthings_fastapi.dependencies.invocation.invocation_logger",
"labthings_fastapi.utilities.introspection.EmptyObject",
]

Expand Down
60 changes: 0 additions & 60 deletions docs/source/dependencies/dependencies.rst

This file was deleted.

31 changes: 0 additions & 31 deletions docs/source/dependencies/example.py

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ Documentation for LabThings-FastAPI
properties.rst
documentation.rst
thing_slots.rst
dependencies/dependencies.rst
blobs.rst
concurrency.rst
using_things.rst
see_also.rst
examples.rst
wot_core_concepts.rst
removed_features.rst

autoapi/index
developer_notes/index.rst
Expand Down
8 changes: 8 additions & 0 deletions docs/source/removed_features.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Removed Features
================

.. _dependencies:

Dependencies
------------
The use of dependencies for inter-`.Thing` communication was removed in version 0.1. See :ref:`thing_slots` and `.ThingServerInterface` for a more intuitive way to access that functionality.
2 changes: 0 additions & 2 deletions src/labthings_fastapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from .properties import property, setting, DataProperty, DataSetting
from .actions import action
from .endpoints import endpoint
from . import deps
from . import outputs
from .outputs import blob
from .server import ThingServer, cli
Expand Down Expand Up @@ -53,7 +52,6 @@
"action",
"thing_slot",
"endpoint",
"deps",
"outputs",
"blob",
"ThingServer",
Expand Down
8 changes: 1 addition & 7 deletions src/labthings_fastapi/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
from .logs import add_thing_log_destination
from .utilities import model_to_dict, wrap_plain_types_in_rootmodel
from .invocations import InvocationModel, InvocationStatus
from .dependencies.invocation import NonWarningInvocationID
from .exceptions import (
InvocationCancelledError,
InvocationError,
Expand Down Expand Up @@ -352,7 +351,6 @@ def invoke_action(
self,
action: ActionDescriptor,
thing: Thing,
id: uuid.UUID,
input: Any,
dependencies: dict[str, Any],
) -> Invocation:
Expand All @@ -366,8 +364,6 @@ def invoke_action(
:param thing: is the object on which we are running the ``action``, i.e.
it is supplied to the function wrapped by ``action`` as the ``self``
argument.
:param id: is a `uuid.UUID` used to identify the invocation, for example
when polling its status via HTTP.
:param input: is a `pydantic.BaseModel` representing the body of the HTTP
request that invoked the action. It is supplied to the function as
keyword arguments.
Expand All @@ -381,7 +377,7 @@ def invoke_action(
thing=thing,
input=input,
dependencies=dependencies,
id=id,
id=uuid.uuid4(),
)
self.append_invocation(thread)
thread.start()
Expand Down Expand Up @@ -821,7 +817,6 @@ def add_to_fastapi(self, app: FastAPI, thing: Thing) -> None:
# the function to the decorator.
def start_action(
body: Any, # This annotation will be overwritten below.
id: NonWarningInvocationID,
background_tasks: BackgroundTasks,
**dependencies: Any,
) -> InvocationModel:
Expand All @@ -831,7 +826,6 @@ def start_action(
thing=thing,
input=body,
dependencies=dependencies,
id=id,
)
background_tasks.add_task(action_manager.expire_invocations)
return action.response()
Expand Down
2 changes: 1 addition & 1 deletion src/labthings_fastapi/base_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class BaseDescriptorInfo(
encountered directly by someone using LabThings, except as a base class for
`.Action`\ , `.Property` and others.

LabThings uses descriptors to represent the :ref:`affordances` of a `.Thing`\ .
LabThings uses descriptors to represent the :ref:`wot_affordances` of a `.Thing`\ .
However, passing descriptors around isn't very elegant for two reasons:

* Holding references to Descriptor objects can confuse static type checkers.
Expand Down
Loading
Loading