A Python library easing use of Jordan in your Python code.
Project description
Jordan ?
Jordan project let an executing program being interacted with, from anywhere. Once registered to a Jordan server, a program instance becomes a Jordan client which may emit statuses (such as logs and progress details), and may react to some user action. For example, a Human user may want to trigger an email sending for reporting purpose. Actions are generic, as much as the App GUI. Therefore, you already have an App for your program !
Get started
-
Get a working Jordan server instance
-
Import jordan
from jordan_py import jordan
-
In your Python program, register to this server
jordan_instance = jordan.register('<jordan_server_url>')
-
Send a status
jordan_instance.send_status('The program is well started.')
-
React on received message
while True: if jordan_message = jordan_instance.read_message(): if jordan_message.action_name == 'BREAK_LOOP': break
-
More use cases
Explore samples for details on features like :
- action
- task
- status type
Action
Has a name, and optionally (typed) (defaulted) parameters. e.g.
actions = jordan.with_action('send_email')
.with_parameter('recipient')
.with_parameter('delay', jordan.PARAMETER_TYPE_INT, 0)
.build()
jordan_instance = jordan.register('<jordan_server_url>', 'sample-client-sending-email', actions)
Task
Hierarchy of task/sub-task. The jordan client instance returned by register()
function is a root task.
meal_task = dinner_jordan_instance.create_task('meal')
dessert_task = dinner_jordan_instance.create_task('dessert')
meal_task.send_status('Not enough food in storage')
dessert_task.send_status('Dessert is ready')
Status Type
May be easier to understand and analyze statuses (in a client app which allows filtering).
meal_task.send_failure_status('Not enough food in storage')
dessert_task.send_status('Dessert is being prepared')
dessert_task.send_progress(50)
dessert_task.send_success_status('Dessert is ready')
dessert_task.send_typed_status('eaten', 'Dessert has been eaten by Michael')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for jordan_py-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 001bc1c2ea5d0660b0a948b7a1b711804363d40a03163d79498b7df82b665121 |
|
MD5 | 7b658d04d321421898e5b4825c302144 |
|
BLAKE2b-256 | 78047ba50924199277778ec7154cd6ad414c3dcf6ad9b1da6bcd64363bf09014 |