|
| 1 | +# Contributing to CZero Engine Python SDK |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the CZero Engine Python SDK! We welcome contributions from the community. |
| 4 | + |
| 5 | +## 🚀 Getting Started |
| 6 | + |
| 7 | +1. **Fork the Repository** |
| 8 | + ```bash |
| 9 | + git clone https://github.com/czero/workflow-template.git |
| 10 | + cd workflow-template |
| 11 | + ``` |
| 12 | + |
| 13 | +2. **Set Up Development Environment** |
| 14 | + ```bash |
| 15 | + # Install UV package manager |
| 16 | + pip install uv |
| 17 | + |
| 18 | + # Install dependencies |
| 19 | + uv pip install -e ".[dev]" |
| 20 | + ``` |
| 21 | + |
| 22 | +3. **Verify Setup** |
| 23 | + ```bash |
| 24 | + # Run tests |
| 25 | + uv run pytest |
| 26 | + |
| 27 | + # Check code style |
| 28 | + uv run ruff check . |
| 29 | + ``` |
| 30 | + |
| 31 | +## 📝 Development Workflow |
| 32 | + |
| 33 | +### 1. Create a Feature Branch |
| 34 | +```bash |
| 35 | +git checkout -b feature/your-feature-name |
| 36 | +``` |
| 37 | + |
| 38 | +### 2. Make Your Changes |
| 39 | +- Write clean, readable code |
| 40 | +- Follow existing code patterns |
| 41 | +- Add type hints for all functions |
| 42 | +- Update documentation as needed |
| 43 | + |
| 44 | +### 3. Test Your Changes |
| 45 | +```bash |
| 46 | +# Run all tests |
| 47 | +uv run pytest |
| 48 | + |
| 49 | +# Run specific test |
| 50 | +uv run pytest tests/test_integration.py::test_your_feature |
| 51 | + |
| 52 | +# Check coverage |
| 53 | +uv run pytest --cov=czero_engine --cov-report=html |
| 54 | +``` |
| 55 | + |
| 56 | +### 4. Submit Pull Request |
| 57 | +- Push your branch to your fork |
| 58 | +- Create a pull request with clear description |
| 59 | +- Link any related issues |
| 60 | + |
| 61 | +## 🎯 Guidelines |
| 62 | + |
| 63 | +### Code Style |
| 64 | +- Use Python 3.11+ features |
| 65 | +- Follow PEP 8 conventions |
| 66 | +- Maximum line length: 100 characters |
| 67 | +- Use descriptive variable names |
| 68 | + |
| 69 | +### Testing |
| 70 | +- Write tests for new features |
| 71 | +- Maintain or improve code coverage |
| 72 | +- Test edge cases and error handling |
| 73 | +- Use async/await consistently |
| 74 | + |
| 75 | +### Documentation |
| 76 | +- Update docstrings for new functions |
| 77 | +- Add examples for complex features |
| 78 | +- Keep README.md current |
| 79 | +- Document breaking changes |
| 80 | + |
| 81 | +## 🏗️ Project Structure |
| 82 | + |
| 83 | +``` |
| 84 | +workflow-template/ |
| 85 | +├── czero_engine/ # Main SDK package |
| 86 | +│ ├── client.py # API client |
| 87 | +│ ├── models.py # Pydantic models |
| 88 | +│ └── workflows/ # High-level workflows |
| 89 | +├── tests/ # Test suite |
| 90 | +├── examples/ # Usage examples |
| 91 | +└── docs/ # Additional documentation |
| 92 | +``` |
| 93 | + |
| 94 | +## 🧪 Testing Requirements |
| 95 | + |
| 96 | +All contributions must: |
| 97 | +- Pass existing tests |
| 98 | +- Include tests for new features |
| 99 | +- Maintain 80%+ code coverage |
| 100 | +- Handle errors gracefully |
| 101 | + |
| 102 | +## 📦 Submitting Changes |
| 103 | + |
| 104 | +### Pull Request Checklist |
| 105 | +- [ ] Tests pass locally |
| 106 | +- [ ] Code follows style guidelines |
| 107 | +- [ ] Documentation is updated (see below) |
| 108 | +- [ ] Commit messages are clear |
| 109 | +- [ ] PR description explains changes |
| 110 | + |
| 111 | +#### What "Documentation is updated" means: |
| 112 | +Update documentation when your changes affect: |
| 113 | +- **Docstrings**: Add/update function and class docstrings in your code |
| 114 | +- **README.md**: Update if you add new features, change SDK usage, or improve examples |
| 115 | +- **Examples**: Update or add example scripts if you introduce new functionality |
| 116 | +- **Type hints**: Ensure all new functions have proper type annotations |
| 117 | +- **CHANGELOG.md**: Add entry for breaking changes or major features (if file exists) |
| 118 | + |
| 119 | +Examples: |
| 120 | +- Adding a new workflow? → Update README.md with usage example |
| 121 | +- New client method? → Add docstring with parameters and return type |
| 122 | +- Improved error handling? → Update relevant documentation |
| 123 | +- Fixed a common issue? → Consider adding to troubleshooting section |
| 124 | + |
| 125 | +Note: The CZero Engine API is closed source and cannot be modified by external contributors. This SDK is a client library that interfaces with the existing API. |
| 126 | + |
| 127 | +### Commit Message Format |
| 128 | +``` |
| 129 | +type: brief description |
| 130 | +
|
| 131 | +Longer explanation if needed |
| 132 | +Fixes #issue_number |
| 133 | +``` |
| 134 | + |
| 135 | +Types: `feat`, `fix`, `docs`, `test`, `refactor`, `perf`, `chore` |
| 136 | + |
| 137 | +## 🔧 Development Tips |
| 138 | + |
| 139 | +### Running CZero Engine Locally |
| 140 | +1. Download CZero Engine from [czero.cc](https://czero.cc) |
| 141 | +2. Start the application |
| 142 | +3. Ensure API server is running on port 1421 |
| 143 | +4. Load required models through the UI |
| 144 | + |
| 145 | +### Debug Mode |
| 146 | +```python |
| 147 | +# Enable verbose logging |
| 148 | +client = CZeroEngineClient(verbose=True) |
| 149 | + |
| 150 | +# Use environment variables |
| 151 | +CZERO_API_URL=http://localhost:1421 |
| 152 | +CZERO_VERBOSE=true |
| 153 | +``` |
| 154 | + |
| 155 | +### Common Issues |
| 156 | +- **Connection refused**: Ensure CZero Engine is running |
| 157 | +- **Model not loaded**: Load models through the app UI |
| 158 | +- **Timeout errors**: Increase client timeout for LLM operations |
| 159 | + |
| 160 | +## 🤝 Code of Conduct |
| 161 | + |
| 162 | +### Our Standards |
| 163 | +- Be respectful and inclusive |
| 164 | +- Welcome newcomers |
| 165 | +- Accept constructive criticism |
| 166 | +- Focus on what's best for the community |
| 167 | + |
| 168 | +### Unacceptable Behavior |
| 169 | +- Harassment or discrimination |
| 170 | +- Trolling or insulting comments |
| 171 | +- Public or private harassment |
| 172 | +- Publishing private information |
| 173 | + |
| 174 | +## 📋 Issue Reporting |
| 175 | + |
| 176 | +When reporting issues, include: |
| 177 | +1. Python version and OS |
| 178 | +2. CZero Engine version |
| 179 | +3. Steps to reproduce |
| 180 | +4. Error messages/logs |
| 181 | +5. Expected vs actual behavior |
| 182 | + |
| 183 | +## 🎖️ Recognition |
| 184 | + |
| 185 | +Contributors are recognized in: |
| 186 | +- GitHub contributors page |
| 187 | +- Release notes |
| 188 | +- Project documentation |
| 189 | + |
| 190 | +## 📞 Getting Help |
| 191 | + |
| 192 | +- 💬 [Discord Community](https://discord.gg/yjEUkUTEak) |
| 193 | +- 🐛 [Issue Tracker](https://github.com/czero/workflow-template/issues) |
| 194 | +- 📧 [Email](mailto:info@czero.cc) |
| 195 | + |
| 196 | +## 📜 License |
| 197 | + |
| 198 | +By contributing, you agree that your contributions will be licensed under the MIT License. |
| 199 | + |
| 200 | +--- |
| 201 | + |
| 202 | +Thank you for contributing to CZero Engine! 🚀 |
0 commit comments