π€ HuggingFace Spaces Deployment Guide
π Important: Branch Configuration
HuggingFace Spaces uses the main branch only.
Current Status (2025-09-25)
- β
Using single
mainbranch for all deployments - β All dependencies are properly configured
- β aiofiles, aiosmtplib, and jinja2 are included in requirements.txt
π Deployment Instructions
Deploy to HuggingFace
# Always use main branch for HuggingFace
git checkout main
git push origin main
git push huggingface main
π Required Dependencies
The following must be in requirements.txt for HuggingFace deployment:
aiofiles>=23.2.1 # For async file operations in audit.py
aiosmtplib>=3.0.1 # For email notifications
jinja2>=3.1.3 # For email templates
email-validator>=2.0.0 # For email validation
π§ Troubleshooting
Module Import Errors
- Verify requirements.txt has all dependencies
- Clear HuggingFace cache - Settings β Factory Reboot
- Check deployment logs for specific errors
π Best Practices
Always test locally first
pip install -r requirements.txt python app.pyUse pyproject.toml as source of truth
- Update dependencies in
pyproject.toml[hf] - Regenerate requirements.txt when needed
- Update dependencies in
Monitor deployment logs at: https://huggingface.co/spaces/neural-thinker/cidadao.ai-backend/logs
π― Current Configuration
- Entry point:
app.py(default for HuggingFace) - Port: 7860 (HuggingFace standard)
- Branch:
main(HuggingFace default) - Python: 3.11+
Last updated: 2025-09-25