A simple package to manage and display status messages.
Project description
Status Messenger
A simple Python package to manage and display status messages, typically for agentic applications or long-running processes where updates need to be communicated to a UI.
Installation
pip install status-messenger
(Once it's published to PyPI)
Alternatively, to install directly from a Git repository:
pip install git+https://github.com/your_username/status_messenger.git
Or, to install from a local directory (after cloning/downloading):
cd path/to/status_messenger_py
pip install .
Usage
The package provides functions to add and retrieve status messages.
from status_messenger import add_status_message, get_status_messages, AGENT_STATUS_MESSAGES
# Add a status message
add_status_message("Process started successfully.")
add_status_message("Step 1 completed.")
# Get all current status messages (usually just the latest one)
messages = get_status_messages()
print(messages) # Output: ['Step 1 completed.']
# You can also access the list directly (though get_status_messages is preferred)
print(AGENT_STATUS_MESSAGES) # Output: ['Step 1 completed.']
Serving Messages (Example with Flask)
While this package primarily provides the logic for managing status messages, you'll typically need a web server to expose these messages to a frontend. Here's a conceptual example of how you might do this with Flask (Flask is not a direct dependency of this core package).
You would create a separate server.py or integrate into your existing Flask application:
# In your Flask app (e.g., app.py or server.py)
from flask import Flask, jsonify
from status_messenger import get_status_messages, add_status_message # Import from your package
app = Flask(__name__)
@app.route('/status', methods=['GET'])
def status_endpoint():
"""Endpoint to get the latest status message."""
messages = get_status_messages()
return jsonify(messages)
# Example of how another part of your application might update the status
def some_long_process():
add_status_message("Starting long process...")
# ... do work ...
add_status_message("Long process finished!")
if __name__ == '__main__':
# To run this example server:
# 1. Make sure status_messenger is installed (pip install .)
# 2. Install Flask (pip install Flask)
# 3. Run this script (python your_server_script_name.py)
# Then you can access http://localhost:5000/status in your browser or from JS
app.run(debug=True, port=5000)
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file status_messenger-0.3.1.tar.gz.
File metadata
- Download URL: status_messenger-0.3.1.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5be835bc85431ba380f2bc6bc837205bdd0f22d704922c2fc32b3fc7e216299d
|
|
| MD5 |
0e231320c8832f56f291a89474143b2e
|
|
| BLAKE2b-256 |
15e4d33089adc38aec8a5f9b64876da7da1aeb464297d8fd43899c0fb0446bbb
|
File details
Details for the file status_messenger-0.3.1-py3-none-any.whl.
File metadata
- Download URL: status_messenger-0.3.1-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b333832582fd4757f488871368a660b74f012d935f82b6fc2ce4bc4c552f0c3a
|
|
| MD5 |
ed83a2acbb261ec57d77600eecbcf9e3
|
|
| BLAKE2b-256 |
de42f466c703f04efca49cbaba18a7f460a8b0390aee9a685a91459bbac33596
|