Contributing to indoxhub¶
Thank you for your interest in contributing to indoxhub! This document provides guidelines and instructions for contributing to the project.
Development Setup¶
Prerequisites¶
- Python 3.9 or higher
- PostgreSQL 13 or higher
- MongoDB 6.0 or higher
- Git
Local Development Environment¶
- Clone the repository:
- Create and activate a virtual environment:
- Install dependencies:
- Set up the environment variables:
- Start the databases:
This script starts PostgreSQL and MongoDB using Docker for local development.
- Run database migrations:
- Start the development server:
The API will be available at http://localhost:8000.
Project Structure¶
indoxhub_server/
├── app/ # Main application package
│ ├── api/ # API endpoints
│ │ ├── dependencies/# FastAPI dependencies
│ │ └── routers/ # API routers
│ ├── core/ # Core functionality
│ ├── db/ # Database models and functions
│ ├── middleware/ # Middleware components
│ ├── models/ # Pydantic models
│ ├── providers/ # Provider implementations
│ └── utils/ # Utility functions
├── docs/ # Documentation
├── scripts/ # Utility scripts
├── tests/ # Test suite
│ ├── unit/ # Unit tests
│ └── integration/ # Integration tests
├── .env # Environment variables
├── main.py # Application entry point
└── requirements.txt # Python dependencies
Coding Style¶
We follow PEP 8 and use the following tools for code quality:
- Black: For code formatting
- isort: For import sorting
- flake8: For linting
- mypy: For type checking
You can run all code quality checks with:
Testing¶
We use pytest for testing. To run the tests:
# Run all tests
pytest
# Run with coverage
pytest --cov=app tests/
# Run specific tests
pytest tests/unit/
pytest tests/integration/
Adding a New Provider¶
To add a new provider:
- Create a new file in
app/providers/(e.g.,app/providers/new_provider.py) - Implement the provider class by inheriting from
BaseProvider - Create a JSON model definition file in
app/providers/json/(e.g.,app/providers/json/new_provider.json) - Add the provider to the factory mapping in
app/providers/factory.py - Add the provider to
AVAILABLE_PROVIDERSinapp/constants.py - Add tests for the provider in
tests/unit/providers/
Pull Request Process¶
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests and linting to ensure code quality
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Commit Message Guidelines¶
We follow the Conventional Commits specification:
feat:- A new featurefix:- A bug fixdocs:- Documentation only changesstyle:- Changes that do not affect the meaning of the coderefactor:- Code change that neither fixes a bug nor adds a featureperf:- Code change that improves performancetest:- Adding missing tests or correcting existing testschore:- Changes to the build process or auxiliary tools
Example:
feat(provider): add support for new provider
This adds support for the new provider, including:
- Provider implementation
- Model definitions
- Integration tests
Documentation¶
When adding or changing features, please update the relevant documentation:
- API changes should be reflected in the user-facing pages under
docs/usage/anddocs/api/ - Database changes should be documented in the internal database schema reference (not published — see the private repo)
- New providers should be documented in the internal provider integration guide (not published — see the private repo)
License¶
By contributing to indoxhub, you agree that your contributions will be licensed under the project's license.