Skip to content

Commit 0e2d3d9

Browse files
authored
Merge pull request #36 from VigneshVSV/main
Accurate python version support information & release to PyPI, works only on python 3.11+ unlike previously claimed
2 parents f45c8b8 + 6eee54e commit 0e2d3d9

File tree

11 files changed

+66
-27
lines changed

11 files changed

+66
-27
lines changed

.github/workflows/test-dev.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,29 @@ on:
1212

1313
jobs:
1414
test:
15-
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
include:
18+
# Define specific Python versions for each OS
19+
- os: ubuntu-latest
20+
python-version: 3.11
21+
# - os: windows-latest
22+
# python-version: 3.11
23+
# - os: macos-latest
24+
# python-version: 3.11
25+
- os: ubuntu-latest
26+
python-version: 3.12
27+
28+
runs-on: ${{ matrix.os }}
29+
1630
steps:
1731
- name: Checkout code
1832
uses: actions/checkout@v4
1933

20-
- name: Set up Python
34+
- name: Set up Python ${{ matrix.python-version }}
2135
uses: actions/setup-python@v3
2236
with:
23-
python-version: 3.11
37+
python-version: ${{ matrix.python-version }}
2438

2539
- name: Install dependencies
2640
run: pip install -r tests/requirements.txt

.github/workflows/test-release.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,30 @@ on:
99

1010
jobs:
1111
test:
12-
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
include:
16+
# Define specific Python versions for each OS
17+
- os: ubuntu-latest
18+
python-version: 3.11
19+
# - os: windows-latest
20+
# python-version: 3.11
21+
# - os: macos-latest
22+
# python-version: 3.11
23+
- os: ubuntu-latest
24+
python-version: 3.12
25+
26+
runs-on: ${{ matrix.os }}
27+
1328
steps:
1429
- name: Checkout code
1530
uses: actions/checkout@v4
1631

17-
- name: Set up Python
32+
- name: Set up Python ${{ matrix.python-version }}
1833
uses: actions/setup-python@v3
1934
with:
20-
python-version: 3.11
35+
python-version: ${{ matrix.python-version }}
2136

2237
- name: Install dependencies
2338
run: |

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- image event handlers (develop branch) for streaming live video as JPEG and PNG ✓
1414
- pydantic support for property models (develop branch) ✓
1515

16+
## [v0.2.4] - 2024-09-09
17+
18+
- added multiple versions of python for testing
19+
- unlike claimed in previous versions, this package runs only on python 3.11 or higher
20+
1621
## [v0.2.3] - 2024-08-11
1722

1823
- HTTP SSE minor bug-fix/optimization - no difference to the user

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
[![Documentation Status](https://readthedocs.org/projects/hololinked/badge/?version=latest)](https://hololinked.readthedocs.io/en/latest/?badge=latest) [![PyPI](https://img.shields.io/pypi/v/hololinked?label=pypi%20package)](https://pypi.org/project/hololinked/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/hololinked)](https://pypistats.org/packages/hololinked) [![codecov](https://codecov.io/gh/VigneshVSV/hololinked/graph/badge.svg?token=JF1928KTFE)](https://codecov.io/gh/VigneshVSV/hololinked)
88
<br>
9-
[![email](https://img.shields.io/badge/email%20me-brown)](mailto:[email protected]) [![find me on discord](https://img.shields.io/badge/find_me_on_discord-brown)](https://discord.com/users/1178428338746966066)
9+
[![email](https://img.shields.io/badge/email%20me-brown)](mailto:[email protected]) [![ways to contact me](https://img.shields.io/badge/ways_to_contact_me-brown)](https://hololinked.dev/contact)
1010

1111
### To Install
1212

@@ -105,7 +105,7 @@ class OceanOpticsSpectrometer(Thing):
105105

106106
In this case, instead of generating a data container with an internal name, the setter method is called when `integration_time` property is set/written. One might add the hardware device driver (say, supplied by the manufacturer) logic here to apply the property onto the device. In the above example, there is not a way provided by lower level library to read the value from the device, so we store it in a variable after applying it and supply the variable back to the getter method. Normally, one would also want the getter to read from the device directly.
107107

108-
Those familiar with Web of Things (WoT) terminology may note that these properties generate the property affordance schema to become accessible by the [node-wot](https://github.com/eclipse-thingweb/node-wot) HTTP(s) client. An example of autogenerated property affordance for `integration_time` is as follows:
108+
Those familiar with Web of Things (WoT) terminology may note that these properties generate the property affordance schema. An example of autogenerated property affordance for `integration_time` is as follows:
109109

110110
```JSON
111111
"integration_time": {
@@ -127,9 +127,9 @@ Those familiar with Web of Things (WoT) terminology may note that these properti
127127
"minimum": 0.001
128128
},
129129
```
130-
If you are not familiar with Web of Things or the term "property affordance", consider the above JSON as a description of
130+
If you are <span style="text-decoration: underline">not familiar</span> with Web of Things or the term "property affordance", consider the above JSON as a description of
131131
what the property represents and how to interact with it from somewhere else. Such a JSON is both human-readable, yet consumable
132-
by a client provider to create a client object to interact with the property.
132+
by a client provider to create a client object to interact with the property. For example, the Eclipse ThingWeb [node-wot](https://github.com/eclipse-thingweb/node-wot) supports this feature to produce a HTTP(s) client that can issue `readProperty("integration_time")` and `writeProperty("integration_time", 1000)` to read and write this property.
133133

134134
The URL path segment `../spectrometer/..` in href field is taken from the `instance_name` which was specified in the `__init__`.
135135
This is a mandatory key word argument to the parent class `Thing` to generate a unique name/id for the instance. One should use URI compatible strings.
@@ -305,14 +305,14 @@ See a list of currently supported possibilities while using this package [below]
305305

306306
> You may use a script deployment/automation tool to remote stop and start servers, in an attempt to remotely control your hardware scripts.
307307
308-
One may use the HTTP API according to one's beliefs (including letting the package auto-generate it), but it is mainly intended for web development and cross platform clients like the [node-wot](https://github.com/eclipse-thingweb/node-wot) HTTP(s) client. If your plan is to develop a truly networked system, it is recommended to learn more and use [Thing Descriptions](https://www.w3.org/TR/wot-thing-description11) to describe your hardware. A Thing Description will be automatically generated if absent as shown in JSON examples above or can be supplied manually. The node-wot HTTP(s) client will be able to consume such a description, validate it and abstract away the protocol level details so that one can invoke actions, read & write properties or subscribe to events in a technology agnostic manner. In this way, one can plugin code developed from this package to the rest of the IoT/data-acquisition tools, protocols & standardizations. To know more about client side scripting with node-wot, please look into the documentation [How-To](https://hololinked.readthedocs.io/en/latest/howto/clients.html#using-node-wot-http-s-client) section.
308+
One may use the HTTP API according to one's beliefs (including letting the package auto-generate it), but it is mainly intended for web development and cross platform clients like the [node-wot](https://github.com/eclipse-thingweb/node-wot) HTTP(s) client. If your plan is to develop a truly networked system, it is recommended to learn more and use [Thing Descriptions](https://www.w3.org/TR/wot-thing-description11) to describe your hardware. A Thing Description will be automatically generated if absent as shown in JSON examples above or can be supplied manually.
309309

310310
### Currently Supported
311311

312312
- control method execution and property write with a custom finite state machine.
313313
- database (Postgres, MySQL, SQLite - based on SQLAlchemy) support for storing and loading properties when the object dies and restarts.
314314
- auto-generate Thing Description for Web of Things applications.
315-
- use serializer of your choice (except for HTTP) - MessagePack, JSON, pickle etc. & extend serialization to suit your requirement. HTTP Server will support only JSON serializer to maintain compatibility with node-wot. Default is JSON serializer based on msgspec.
315+
- use serializer of your choice (except for HTTP) - MessagePack, JSON, pickle etc. & extend serialization to suit your requirement. HTTP Server will support only JSON serializer to maintain comptibility with Javascript (MessagePack may be added later). Default is JSON serializer based on msgspec.
316316
- asyncio compatible - async RPC server event-loop and async HTTP Server - write methods in async
317317
- choose from multiple ZeroMQ transport methods which offers some possibilities like the following without changing the code:
318318
- run HTTP Server & python object in separate processes or the same process
@@ -325,14 +325,12 @@ Again, please check examples or the code for explanations. Documentation is bein
325325
### Currently being worked
326326

327327
- improving accuracy of Thing Descriptions
328-
- cookie credentials for authentication - as a workaround until credentials are supported, use `allowed_clients` argument on HTTP server which restricts access based on remote IP supplied with the HTTP headers.
328+
- separation of HTTP protocol specification like URL path and HTTP verbs from the API of properties, actions and events and move their customization completely to the HTTP server
329+
- unit tests coverage
330+
- cookie credentials for authentication - as a workaround until credentials are supported, use `allowed_clients` argument on HTTP server which restricts access based on remote IP supplied with the HTTP headers. This wont still help you in public networks or modified/non-standard HTTP clients.
329331

330332
### Internals
331333

332334
This package is an implementation of a ZeroMQ-based Object Oriented RPC with customizable HTTP end-points. A dual transport in both ZMQ and HTTP is provided to maximize flexibility in data type, serialization and speed, although HTTP is preferred for networked applications. If one is looking for an object oriented approach towards creating components within a control or data acquisition system, or an IoT device, one may consider this package.
333335

334-
### Some Day In Future
335-
336-
- mongo DB support for DB operations
337-
- HTTP 2.0
338336

codecov.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
coverage:
2+
status:
3+
patch:
4+
default:
5+
enabled: false

doc

Submodule doc updated from 84450d0 to c0c4a8d

examples

hololinked/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.2.3"
1+
__version__ = "0.2.4"

hololinked/server/eventloop.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,9 @@ async def execute_once(cls, instance_name : str, instance : Thing, instruction_s
353353
if action == "write":
354354
if resource.state is None or (hasattr(instance, 'state_machine') and
355355
instance.state_machine.current_state in resource.state):
356-
return prop.__set__(owner_inst, arguments["value"])
356+
if isinstance(arguments, dict) and len(arguments) == 1 and "value" in arguments:
357+
return prop.__set__(owner_inst, arguments["value"])
358+
return prop.__set__(owner_inst, arguments)
357359
else:
358360
raise StateMachineError("Thing {} is in `{}` state, however attribute can be written only in `{}` state".format(
359361
instance_name, instance.state_machine.current_state, resource.state))

hololinked/server/handlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def set_headers(self) -> None:
139139
"""
140140
sets default headers for RPC (property read-write and action execution). The general headers are listed as follows:
141141
142-
.. code-block:: http
142+
.. code-block:: yaml
143143
144144
Content-Type: application/json
145145
Access-Control-Allow-Credentials: true
@@ -220,7 +220,7 @@ def set_headers(self) -> None:
220220
"""
221221
sets default headers for event handling. The general headers are listed as follows:
222222
223-
.. code-block:: http
223+
.. code-block:: yaml
224224
225225
Content-Type: text/event-stream
226226
Cache-Control: no-cache

0 commit comments

Comments
 (0)