|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thank you for your interest in contributing to ABI! This document outlines the process and best practices for contributing to the project. |
| 4 | + |
| 5 | +## Code of Conduct |
| 6 | + |
| 7 | +We are committed to providing a welcoming and inclusive experience for everyone. Please read our Code of Conduct before participating in our community. |
| 8 | + |
| 9 | +## Getting Started |
| 10 | + |
| 11 | +1. **Fork the repository** or clone locally |
| 12 | +2. **Set up environment variables** by copying `.env.example` to `.env` and adding your credentials |
| 13 | +3. **Run the project** using `make` |
| 14 | + |
| 15 | +## Development Workflow |
| 16 | + |
| 17 | +1. Pick an issue to work on on [GitHub](https://github.com/jupyter-naas/abi/issues) |
| 18 | + |
| 19 | +2. Create a new branch for your feature or bugfix: |
| 20 | + ```bash |
| 21 | + git checkout -b feature/your-feature-name |
| 22 | + ``` |
| 23 | + |
| 24 | +3. Make your changes following the project's [coding standards](#coding-standards) |
| 25 | + |
| 26 | +4. Add tests for your changes |
| 27 | + |
| 28 | +5. Ensure all tests pass: |
| 29 | + ```bash |
| 30 | + make test |
| 31 | + ``` |
| 32 | + |
| 33 | +6. Update documentation as needed |
| 34 | + |
| 35 | +7. Commit your changes with clear, descriptive commit messages: |
| 36 | + ```bash |
| 37 | + git commit -m "Add feature: description of the changes" |
| 38 | + ``` |
| 39 | + |
| 40 | +8. Push your branch to your fork and [submit a pull request](#pull-request-process) |
| 41 | + |
| 42 | +## Project Structure |
| 43 | + |
| 44 | +ABI follows a modular architecture: |
| 45 | + |
| 46 | +``` |
| 47 | +src/ |
| 48 | +├── core/ # Core system modules |
| 49 | +│ └── modules/ # Core functionality organized by domain |
| 50 | +├── custom/ # Custom modules for specific use cases |
| 51 | +│ └── modules/ # Custom functionality organized by domain |
| 52 | +└── marketplace/ # Marketplace for modules to be used in the engine |
| 53 | +``` |
| 54 | + |
| 55 | +Each module can contain: |
| 56 | +- `assistants/`: LLM agent configurations |
| 57 | +- `workflows/`: Business logic implementations |
| 58 | +- `pipelines/`: Data transformation processes |
| 59 | +- `integrations/`: Service connectors |
| 60 | +- `models/`: Data models and schemas |
| 61 | +- `ontologies/`: Semantic data definitions |
| 62 | +- `tests/`: Module-specific tests |
| 63 | + |
| 64 | +## Coding Standards |
| 65 | + |
| 66 | +### General Guidelines |
| 67 | + |
| 68 | +1. **Follow functional programming principles** |
| 69 | + - Use pure functions when possible |
| 70 | + - Minimize side effects |
| 71 | + - Use immutable data structures |
| 72 | + - Leverage higher-order functions and function composition |
| 73 | + |
| 74 | +2. **Keep functions focused and small** |
| 75 | + - Each function should do one thing well |
| 76 | + - Aim for functions that are less than 25 lines |
| 77 | + |
| 78 | +3. **Use descriptive names** |
| 79 | + - Use meaningful variable and function names |
| 80 | + - Follow `snake_case` for functions and variables |
| 81 | + - Follow `PascalCase` for classes |
| 82 | + |
| 83 | +4. **Document your code** |
| 84 | + - Add docstrings to all functions and classes |
| 85 | + - Include parameter and return value descriptions |
| 86 | + - Provide usage examples for public APIs |
| 87 | + |
| 88 | +5. **Error handling** |
| 89 | + - Use appropriate exception types |
| 90 | + - Provide helpful error messages |
| 91 | + - Handle errors at appropriate levels |
| 92 | + |
| 93 | +## Module Development |
| 94 | + |
| 95 | +When developing new modules, follow these guidelines: |
| 96 | + |
| 97 | +### Creating Integrations |
| 98 | + |
| 99 | +Integrations connect ABI to external services: |
| 100 | + |
| 101 | +1. Create a configuration class |
| 102 | +2. Implement the Integration interface |
| 103 | +3. Provide methods for API interactions |
| 104 | +4. Expose as tools via `as_tools()` |
| 105 | +5. Include comprehensive error handling |
| 106 | + |
| 107 | +### Developing Workflows |
| 108 | + |
| 109 | +Workflows implement business logic: |
| 110 | + |
| 111 | +1. Define parameters using `WorkflowParameters` |
| 112 | +2. Implement the `run()` method |
| 113 | +3. Expose as tools via `as_tools()` |
| 114 | +4. Add API endpoints via `as_api()` |
| 115 | +5. Follow the single responsibility principle |
| 116 | + |
| 117 | +### Building Pipelines |
| 118 | + |
| 119 | +Pipelines transform data into semantic triples: |
| 120 | + |
| 121 | +1. Use integrations for data fetching |
| 122 | +2. Transform data into semantic graphs |
| 123 | +3. Store results in the ontology store |
| 124 | +4. Ensure idempotent operations |
| 125 | +5. Handle large datasets efficiently |
| 126 | + |
| 127 | +### Implementing Assistants |
| 128 | + |
| 129 | +Assistants provide LLM agent interfaces: |
| 130 | + |
| 131 | +1. Define metadata (name, description, etc.) |
| 132 | +2. Create a system prompt |
| 133 | +3. Configure appropriate tools |
| 134 | +4. Set up memory and shared state |
| 135 | +5. Implement the `create_agent()` function |
| 136 | + |
| 137 | +## Testing |
| 138 | + |
| 139 | +All contributions should include appropriate tests: |
| 140 | + |
| 141 | +1. **Unit tests** for individual functions and classes |
| 142 | +2. **Integration tests** for workflows and pipelines |
| 143 | +3. **End-to-end tests** for complete features |
| 144 | + |
| 145 | +Use `unittest` for writing tests and run them with: |
| 146 | + |
| 147 | +```bash |
| 148 | +make test |
| 149 | +``` |
| 150 | + |
| 151 | +## Documentation |
| 152 | + |
| 153 | +Good documentation is essential: |
| 154 | + |
| 155 | +1. **Code comments** for complex logic |
| 156 | +2. **Docstrings** for all public functions and classes |
| 157 | +3. **README.md** files for modules |
| 158 | +4. **Examples** showing how to use your feature |
| 159 | +5. **Update existing docs** affected by your changes |
| 160 | + |
| 161 | +## Pull Request Process |
| 162 | + |
| 163 | +1. **Submit your PR** against the `main` branch |
| 164 | +2. **Fill out the PR template** with a description of changes |
| 165 | +3. **Link related issues** using keywords like "Fixes #123" |
| 166 | +4. **Ensure CI passes** including tests and linting |
| 167 | +5. **Request reviews** from maintainers |
| 168 | +6. **Address feedback** promptly |
| 169 | +7. **Squash commits** before merging if requested |
| 170 | + |
| 171 | +We aim to review PRs within 1-2 business days. Thank you for contributing to ABI! |
0 commit comments