Skip to content

Commit c9bfd2e

Browse files
committed
De-emphasise WoT core concepts
I've converted quite a few links to other pages in the docs, now that they exist. I think redirecting people to the WoT page all the time is causing confusion.
1 parent a79423f commit c9bfd2e

File tree

10 files changed

+26
-23
lines changed

10 files changed

+26
-23
lines changed

docs/source/documentation.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Generated documentation
44
=======================
55

6-
LabThings describes its HTTP API in two ways: with a :ref:`wot_td` and with an OpenAPI_ document.
6+
LabThings describes its HTTP API in two ways: with a :ref:`gen_td` and with an OpenAPI_ document.
77

88
.. _openapi:
99

@@ -17,9 +17,9 @@ OpenAPI
1717
Thing Description
1818
-----------------
1919

20-
Each :ref:`wot_thing` is documented by a Thing Description, which is a JSON document describing all of the ways to interact with that Thing (:ref:`wot_affordances`\ ). The WoT_ standard defines the `Thing Description`_ and includes a JSON Schema against which it may be validated.
20+
Each :ref:`Thing <things>` is documented by a :ref:`gen_td`, which is a JSON document describing all of the ways to interact with that Thing (:ref:`wot_affordances`\ ). The WoT_ standard defines the `Thing Description`_ and includes a JSON Schema against which it may be validated.
2121

22-
Thing Description documents are higher-level than OpenAPI_ and focus on the capabilities of the Thing. For example, they include a list of properties, where each action is described only once. LabThings treats the Thing Description as your public API, and as a general rule anything not described in the Thing Description is not available over HTTP or to a `.DirectThingClient`\ .
22+
Thing Description documents are higher-level than OpenAPI_ and focus on the capabilities of the Thing. For example, they include a list of properties, where each action is described only once. LabThings treats the Thing Description as your public API, and as a general rule anything not described in the Thing Description is not available over HTTP.
2323

2424
Comparison of Thing Description and OpenAPI
2525
-------------------------------------------

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Documentation for LabThings-FastAPI
2929
* Actions are decorated methods of a `.Thing` class. There is no need for separate schemas or endpoint definitions.
3030
* Properties are defined either as typed attributes (similar to `pydantic` or `dataclasses`) or with a `property`\ -like decorator.
3131
* Lifecycle and concurrency are appropriate for hardware: `Thing` code is always run in a thread, and each `Thing` is instantiated, started up, and shut down only once.
32-
* Vocabulary and concepts are aligned with the `W3C Web of Things <https://www.w3.org/WoT/>`_ standard (see :doc:`wot_core_concepts`)
32+
* Vocabulary and concepts are aligned with the `W3C Web of Things <https://www.w3.org/WoT/>`_ standard (see :ref:`wot_cc`)
3333

3434
Previous version
3535
----------------

docs/source/see_also.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Descriptors
1010

1111
Descriptors are a way to intercept attribute access on an object. By default, attributes of an object are just variables - so an object called ``foo`` might have an attribute called ``bar``, and you may read its value with ``foo.bar``, write its value with ``foo.bar = "baz"``, and delete the attribute with ``del foo.bar``. If ``foo`` is a descriptor, Python will call the ``__get__`` method of that descriptor when it's read and the ``__set__`` method when it's written to. You have quite probably used a descriptor already, because the built-in `~builtins.property` creates a descriptor object: that's what runs your getter method when the property is accessed. The descriptor protocol is described with plenty of examples in the `Descriptor Guide`_ in the Python documentation.
1212

13-
In LabThings-FastAPI, descriptors are used to implement :ref:`wot_actions` and :ref:`wot_properties` on `.Thing` subclasses. The intention is that these will function like standard Python methods and properties, but will also be available over HTTP, along with automatic documentation in the :ref:`wot_td` and OpenAPI documents.
13+
In LabThings-FastAPI, descriptors are used to implement :ref:`actions` and :ref:`properties` on `.Thing` subclasses. The intention is that these will function like standard Python methods and properties, but will also be available over HTTP, along with :ref:`gen_docs`.
1414

1515
There are a few useful notes that relate to many of the descriptors in LabThings-FastAPI:
1616

docs/source/structure.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ LabThings-FastAPI is built on top of `fastapi`\ , which is a fast, modern HTTP f
2020
* Generating a :ref:`gen_td` in addition to the :ref:`openapi` documentation produced by `fastapi`\ .
2121
* Making connections between `.Thing` instances as required.
2222

23+
.. _things:
24+
2325
Things
2426
-----------
2527

@@ -46,7 +48,7 @@ The attributes of a `.Thing` are made available over HTTP by decorating or marki
4648
Client Code
4749
-----------
4850

49-
Client code can be written in any language that supports an HTTP request. However, LabThings FastAPI provides additional functionality that makes writing client code in Python easier.
51+
Client code can be written in any language that supports an HTTP request. However, LabThings FastAPI provides additional functionality that makes writing client code in Python easier. See :ref:`using_things` for more detail.
5052

5153
`.ThingClient` is a class that wraps up the required HTTP requests into a simpler interface. It can retrieve the :ref:`gen_td` over HTTP and use it to generate a new object with methods matching each `.thing_action` and properties matching each `.property`.
5254

docs/source/tutorial/properties.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.. _tutorial_properties:
2+
.. _properties:
23

34
Properties
45
=========================

docs/source/using_things.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1+
.. _using_things:
2+
13
Using Things
24
============
35

46
The interface to a `Thing` is defined by its actions, properties and events [#events]_. These can all be accessed remotely via HTTP from any language, but a more convenient interface in Python is a `.ThingClient` subclass. This provides a simple, pythonic interface to the `.Thing`, allowing you to call actions and access properties as if they were methods and attributes of a Python object.
57

68
`.ThingClient` subclasses can be generated dynamically from a URL using :meth:`.ThingClient.from_url`. This creates an object with the right methods, properties and docstrings, though type hints are often missing. The client can be "introspected" to explore its methods and properties using tools that work at run-time (e.g. autocompletion in a Jupyter notebook), but "static" analysis tools will not yet work.
79

10+
Both the input and return types of the functions of a `.ThingClient` are intended to match those of the `.Thing` it's connected to, however there are currently some differences. In particular, `pydantic` models are usually converted to dictionaries. This is something that is on the long-term roadmap to improve, possibly with :ref:`code generation <client_codegen>`\ .
11+
812
.. [#events] Events are not yet implemented.
913
14+
.. _things_from_things:
15+
16+
Using Things from other Things
17+
------------------------------
18+
19+
Code within a Thing may access other Things on the same server using `.thing_slot`\ s. These are attributes of the `.Thing` that will be supplied by the server when it is set up. When you access a `.thing_slot` it will return the other `.Thing` instance, and it may be used like any other Python object. `.thing_slot`\ s may be optional, or may be configured to return multiple `.Thing` instances: see the `.thing_slot` documentation for more details.
20+
1021
Using Things from other languages
1122
----------------------------------
1223

@@ -19,18 +30,7 @@ Dynamic class generation
1930

2031
The object returned by `.ThingClient.from_url` is an instance of a dynamically-created subclass of `.ThingClient`. Dynamically creating the class is needed because we don't know what the methods and properties should be until we have downloaded the Thing Description. However, this means most code autocompletion tools, type checkers, and linters will not work well with these classes. In the future, LabThings-FastAPI will generate custom client subclasses that can be shared in client modules, which should fix these problems (see below).
2132

22-
.. _things_from_things:
23-
24-
Using Things from other Things
25-
------------------------------
26-
27-
One goal of LabThings-FastAPI is to make code portable between a client (e.g. a Jupyter notebook, or a Python script on another computer) and server-side code (i.e. code inside an action of a `.Thing`). This is done using a `.DirectThingClient` class, which is a subclass of `.ThingClient`.
28-
29-
A `.DirectThingClient` class will call actions and properties of other `.Thing` subclasses using the same interface that would be used by a remote client, which means code for an action may be developed as an HTTP client, for example in a Jupyter notebook, and then moved to the server with minimal changes. Currently, there are a few differences in behaviour between working locally or remotely, most notably the return types (which are usually Pydantic models on the server, and currently dictionaries on the client). This should be improved in the future.
30-
31-
It is also possible for a `.Thing` to access other `.Thing` instances directly. This gives access to functionality that is only available in Python, i.e. not available through a `.ThingClient` over HTTP. However, the `.Thing` must then be supplied manually with any :ref:`dependencies` required by its actions, and the public API as defined by the :ref:`wot_td` is no longer enforced.
32-
33-
Actions that make use of other `.Thing` objects on the same server should access them using :ref:`dependencies`.
33+
.. _client_codegen:
3434

3535
Planned future development: static code generation
3636
--------------------------------------------------

docs/source/wot_core_concepts.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ Thing Description documents are higher-level than OpenAPI_ and focus on the capa
6161
Interaction Affordances
6262
-----------------------
6363

64-
The Web of Things standard often talks about Affordances. This is the collective term for _wot_properties, _wot_actions, and _wot_events.
64+
The Web of Things standard often talks about Affordances. This is the collective term for :ref:`wot_properties`, :ref:`wot_actions`, and :ref:`wot_events`.

src/labthings_fastapi/actions/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Actions module.
22
3-
:ref:`wot_actions` are represented by methods, decorated with the `.thing_action`
3+
:ref:`actions` are represented by methods, decorated with the `.thing_action`
44
decorator.
55
66
See the :ref:`actions` documentation for a top-level overview of actions in

src/labthings_fastapi/properties.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Define properties of `.Thing` objects.
22
3-
:ref:`wot_properties` are attributes of a `.Thing` that may be read or written to
3+
:ref:`properties` are attributes of a `.Thing` that may be read or written to
44
over HTTP, and they are described in :ref:`gen_docs`. They are implemented with
55
a function `.property` (usually referenced as ``lt.property``), which is
66
intentionally similar to Python's built in `property`.
@@ -216,7 +216,7 @@ def property(
216216
) -> Value | FunctionalProperty[Value]:
217217
r"""Define a Property on a `.Thing`\ .
218218
219-
This function may be used to define :ref:`wot_properties` in
219+
This function may be used to define :ref:`properties` in
220220
two ways, as either a decorator or a field specifier. See the
221221
examples in the :mod:`.property` documentation.
222222

src/labthings_fastapi/utilities/introspection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def input_model_from_signature(
6464
6565
LabThings-FastAPI does not currently support actions that take
6666
positional arguments, because this does not convert nicely into
67-
JSONSchema or Thing Description documents (see :ref:`wot_td`).
67+
JSONSchema or Thing Description documents (see :ref:`gen_docs`).
6868
6969
:param func: the function to analyse.
7070
:param remove_first_positional_arg: Remove the first argument from the

0 commit comments

Comments
 (0)