Farama Notifications
Farama-Notifications is a Python library that enables providing notifications on import to all Farama Foundation maintained packages. Its primary role is to serve as a unified mechanism for Farama projects to deliver runtime and deprecation notices consistently. The current version is 0.0.4.
Warnings
- gotcha The library is at an early development stage (version 0.0.4). While the Farama Foundation aims for semantic versioning, minor and patch releases (0.x.x) may introduce API changes. Users should review release notes for updates.
- gotcha The primary intent of `farama-notifications` is for Farama Foundation libraries to internally provide runtime and deprecation notifications. Directly manipulating the `farama_notifications.notifications` object by end-users might not be the intended main public API and could be subject to internal changes in how these notifications are managed by dependent libraries.
- gotcha The `farama_notifications.notifications` object is a mutable global dictionary-like state. Uncoordinated direct modification in complex applications could lead to unexpected behavior, race conditions, or overwriting of messages set by other Farama libraries or parts of your application.
Install
-
pip install farama-notifications
Imports
- farama_notifications
import farama_notifications
Quickstart
import farama_notifications
# Example of how a notification might be set or retrieved
# In a typical use case, another Farama library would set these notifications.
NOTIFICATION_ID = 'example_event'
NOTIFICATION_MESSAGE = 'A test event has occurred!'
# Set a notification
farama_notifications.notifications[NOTIFICATION_ID] = NOTIFICATION_MESSAGE
# Retrieve and print all notifications
print('Current Farama Notifications:')
for key, value in farama_notifications.notifications.items():
print(f'- {key}: {value}')
# Example of checking for a specific notification
if 'example_event' in farama_notifications.notifications:
print(f"Found 'example_event': {farama_notifications.notifications['example_event']}")