eiffellib


Nameeiffellib JSON
Version 3.0.0 PyPI version JSON
download
home_pagehttps://github.com/eiffel-community/eiffel-pythonlib
SummaryPython library for sending and receiving Eiffel events
upload_time2024-02-07 09:16:21
maintainer
docs_urlNone
authorTobias Persson
requires_python
licenseApache License, Version 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            #########
Eiffellib
#########

.. image:: https://img.shields.io/badge/Stage-Sandbox-yellow.svg
  :target: https://github.com/eiffel-community/community/blob/master/PROJECT_LIFECYCLE.md#stage-sandbox

Eiffellib is a python library for subscribing to and publishing Eiffel events to a message-broker.

Description
===========

Eiffellib solves the problem of publishing Eiffel events and subscribing to events, removing the need of knowing how to connect to a message-broker or how to utilize the protocol it supplies.

With Eiffellib you can start subscribing to and publish valid Eiffel messages quickly and to get a feel for the event protocol.

It is designed to be fast and easy to start using while still being production quality.

Documentation: https://eiffellib.readthedocs.io/en/latest/

Features
========

- Simple subscription and publishing of Eiffel events.
- Event building assistance with event validation on receive and publish.
- Following a context link.

Installation
============

Install the project by running:

    pip install eiffellib[rabbitmq]

If you only want to use the Eiffel message definitions leave out the optional dependency:
    pip install eiffellib

Examples
========

Start RabbitMQ
--------------

In order for these examples to work you need a RabbitMQ server:

.. code-block::

   # From https://hub.docker.com/_/rabbitmq
   docker run -d --hostname my-rabbit --name some-rabbit -p 8080:15672 -p 5672:5672 rabbitmq:3-management

Subscribing to an event
-----------------------

.. code-block:: python

    import time
    from eiffellib.subscribers import RabbitMQSubscriber


    def callback(event, context):
        print(event.pretty)

    SUBSCRIBER = RabbitMQSubscriber(host="127.0.0.1", port=5672, ssl=False,
                                    queue="eiffel", exchange="amq.fanout")
    SUBSCRIBER.subscribe("EiffelActivityTriggeredEvent", callback)
    SUBSCRIBER.start()
    while True:
        time.sleep(0.1)

Publishing an event
-------------------

.. code-block:: python

    from eiffellib.publishers import RabbitMQPublisher
    from eiffellib.events import EiffelActivityTriggeredEvent

    PUBLISHER = RabbitMQPublisher(host="127.0.0.1", exchange="amq.fanout", ssl=False,
                                  port=5672, routing_key=None)
    PUBLISHER.start()
    ACTIVITY_TRIGGERED = EiffelActivityTriggeredEvent()
    ACTIVITY_TRIGGERED.data.add("name", "Test activity")
    PUBLISHER.send_event(ACTIVITY_TRIGGERED)
    PUBLISHER.wait_for_unpublished_events()

Deprecation of routing key
--------------------------

The "routing_key" argument in the RabbitMQPublisher class has been deprecated.

This deprecation also affects the default value of the "routing_key" argument and you will be getting warnings while running.


The reason for this change is due to a misunderstanding of how routing keys are supposed to be used when eiffellib was first created.

Each event will now be able to generate their own routing key every time the event is sent.

This routing key is by default "eiffel._.$event_type._._" where the different values are "eiffel.$family.$event_type.$tag.$domainid".

Please refer to https://eiffel-community.github.io/eiffel-sepia/rabbitmq-message-broker.html for more information about routing keys.


To change to the new routing key behavior (and thus removing the warning), please set "routing_key" to "None" when initializing a new RabbitMQPublisher.

.. code-block:: python

    PUBLISHER = RabbitMQPublisher(host="127.0.0.1", exchange="amq.fanout", ssl=False,
                                  port=5672, routing_key=None)

In order to change "$family", "$tag" or "$domainid" in the routing key, they have to be set on the events.

.. code-block:: python

    PUBLISHER = RabbitMQPublisher(host="127.0.0.1", exchange="amq.fanout", ssl=False,
                                  port=5672, routing_key=None)
    EVENT = EiffelActivityTriggeredEvent(family="myfamily", tag="mytag", domain_id="mydomain")
    PUBLISHER.send_event(EVENT)

Contribute
==========

- Issue Tracker: https://github.com/eiffel-community/eiffel-pythonlib/issues
- Source Code: https://github.com/eiffel-community/eiffel-pythonlib

Support
=======

If you are having issues, please let us know.
There is a mailing list at: eiffel-pythonlib-maintainers@google-groups.com
or just write an Issue.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/eiffel-community/eiffel-pythonlib",
    "name": "eiffellib",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Tobias Persson",
    "author_email": "tobiaspn@axis.com",
    "download_url": "https://files.pythonhosted.org/packages/c6/d3/82d3f0137c7cd5efc1c37ecb784acac8ac83557163ef098e9d713f62fd66/eiffellib-3.0.0.tar.gz",
    "platform": null,
    "description": "#########\nEiffellib\n#########\n\n.. image:: https://img.shields.io/badge/Stage-Sandbox-yellow.svg\n  :target: https://github.com/eiffel-community/community/blob/master/PROJECT_LIFECYCLE.md#stage-sandbox\n\nEiffellib is a python library for subscribing to and publishing Eiffel events to a message-broker.\n\nDescription\n===========\n\nEiffellib solves the problem of publishing Eiffel events and subscribing to events, removing the need of knowing how to connect to a message-broker or how to utilize the protocol it supplies.\n\nWith Eiffellib you can start subscribing to and publish valid Eiffel messages quickly and to get a feel for the event protocol.\n\nIt is designed to be fast and easy to start using while still being production quality.\n\nDocumentation: https://eiffellib.readthedocs.io/en/latest/\n\nFeatures\n========\n\n- Simple subscription and publishing of Eiffel events.\n- Event building assistance with event validation on receive and publish.\n- Following a context link.\n\nInstallation\n============\n\nInstall the project by running:\n\n    pip install eiffellib[rabbitmq]\n\nIf you only want to use the Eiffel message definitions leave out the optional dependency:\n    pip install eiffellib\n\nExamples\n========\n\nStart RabbitMQ\n--------------\n\nIn order for these examples to work you need a RabbitMQ server:\n\n.. code-block::\n\n   # From https://hub.docker.com/_/rabbitmq\n   docker run -d --hostname my-rabbit --name some-rabbit -p 8080:15672 -p 5672:5672 rabbitmq:3-management\n\nSubscribing to an event\n-----------------------\n\n.. code-block:: python\n\n    import time\n    from eiffellib.subscribers import RabbitMQSubscriber\n\n\n    def callback(event, context):\n        print(event.pretty)\n\n    SUBSCRIBER = RabbitMQSubscriber(host=\"127.0.0.1\", port=5672, ssl=False,\n                                    queue=\"eiffel\", exchange=\"amq.fanout\")\n    SUBSCRIBER.subscribe(\"EiffelActivityTriggeredEvent\", callback)\n    SUBSCRIBER.start()\n    while True:\n        time.sleep(0.1)\n\nPublishing an event\n-------------------\n\n.. code-block:: python\n\n    from eiffellib.publishers import RabbitMQPublisher\n    from eiffellib.events import EiffelActivityTriggeredEvent\n\n    PUBLISHER = RabbitMQPublisher(host=\"127.0.0.1\", exchange=\"amq.fanout\", ssl=False,\n                                  port=5672, routing_key=None)\n    PUBLISHER.start()\n    ACTIVITY_TRIGGERED = EiffelActivityTriggeredEvent()\n    ACTIVITY_TRIGGERED.data.add(\"name\", \"Test activity\")\n    PUBLISHER.send_event(ACTIVITY_TRIGGERED)\n    PUBLISHER.wait_for_unpublished_events()\n\nDeprecation of routing key\n--------------------------\n\nThe \"routing_key\" argument in the RabbitMQPublisher class has been deprecated.\n\nThis deprecation also affects the default value of the \"routing_key\" argument and you will be getting warnings while running.\n\n\nThe reason for this change is due to a misunderstanding of how routing keys are supposed to be used when eiffellib was first created.\n\nEach event will now be able to generate their own routing key every time the event is sent.\n\nThis routing key is by default \"eiffel._.$event_type._._\" where the different values are \"eiffel.$family.$event_type.$tag.$domainid\".\n\nPlease refer to https://eiffel-community.github.io/eiffel-sepia/rabbitmq-message-broker.html for more information about routing keys.\n\n\nTo change to the new routing key behavior (and thus removing the warning), please set \"routing_key\" to \"None\" when initializing a new RabbitMQPublisher.\n\n.. code-block:: python\n\n    PUBLISHER = RabbitMQPublisher(host=\"127.0.0.1\", exchange=\"amq.fanout\", ssl=False,\n                                  port=5672, routing_key=None)\n\nIn order to change \"$family\", \"$tag\" or \"$domainid\" in the routing key, they have to be set on the events.\n\n.. code-block:: python\n\n    PUBLISHER = RabbitMQPublisher(host=\"127.0.0.1\", exchange=\"amq.fanout\", ssl=False,\n                                  port=5672, routing_key=None)\n    EVENT = EiffelActivityTriggeredEvent(family=\"myfamily\", tag=\"mytag\", domain_id=\"mydomain\")\n    PUBLISHER.send_event(EVENT)\n\nContribute\n==========\n\n- Issue Tracker: https://github.com/eiffel-community/eiffel-pythonlib/issues\n- Source Code: https://github.com/eiffel-community/eiffel-pythonlib\n\nSupport\n=======\n\nIf you are having issues, please let us know.\nThere is a mailing list at: eiffel-pythonlib-maintainers@google-groups.com\nor just write an Issue.\n",
    "bugtrack_url": null,
    "license": "Apache License, Version 2.0",
    "summary": "Python library for sending and receiving Eiffel events",
    "version": "3.0.0",
    "project_urls": {
        "Homepage": "https://github.com/eiffel-community/eiffel-pythonlib"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c798dcf504e77cdfac18e4f6b83ae1336981c2af9dd4691aef8653aba9f92a73",
                "md5": "78180e9f20381dd7438e3f005bf298f4",
                "sha256": "b031fe9ebf7f2ec9ecd492150e9a06afcab2689887f9c283f3b839208c561b76"
            },
            "downloads": -1,
            "filename": "eiffellib-3.0.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "78180e9f20381dd7438e3f005bf298f4",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 220782,
            "upload_time": "2024-02-07T09:16:19",
            "upload_time_iso_8601": "2024-02-07T09:16:19.079095Z",
            "url": "https://files.pythonhosted.org/packages/c7/98/dcf504e77cdfac18e4f6b83ae1336981c2af9dd4691aef8653aba9f92a73/eiffellib-3.0.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c6d382d3f0137c7cd5efc1c37ecb784acac8ac83557163ef098e9d713f62fd66",
                "md5": "ab86760a99de7dbb6226b5c22ff40e01",
                "sha256": "8584124b4ec5301efb5944fac749abe46939a7663ed52039ea4a9f02a6d1703c"
            },
            "downloads": -1,
            "filename": "eiffellib-3.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ab86760a99de7dbb6226b5c22ff40e01",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 55975,
            "upload_time": "2024-02-07T09:16:21",
            "upload_time_iso_8601": "2024-02-07T09:16:21.296570Z",
            "url": "https://files.pythonhosted.org/packages/c6/d3/82d3f0137c7cd5efc1c37ecb784acac8ac83557163ef098e9d713f62fd66/eiffellib-3.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-07 09:16:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "eiffel-community",
    "github_project": "eiffel-pythonlib",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": false,
    "tox": true,
    "lcname": "eiffellib"
}
        
Elapsed time: 0.24734s