Skip to content

Commit 95bdb6b

Browse files
Implement CS API Part 3 pub/sub topics, expand public API surface, and update docs
- Add :data suffix to all MQTT resource data topics per CS API Part 3 draft spec (observations:data, commands:data, status:data) - Add get_event_topic() and subscribe_events() to StreamableResource for CloudEvents lifecycle notification subscriptions - Add data_topic flag to APIHelper.get_mqtt_topic() and StreamableResource.get_mqtt_topic() - Expand __init__.py to re-export 36 public symbols across core resources, timemanagement, resource data models, SWE schema components, event system, and CS API constants — enabling single-import workflows - Populate csapi4py/__init__.py with re-exports for lower-level access - Fix pre-existing bare import bug: `from eventbus` → `from .eventbus` in oshconnectapi.py - Bump version to 0.4.0a0 - Add tests/test_imports.py to verify all public symbols are importable without src-path hacks (works on any machine after uv sync / pip install -e .) - Overhaul docs: fix stale module references in api.rst, update tutorial import paths, add Part 3 streaming and event subscription examples, fix conf.py sys.path, update README with doc generation instructions
1 parent 98e63c3 commit 95bdb6b

File tree

14 files changed

+607
-175
lines changed

14 files changed

+607
-175
lines changed

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,30 @@ recommendations for data, retrieving data in real time, archival streams, and ba
55

66
API Documentation available [here](https://botts-innovative-research.github.io/OSHConnect-Python/)
77

8-
Links:
8+
Links:
99
* [Architecture Doc](https://docs.google.com/document/d/1pIaeQw0ocU6ApNgqTVRZuSwjJAbhCcmweMq6RiVYEic/edit?usp=sharing)
10-
* [UML Diagram](https://drive.google.com/file/d/1FVrnYiuAR8ykqfOUa1NuoMyZ1abXzMPw/view?usp=drive_link)
10+
* [UML Diagram](https://drive.google.com/file/d/1FVrnYiuAR8ykqfOUa1NuoMyZ1abXzMPw/view?usp=drive_link)
11+
12+
## Generating the Docs
13+
14+
The documentation is built with [Sphinx](https://www.sphinx-doc.org/). Dev dependencies (including Sphinx) are installed automatically with:
15+
16+
```bash
17+
uv sync
18+
```
19+
20+
Then build the HTML docs:
21+
22+
```bash
23+
uv run sphinx-build -b html docs/source docs/build/html
24+
```
25+
26+
The output will be in `docs/build/html/`. Open `docs/build/html/index.html` in a browser to view locally.
27+
28+
To do a clean rebuild:
29+
30+
```bash
31+
uv run sphinx-build -E -b html docs/source docs/build/html
32+
```
33+
34+
The `-E` flag forces Sphinx to re-read all source files rather than using cached data.

docs/source/api.rst

Lines changed: 79 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,117 @@
11
API Reference
22
=============
33

4-
OSHConnect
5-
----------
4+
All public symbols are re-exported from the top-level package and can be imported directly::
65

6+
from oshconnect import OSHConnect, Node, Datastream, TimePeriod, ObservationFormat, ...
7+
8+
Lower-level CS API utilities are available from the ``oshconnect.csapi4py`` subpackage::
9+
10+
from oshconnect.csapi4py import APIResourceTypes, MQTTCommClient, ConnectedSystemsRequestBuilder, ...
11+
12+
---
13+
14+
Core Application
15+
----------------
716

8-
OSHConnect Utilities and Helpers
9-
--------------------------------
1017
.. automodule:: oshconnect.oshconnectapi
1118
:members:
1219
:undoc-members:
1320
:show-inheritance:
1421

15-
OSH Connect Data Models
16-
-----------------------
17-
These are the second highest level pieces in the hierarchy of the library and the utilities needed to help almost
18-
everything else in the app function.
22+
---
23+
24+
Streamable Resources
25+
--------------------
26+
These are the primary objects for interacting with systems, datastreams, and control streams on an OSH node.
27+
Includes ``Node``, ``System``, ``Datastream``, ``ControlStream``, and supporting enums.
28+
29+
.. automodule:: oshconnect.streamableresource
30+
:members:
31+
:undoc-members:
32+
:show-inheritance:
33+
34+
---
35+
36+
Resource Data Models
37+
--------------------
38+
Pydantic models that represent CS API resources returned from or sent to an OSH server.
1939

20-
.. automodule:: oshconnect.osh_connect_datamodels
40+
.. automodule:: oshconnect.resource_datamodels
2141
:members:
2242
:undoc-members:
2343
:show-inheritance:
2444

45+
---
2546

26-
DataSources and Messaging
27-
-------------------------
28-
Due to their extreme importance in the library, the data sources are listed separately along with the classes that help
29-
manage them and their data.
47+
SWE Schema Components
48+
---------------------
49+
Builder classes for constructing datastream and command schemas using SWE Common data types.
3050

31-
.. automodule:: oshconnect.datasource
51+
.. automodule:: oshconnect.swe_components
3252
:members:
3353
:undoc-members:
3454
:show-inheritance:
3555

56+
.. automodule:: oshconnect.schema_datamodels
57+
:members:
58+
:undoc-members:
59+
:show-inheritance:
60+
61+
---
62+
63+
Event System
64+
------------
65+
Pub/sub event bus for in-process notifications. Implement ``IEventListener`` to receive events.
66+
67+
.. automodule:: oshconnect.eventbus
68+
:members:
69+
:undoc-members:
70+
:show-inheritance:
71+
72+
---
73+
3674
Time Management
3775
---------------
38-
Currently **WIP** but this module will contain the classes and functions that help manage the current time and other
39-
playback features of groups of datasources/datafeeds
4076

4177
.. automodule:: oshconnect.timemanagement
4278
:members:
4379
:undoc-members:
4480
:show-inheritance:
4581

46-
Styling
47-
-------
48-
**WIP** This module contains the classes and functions that help manage the styling and visualization recommendations that
49-
the library provides.
82+
---
5083

51-
Datastore
52-
---------
53-
**WIP** This module is for managing the state of the app. The configurations files are intended to be interchgangale
54-
among all language versions of the OSHConnect ecosystem.
84+
CS API Integration (``csapi4py``)
85+
----------------------------------
5586

56-
Core Data Models
57-
----------------
58-
Theses data models are not often intended to be used directly by the user, but are used by the library to help manage
59-
validation of data that flows to and from the API.
87+
Constants and Enums
88+
~~~~~~~~~~~~~~~~~~~
6089

61-
.. automodule:: oshconnect.core_datamodels
90+
.. automodule:: oshconnect.csapi4py.constants
6291
:members:
6392
:undoc-members:
6493
:show-inheritance:
6594

95+
Request Builder
96+
~~~~~~~~~~~~~~~
6697

98+
.. automodule:: oshconnect.csapi4py.con_sys_api
99+
:members:
100+
:undoc-members:
101+
:show-inheritance:
67102

68-
Helpers
69-
~~~~~~~
103+
API Helper
104+
~~~~~~~~~~
105+
106+
.. automodule:: oshconnect.csapi4py.default_api_helpers
107+
:members:
108+
:undoc-members:
109+
:show-inheritance:
110+
111+
MQTT Client
112+
~~~~~~~~~~~
113+
114+
.. automodule:: oshconnect.csapi4py.mqtt
115+
:members:
116+
:undoc-members:
117+
:show-inheritance:

docs/source/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import sys
1111
import traceback
1212

13-
sys.path.insert(0, os.path.abspath("../.."))
13+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../src')))
1414

1515

1616
def process_exception(app, what, name, obj, options, lines):
@@ -22,9 +22,9 @@ def setup(app):
2222

2323

2424
project = 'OSHConnect-Python'
25-
copyright = '2024, Botts Innovative Research, Inc.'
25+
copyright = '2025, Botts Innovative Research, Inc.'
2626
author = 'Ian Patterson'
27-
release = '0.2'
27+
release = '0.4'
2828

2929
# -- General configuration ---------------------------------------------------
3030
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

docs/source/index.rst

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,28 @@ Welcome to OSHConnect-Python's documentation!
33

44
OSHConnect-Python
55
=================
6-
OSHConnect-Python is the Python version of the OSHConnect family of application libraries inteded to provide a simple
7-
and straightforward way to interact with OpenSensorHub (or another CSAPI server) by way of OGC API - Connected Systems.
8-
It supports or will support at the time of a 1.0 release Part 1 and Part 2 of the Connected Systems api, as well as
9-
certain streaming features made possible by OpenSensorHub.
6+
OSHConnect-Python is the Python version of the OSHConnect family of application libraries intended to provide a
7+
simple and straightforward way to interact with OpenSensorHub (or another CS API server) by way of
8+
OGC API - Connected Systems.
9+
10+
It supports Parts 1, 2, and 3 (Pub/Sub) of the OGC Connected Systems API, including:
11+
12+
- System, Datastream, and ControlStream discovery and management
13+
- Real-time MQTT streaming with CS API Part 3 ``:data`` topic conventions
14+
- Resource event topic subscriptions (CloudEvents lifecycle notifications)
15+
- Batch retrieval and archival stream playback
16+
- Configuration persistence (JSON save/load)
17+
- SWE Common schema builders for defining datastream and command schemas
18+
19+
All major classes and utilities are importable directly from ``oshconnect``.
20+
Lower-level CS API utilities are available from ``oshconnect.csapi4py``.
1021

1122
.. toctree::
1223
:maxdepth: 2
1324
:caption: Contents
1425

15-
api
1626
tutorial
27+
api
1728

1829

1930

@@ -22,6 +33,4 @@ Indices and tables
2233

2334
* :ref:`genindex`
2435
* :ref:`modindex`
25-
* :ref:`search`
26-
27-
36+
* :ref:`search`

0 commit comments

Comments
 (0)