Development Guide¶
This document introduces how to set up NetPulse development environment.
Environment Requirements¶
- Python 3.12+
- Redis 6.0+
- Git
- Docker 20.10+ and Docker Compose 2.0+ (optional)
Quick Start¶
-
Clone Project
-
Install uv (if not already installed)
-
Install Dependencies
-
Start Redis
-
Verify Environment
Development Workflow¶
Basic Process¶
-
Create Feature Branch
-
Write Code
- Follow PEP 8 code style
- Add type annotations and docstrings
-
Write appropriate comments
-
Code Check and Formatting
-
Commit Code
-
Create Pull Request
Code Standards¶
Tool Configuration - Formatting: Black - Checking: Ruff - Documentation: mkdocs-material
Commit Message Standards
Use Conventional Commits format:
Types include:
- feat: New feature
- fix: Bug fix
- docs: Documentation update
- style: Code format adjustment
- refactor: Code refactoring
- test: Test related
- chore: Build process or auxiliary tool changes
Project Structure¶
netpulse/
├── netpulse/ # Core code
│ ├── cli/ # CLI tools
│ ├── models/ # Data models
│ ├── plugins/ # Plugin system
│ │ ├── drivers/ # Device drivers
│ │ ├── schedulers/ # Schedulers
│ │ ├── templates/ # Templates
│ │ └── webhooks/ # Webhooks
│ ├── routes/ # API routes
│ ├── services/ # Business logic
│ ├── server/ # Server
│ ├── utils/ # Utility functions
│ ├── worker/ # Worker processes
│ └── controller.py # Controller
├── docs/ # Documentation
├── docker/ # Docker configuration
├── docker-compose.yaml # Production environment configuration
└── docker-compose.dev.yaml # Development environment configuration
Plugin Development¶
NetPulse adopts plugin architecture, supporting custom drivers, schedulers, templates, and Webhooks.
Driver Plugin¶
Create new driver module in netpulse/plugins/drivers/ directory.
Scheduler Plugin¶
Create new scheduler module in netpulse/plugins/schedulers/ directory.
Template Plugin¶
Create new template module in netpulse/plugins/templates/ directory.
Webhook Plugin¶
Create new Webhook module in netpulse/plugins/webhooks/ directory.
Debugging¶
Log Configuration¶
Using Debugger¶
Docker Development¶
Start Complete Environment
Development Environment
Common Questions¶
Q: How to add new device driver?
A: Refer to existing driver implementation, create new driver module in netpulse/plugins/drivers/ directory.
Q: How to debug API requests?
A: Use FastAPI's automatic documentation feature, access http://localhost:9000/docs.
Q: How to add new development dependencies?
A: Use uv add --extra dev package-name command.
Get Help¶
- GitHub Issues: Report issues and request features
- Documentation: View related documentation