Contributing Guidelines
Thank you for your interest in contributing to the UBU Digital Finance Solution backend. This document provides guidelines and instructions for contributing to the project.
Code of Conduct
We expect all contributors to adhere to our code of conduct, which promotes a respectful and inclusive environment for everyone.
Getting Started
- Fork the repository
- Clone your fork:
git clone <your-fork-url> - Create a new branch for your feature or bugfix:
git checkout -b feature/your-feature-name - Make your changes
- Run tests to ensure your changes don't break existing functionality
- Commit your changes with descriptive commit messages
- Push your branch to your fork
- Submit a pull request to the main repository
Development Workflow
Setting Up Your Development Environment
Follow the instructions in the Setup Guide to set up your development environment.
Branching Strategy
main: The production branch, containing stable codedevelop: The development branch, containing code for the next releasefeature/*: Feature branches for new featuresbugfix/*: Bugfix branches for bug fixeshotfix/*: Hotfix branches for critical production fixes
Commit Messages
Write clear, concise commit messages that describe the changes you've made. Follow these guidelines:
- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the first line to 72 characters or less
- Reference issues and pull requests liberally after the first line
Example:
Add two-factor authentication for user login
- Implement OTP generation and verification
- Add email sending for OTP delivery
- Update authentication flow to include OTP step
Fixes #123
Pull Request Process
- Ensure your code follows the project's coding standards
- Update the documentation to reflect any changes
- Add or update tests as necessary
- Make sure all tests pass
- Get at least one code review from a maintainer
- Once approved, a maintainer will merge your pull request
Coding Standards
Python Style Guide
We follow the PEP 8 style guide for Python code. Additionally:
- Use 4 spaces for indentation (not tabs)
- Use docstrings for all public modules, functions, classes, and methods
- Keep line length to a maximum of 88 characters
- Use type hints where appropriate
- Use f-strings for string formatting
FastAPI Best Practices
- Use Pydantic models for request and response validation
- Use dependency injection for common functionality
- Document API endpoints with appropriate descriptions and examples
- Use proper HTTP status codes and error responses
- Implement proper error handling
Database Practices
- Use SQLAlchemy models for database operations
- Create Alembic migrations for database changes
- Use async database operations where appropriate
- Follow naming conventions for database objects
Testing
We use pytest for testing. All new features should include tests, and all tests must pass before a pull request can be merged.
Running Tests
Test Coverage
We aim for high test coverage. You can check the test coverage by running:
Documentation
All new features should be documented. We use MkDocs for our documentation.
Building Documentation
Serving Documentation Locally
Feature Requests and Bug Reports
If you have a feature request or have found a bug, please create an issue in the repository. Please provide as much detail as possible, including:
- A clear and descriptive title
- A detailed description of the feature or bug
- Steps to reproduce the bug (if applicable)
- Expected behavior
- Actual behavior
- Screenshots (if applicable)
- Environment information (OS, browser, etc.)
Code Review Process
All pull requests will be reviewed by at least one maintainer. The review process includes:
- Checking that the code follows the project's coding standards
- Verifying that the code works as expected
- Ensuring that the code is well-tested
- Reviewing the documentation
Continuous Integration
We use continuous integration to automatically run tests and linting on all pull requests. All CI checks must pass before a pull request can be merged.
Versioning
We follow Semantic Versioning for versioning the project.
License
By contributing to this project, you agree that your contributions will be licensed under the project's license.