A simple webcam streaming server that demonstrates agentic tools by:
- Setting up a local web server
- Streaming webcam video
- Using browser automation to display it
- CI/CD pipeline for code quality and testing
- Install dependencies:
pip3 install -r requirements.txt- Run the server:
python3 webcam_server_simple.py- Open http://localhost:5000 in your browser
The server will stream video from your default webcam (usually /dev/video0) at 640x480 resolution.
- Real-time MJPEG video streaming
- Beautiful gradient UI with Jean Claude Van Damme "Timecop" theme
- Thread-safe camera access
- Automatic camera initialization
- Graceful shutdown handling
- Automated CI/CD with linting and testing
This project includes a GitHub Actions CI pipeline that:
- ✅ Lints code with
flake8andpylint - ✅ Runs tests with
pytestand coverage reporting - ✅ Tests on multiple Python versions (3.8, 3.9, 3.10, 3.11)
- ✅ Checks code formatting with
black
This repository uses pre-commit hooks to automatically lint and format code before each commit. The hooks will:
- ✅ Remove trailing whitespace
- ✅ Fix end-of-file issues
- ✅ Format Python code with
black - ✅ Lint with
flake8 - ✅ Sort imports with
isort - ✅ Check for security issues with
bandit
First-time setup:
pip3 install pre-commit
pre-commit installAfter installation, hooks will run automatically on every git commit. You can also run them manually:
# Run on all files
pre-commit run --all-files
# Run on staged files only (default)
pre-commit runYou can run the same checks locally before pushing:
./scripts/run_ci_checks.shOr manually:
# Lint
flake8 . --max-line-length=127
pylint webcam_server_simple.py
# Test
pytest test_webcam_server.py -v
# Format check
black --check .The CI pipeline runs automatically on:
- Every push to
mainbranch - Every pull request
Check the Actions tab to see the latest CI status.
Run the test suite:
python3 test_webcam_server.py
# or
pytest test_webcam_server.py -vThe tests verify:
- All required modules can be imported
- Server files exist
- Configuration files are present