Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Package for easy management of state/event signal publishing, subscribing, and responding
A python package for handling state/event signals
Adds two new, simple-to-use objects:
Also provides two dataclass specifications:
Combining redis pubsub features with state signal + response protocols, these additions make state signal publishing, subscribing, receiving, and responding incredibly easy to integrate into any python code.
See full documentation here
The state-signals PyPI package is available here
pip install state-signals
There are also state-signals RPMs available:
python36-state_signals
python3-state_signals
The use of this module requires the existence of an accessible redis server.
yum install redis
(or replace yum with package manager of choice).A redis server can be started with the redis-server
command.
--port (port)
redis-server \path\to\config
See https://redis.io/ for more details and usage
Note that state-signals also works with any redis-compatible pub/sub databases (like KeyDB)
The Signal
and Response
dataclasses define the exact fields/format of signal and response payloads.
Publishing, receiving, and responding mechanisms are all detailed in SignalExporter
and SignalResponder
documentation. Below are details on the subscribing/awaiting protocol.
Accept Subscribers and Awaiting Responses:
SignalExporter
, call an exporter.initialize(legal_events, ...)
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, ...)
exporter.shutdown(...)
will stop the subscriber listener, wipe the subscriber list, and publish a "shutdown" signal
Sending Responses
SignalResponder
respond
method and pass in the publisher_id
of the signal's publisher, and pass in the event
being responded to.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/eventInitialization and Subscribing:
Publishing, Awaiting, and Responding:
See the full documentation for further details, options, and more
Formatting
pip install black==22.3.0
black --check (file)
black --check .
from the top-level--check
optionTesting
pip install
for pytest
and pytest-mock
pytest -v
from the top-leveltests
folderredis-server
for the functional tests to passBoth formatting checks and tests must pass for GH Actions to approve a commit
FAQs
Package for easy management of state/event signal publishing, subscribing, and responding
We found that state-signals demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.