Thank you for your interest in contributing to Kid Fax! This document provides guidelines and instructions for contributing.
If you find a bug, please create an issue with:
- A clear, descriptive title
- Steps to reproduce the bug
- Expected behavior vs actual behavior
- Your environment details (OS, Python version, printer model, Pi model, etc.)
- Any error messages or logs
- Whether using USB, Serial, Network, or Bluetooth printer
Feature suggestions are welcome! Please create an issue with:
- A clear description of the feature
- Use case and why it would be useful (especially for kid/family context)
- Possible implementation approach (if you have ideas)
- Whether it relates to SMS, printing, or hardware integration
-
Fork the repository and create a new branch from
maingit checkout -b feature/your-feature-name
-
Make your changes following the code style guidelines below
-
Test your changes thoroughly:
- Test with dummy printer mode:
ALLOW_DUMMY_PRINTER=true - Test with actual printer if possible
- Test SMS sending/receiving with Twilio test credentials
- Verify different printer types (USB, Serial, Network, Bluetooth)
- Test with dummy printer mode:
-
Update documentation if needed:
- Update README.md for user-facing changes
- Add comments to complex code sections
- Update CHANGELOG.md with your changes
- Update .env.example if adding new configuration
-
Commit your changes with conventional commit messages
git commit -m "feat: add MMS image printing support" git commit -m "fix: handle printer disconnection gracefully" git commit -m "docs: improve Twilio setup guide"
-
Push to your fork and create a Pull Request
git push origin feature/your-feature-name
-
Submit the PR with:
- Clear description of changes
- Reference to related issues (if any)
- Screenshots or examples (if applicable)
- Hardware tested on (printer model, Pi model)
- Follow PEP 8 style guide
- Use type hints for function parameters and return types
- Add docstrings to functions and classes
- Keep functions focused and single-purpose
- Use 4 spaces for indentation
- Use
from __future__ import annotationsfor forward references - Prefer
Optional[Type]overType | Nonefor Python 3.7-3.9 compatibility
Example:
from typing import Optional
def send_message(recipient: str, message: str) -> Optional[str]:
"""
Send SMS message via Twilio.
Args:
recipient: Phone number in E.164 format
message: Message text to send
Returns:
Twilio message SID if successful, None otherwise
"""
try:
# Implementation
return message_sid
except Exception as exc:
logger.error(f"Failed to send: {exc}")
return None# Standard library imports
import os
import logging
from typing import Optional, Dict, List
# Third-party imports
from twilio.rest import Client
from escpos.printer import Usb
# Local imports
from kidfax.printer import get_printer- Always wrap hardware operations in try/except blocks
- Log errors with appropriate levels (ERROR, WARNING, INFO)
- Return meaningful error messages
- Never let hardware failures crash the application
Example:
try:
printer = get_printer()
printer.text("Hello\n")
except Exception as exc:
logger.error(f"Print failed: {exc}")
return {"success": False, "error": str(exc)}- Use module-level loggers:
LOG = logging.getLogger(__name__) - Configure with timestamps
- Use appropriate log levels:
- DEBUG: Development details
- INFO: Normal operations
- WARNING: Recoverable issues
- ERROR: Failures
Example:
LOG.info("Connecting to USB printer (vendor=%s, product=%s)", hex(vendor), hex(product))- All configuration via
os.getenv() - Provide sensible defaults
- Document all env vars in
.env.example - Never hardcode sensitive values
Example:
POLL_SECONDS = int(os.getenv("POLL_SECONDS", "15"))KID-FAX/
├── kidfax/ # Core Python module
│ ├── __init__.py # Package marker
│ ├── printer.py # Printer abstraction layer
│ ├── sms_poller.py # Twilio SMS polling service
│ └── send_sms.py # CLI for sending replies
├── .env.example # Configuration template
├── requirements.txt # Python dependencies
├── README.md # Main documentation
├── QUICK_START.md # Quick setup guide
├── TWILIO_SETUP.md # Twilio configuration guide
├── SYSTEMD_SETUP.md # Service setup guide
├── DEPLOYMENT.md # Deployment documentation
└── archive/ # Archived web interface code
-
Clone the repository
git clone https://github.com/yourusername/KID-FAX.git cd KID-FAX -
Set up Python environment (optional but recommended)
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Configure environment
cp .env.example .env nano .env # Add your Twilio credentials -
Test without hardware
export ALLOW_DUMMY_PRINTER=true python -m kidfax.sms_poller
SMS Poller:
# With dummy printer
ALLOW_DUMMY_PRINTER=true python -m kidfax.sms_poller
# With real printer
python -m kidfax.sms_pollerSMS Sending:
python -m kidfax.send_sms +15551234567 "Test message"Printer Direct Test:
from kidfax.printer import get_printer
printer = get_printer(allow_dummy=True)
printer.text("Test\n")
printer.cut()If you have hardware access:
- Test USB printer connection
- Test serial printer (Adafruit Mini TTL)
- Test network printer
- Test Bluetooth printer
- Test e-ink display updates
We're particularly interested in contributions for:
- MMS support: Print images from text messages
- Group messaging: Send to multiple recipients
- Message scheduling: Delayed sends
- Print history: View past messages
- Status notifications: Alert when printer is out of paper
- New printer models: Test and document compatibility
- Connection types: Improve Bluetooth, Network support
- Print formatting: Better text wrapping, fonts
- Graphics: Print emojis, logos, decorations
- E-ink improvements: Better badge rendering
- Button support: Physical buttons to trigger actions
- LED indicators: Status lights
- Buzzer: Audio alerts for new messages
- Setup guides: Improve installation instructions
- Troubleshooting: Common issues and solutions
- Hardware guides: Specific printer models
- Video tutorials: Screen recordings of setup
- Unit tests: Test individual functions
- Integration tests: Test SMS → Print flow
- Hardware mocks: Better dummy implementations
- CI/CD: Automated testing
- Allowlist improvements: Better phone number validation
- Content filtering: Inappropriate message detection
- Rate limiting: Prevent spam
- Encryption: Secure credential storage
If testing a new printer model, please document:
Printer Info:
- Brand and model
- Connection type (USB, Serial, Network, Bluetooth)
- Vendor/Product IDs (for USB):
lsusboutput - ESC/POS command set version
Test Results:
- Does it print? (Yes/No)
- Text formatting quality
- Cut command works?
- Image printing works?
- Special characters (emojis, international)?
Configuration:
PRINTER_TYPE=usb
USB_VENDOR=0x0416
USB_PRODUCT=0x5011
PRINTER_LINE_WIDTH=32
PRINTER_ENCODING=cp437Add to README.md in a "Tested Printers" section!
When contributing features:
- Privacy: No cloud logging of messages
- Safety: Allowlist-first design
- Age-appropriate: Consider young users
- Parental control: Features should be parent-configurable
- Content: No exposure to inappropriate content
If you have questions about contributing, feel free to:
- Open an issue with the
questionlabel - Ask in discussions (if enabled)
- Check CLAUDE.md for architecture details
Please be respectful and constructive in all interactions. See CODE_OF_CONDUCT.md for details.
Contributors will be recognized in:
- CHANGELOG.md for their specific contributions
- README.md acknowledgments section
- GitHub contributors page
Thank you for contributing to Kid Fax! 🎉
Remember: Kid Fax is about creating magical communication experiences for kids and families. Keep contributions focused on that mission!