Installation
This guide will help you install and set up Daebus in your Python environment.
Prerequisites
Section titled “Prerequisites”Before installing Daebus, make sure you have:
- Python 3.9 or higher
- pip (Python package installer)
- A running Redis server (required for pub/sub messaging)
Installing with pip
Section titled “Installing with pip”The easiest way to install Daebus is using pip:
pip install daebusThis will install Daebus and its required dependencies.
Installation from Source
Section titled “Installation from Source”If you want to install the latest development version or make modifications, you can install from source:
# Clone the repositorygit clone https://github.com/twestos/daebus.gitcd daebus
# Install in development modepip install -e .Dependencies
Section titled “Dependencies”Daebus has the following dependencies that will be automatically installed:
- redis (>=6.0.0): For Redis pub/sub messaging between services
- apscheduler (>=3.11.0): For scheduling background tasks
- websockets (>=15.0.1): For WebSocket support
Optional Dependencies
Section titled “Optional Dependencies”For development and testing, you can install additional dependencies:
# Install with development dependenciespip install daebus[dev]
# Or if installing from sourcepip install -e ".[dev]"This includes:
- pytest and pytest-related packages for testing
- flake8 for linting
- codecov for code coverage reporting
Setting up Redis
Section titled “Setting up Redis”Daebus requires a Redis server for pub/sub messaging functionality. Here’s how to set it up:
On Linux
Section titled “On Linux”# Ubuntu/Debiansudo apt-get updatesudo apt-get install redis-server
# Start Redis servicesudo systemctl start redis-serversudo systemctl enable redis-serverOn macOS
Section titled “On macOS”Using Homebrew:
brew install redisbrew services start redisOn Windows
Section titled “On Windows”Download and install Redis for Windows from the Microsoft Store or Redis for Windows by tporadowski.
Docker
Section titled “Docker”You can also run Redis in a Docker container:
docker run -d -p 6379:6379 --name redis redis:latestVerifying Redis Installation
Section titled “Verifying Redis Installation”To verify that Redis is running correctly:
redis-cli pingThis should return PONG if Redis is running properly.
Configuration
Section titled “Configuration”By default, Daebus will connect to Redis at localhost:6379. If your Redis server is running on a different host or port, you’ll need to specify this when initializing your application:
from daebus import Daebus
app = Daebus(__name__)
# Specify Redis connection details when runningif __name__ == "__main__": app.run( service="my_service", redis_host="custom.redis.host", redis_port=6380 )Verifying Installation
Section titled “Verifying Installation”To verify that Daebus is installed correctly, you can run the following in a Python interpreter:
import daebusprint(daebus.__version__)This should display the installed version of Daebus.
Next Steps
Section titled “Next Steps”After installation, check out these resources to start building with Daebus:
- Overview - Learn about Daebus concepts and architecture
- PubSub Messaging - Learn how to use the Redis pub/sub messaging
- HTTP Endpoints - Add HTTP APIs to your Daebus services
- WebSockets - Add real-time WebSocket capabilities
Troubleshooting
Section titled “Troubleshooting”Could not find a version that satisfies the requirement
Section titled “Could not find a version that satisfies the requirement”If you see an error like:
ERROR: Could not find a version that satisfies the requirement daebusERROR: No matching distribution found for daebusMake sure you’re using Python 3.9 or higher and that your pip is up to date:
python --versionpip --versionpip install --upgrade pipConnection errors with Redis
Section titled “Connection errors with Redis”If your application fails to connect to Redis:
- Check that Redis is running:
redis-cli ping - Verify the host and port in your application
- Check for firewall rules that might be blocking the connection
- Ensure Redis is not configured to only accept local connections if you’re connecting remotely
Other Issues
Section titled “Other Issues”If you encounter other installation issues:
- Check that all dependencies are properly installed
- Try installing in a fresh virtual environment
- Check the project’s GitHub page for any reported issues
- Consult the community for help