# -*- coding: utf-8 -*-
from setuptools import setup

modules = \
['state_signals']
install_requires = \
['redis>=3.5,<4.0']

extras_require = \
{':python_version >= "3.6" and python_version < "3.7"': ['dataclasses>=0.6,<0.7']}

setup_kwargs = {
    'name': 'state-signals',
    'version': '1.0.0',
    'description': 'Package for easy management of state/event signal publishing, subscribing, and responding',
    'long_description': '# state-signals: the State/Event Signal Module\nA python package for handling state/event signals\n\nAdds two new, simple-to-use objects:\n - SignalExporter      (for publishing state signals and handling subscribers + responses)\n - SignalResponder     (for receiving state signals, locking onto publishers, and publishing responses)\n\nAlso provides two dataclass specifications:\n - Signal              (state signal protocol payload definition)\n - Response            (response protocol payload definition)\n\nCombining redis pubsub features with state signal + response protocols, \nthese additions make state signal publishing, subscribing, receiving, \nand responding incredibly easy to integrate into any python code.\n\nSee full documentation [here](https://distributed-system-analysis.github.io/state-signals/)\n\n# Installation\nThe state-signals PyPI package is available [here](https://pypi.org/project/state-signals)\n\nTo install, run `pip install state-signals`\n\n# Requirements\nThe use of this module requires the existence of an accessible redis server.\n - Redis can easily be installed with a `yum install redis` (or replace yum with package manager of choice).\n - A redis container can also be started using the [official image](https://hub.docker.com/_/redis)\n\nA redis server can be started with the `redis-server` command.\n - The default port is 6379 (also default for state-signals), but can be changed with `--port (port)`\n - A config file can also be used for greater control/detail `redis-server \\path\\to\\config`\n - Example config available [here](https://download.redis.io/redis-stable/redis.conf)\n\nSee https://redis.io/ for more details and usage\n\nNote that state-signals also works with any redis-compatible pub/sub databases (like [KeyDB](https://github.com/Snapchat/KeyDB))\n\n# Protocol / Behaviors\n\nThe `Signal` and `Response` dataclasses define the exact fields/format of signal and response payloads.\n\nPublishing, receiving, and responding mechanisms are all detailed in `SignalExporter` and `SignalResponder` documentation. Below are details on the subscribing/awaiting protocol.\n\nAccept Subscribers and Awaiting Responses:\n - Using the `SignalExporter`, call an `exporter.initialize(legal_events, ...)`\n - Initialization will start the subscriber listener and establish legal event names\n - It will also publish an "initialization" state signal\n - Responders can then respond to the "initialization" signal to be added to the list of subs\n    - Note: A responder can subscribe at any point, unless a "shutdown" signal has been published after the initialization\n - The `SignalExporter` will now wait for (up until timeout) and read the responses of the subscribers after publishing any further signals with `exporter.publish_signal(event, ...)`\n - When finished, calling `exporter.shutdown(...)` will stop the subscriber listener, wipe the subscriber list, and publish a "shutdown" signal\n    - This signal publish will NOT listen for responses\n\nSending Responses\n - Receiving signals and sending responses can be done with the `SignalResponder`\n - To respond to a signal, simply use the `respond` method and pass in the `publisher_id` of the signal\'s publisher, and pass in the `event` being responded to.\n - (NEW IN v0.2.0) `srespond(signal, ...)`: A method where the user can simply pass in the received signal object they wish to respond to instead of the signal\'s id/event\n - Responding to an "initialization" signal will subscribe the responder to that specific publisher, which will now await responses from the responder for any future signals published.\n    - NOTE: When responding to an "initialization" signal, a Response-Action-Success (RAS) code is not necessary\n    - For any future responses to that publisher\'s signals, an RAS code will be necessary, and will indicate to the publisher whether or not the responder was successful in acting upon the signal\n    - See documentation for more details on RAS codes\n\nInitialization and Subscribing:\n![Initialization and Subscribing](imgs/signalsub.png)\n\nPublishing, Awaiting, and Responding:\n![Publishing, Awaiting, and Responding](imgs/awaitresp.png)\n\nSee the [full documentation](https://distributed-system-analysis.github.io/state-signals/) for further details, options, and more\n\n# Development\n\nFormatting\n - For formatting, get black v22.3.0 via `pip install black==22.3.0`\n - To check any modified python files, run `black --check (file)`\n - To check the entire repo, run `black --check .` from the top-level\n - To auto-format all python code, remove the `--check` option\n\nTesting\n - Testing is done with pytest\n - Run a `pip install` for `pytest` and `pytest-mock`\n - To run the tests, run `pytest -v` from the top-level\n - Any new test functions/scripts can be added into the `tests` folder\n - NOTE: You will need to run a local `redis-server` for the tests to pass\n\n Both formatting checks and tests must pass for GH Actions to approve a commit\n',
    'author': 'Mustafa Eyceoz',
    'author_email': 'meyceoz@redhat.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/distributed-system-analysis/state-signals',
    'py_modules': modules,
    'install_requires': install_requires,
    'extras_require': extras_require,
    'python_requires': '>=3.6,<4.0',
}


setup(**setup_kwargs)
