Skip to content

Commit

Permalink
Merge pull request #146 from walkIT-nl/135-improve-asyncio-implementa…
Browse files Browse the repository at this point in the history
…tion: doc fixes

#135 executor abstraction with two implementations: docs+examples
  • Loading branch information
walcovanloon authored Sep 30, 2024
2 parents 1f4460b + 6456ed7 commit 9417ff1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Features
--------
* easily plug event handling scripts for all Orthanc's `change events`_ -
* chain functions into a pipeline (composition)
* run asyncio functions (coroutines) for concurrent processing of a change event
* run asyncio functions (coroutines) for concurrent processing of change events
* run (integration) tests for your Orthanc python scripts
* publish events to Kafka, RabbitMQ and NATS

Expand All @@ -54,7 +54,7 @@ Httpx was chosen as a base library to access the Orthanc API, rather than orthan
developer friendly, and external API access avoids deadlocks in the Python plugin (before this was solved in 3.1).


Running
Getting Started
-------

``entry_point.py`` provides the first boilerplate to get started. Run it by issuing
Expand Down
6 changes: 3 additions & 3 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ specified in orthanc.json or as an environment variable for the Osimis docker im
logging.warn(evt.resource_id)

event_dispatcher.register_event_handlers({orthanc.ChangeType.STABLE_STUDY: log_event}, orthanc_module=orthanc,
session=event_dispatcher.create_session(orthanc))
sync_client=event_dispatcher.create_session(orthanc))

To unit test the log_event handler with pytest, use::

Expand All @@ -26,7 +26,7 @@ To unit test the log_event handler with pytest, use::

assert 'resource-uuid' in caplog.text

One can use the excellent responses_ library to stub the API responses.
One can use the excellent respx_ library to stub the API responses.

To integration test a handler, use::

Expand All @@ -53,4 +53,4 @@ To integration test a handler, use::
The event_dispatcher will ensure that your API call will work the same when called from the Orthanc Python plugin.
For more examples, see the tests/ directory in the Git repository.

.. _responses: https://github.com/getsentry/responses
.. respx: https://lundberg.github.io/respx/
2 changes: 1 addition & 1 deletion tests/test_event_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from functools import partial

import httpx
import respx
import pytest
import respx

from orthanc_ext import event_dispatcher
from orthanc_ext.http_utilities import create_internal_client, ClientType
Expand Down

0 comments on commit 9417ff1

Please sign in to comment.