Contributing¶
Contributions to EpidBot are welcome!
Development Setup¶
Prerequisites¶
- Python 3.12+
- uv package manager
- Git
Clone and Install¶
git clone https://github.com/your-org/epidbot.git
cd epidbot
# Install dependencies
uv sync
# Install development dependencies
uv sync --extra dev
Run Locally¶
# Start the application
cd frontend && pnpm dev
# Run tests
uv run pytest
# Run linting
uv run ruff check .
uv run mypy .
Project Structure¶
epidbot/
├── tools.py # Agent tools
├── catalog.py # Metadata catalog
├── knowledgebase.py # Knowledge base client
├── chat_history.py # Chat persistence
├── analytics.py # Analysis functions
├── pyproject.toml # Project config
├── mkdocs.yml # Documentation config
├── tests/ # Test files
│ └── test_*.py
├── docs/ # Documentation
│ ├── index.md
│ ├── getting-started/
│ ├── user-guide/
│ ├── tools/
│ ├── deploy/
│ ├── dev/
│ └── api/
└── .github/
└── workflows/ # CI/CD
Code Style¶
Python¶
- Python 3.12+ features allowed
- Type hints required for function parameters and returns
- Follow PEP 8 conventions
- Use
snake_casefor functions/variables - Use
PascalCasefor classes
Import Order¶
# Standard library
import os
import re
from typing import List, Optional
# Third-party
import duckdb
import pandas as pd
# Local
import tools
from catalog import get_catalog_summary
Docstrings¶
Use Google-style docstrings:
def my_function(param1: str, param2: int) -> str:
"""Brief description of function.
Longer description if needed.
Args:
param1: Description of param1.
param2: Description of param2.
Returns:
Description of return value.
Raises:
ValueError: If param1 is empty.
"""
pass
Comments¶
- Use comments to explain WHY, not WHAT
- Add debug print statements for agent tool tracing:
Adding Tools¶
- Add function to
tools.py:
def my_new_tool(
ctx: RunContext[None],
param1: str,
param2: int = 10,
) -> str:
"""
Brief description for the agent.
Detailed description of what the tool does and when to use it.
Args:
param1: Description.
param2: Description with default.
Returns:
Result description.
"""
print(f"DEBUG: Tool 'my_new_tool' called")
try:
# Implementation
return f"Result: {result}"
except Exception as e:
print(f"DEBUG: Error in my_new_tool: {str(e)}")
return f"Error: {str(e)}"
- Register in the appropriate module:
- Update
create_agent()if re-registering after settings change.
Testing¶
Run Tests¶
# All tests
uv run pytest
# Specific test file
uv run pytest tests/test_tools.py
# With coverage
uv run pytest --cov=. tests/
Writing Tests¶
import pytest
from tools import my_function
def test_my_function():
"""Test description."""
result = my_function("input")
assert result == "expected output"
def test_my_function_error():
"""Test error handling."""
with pytest.raises(ValueError):
my_function("")
Documentation¶
Build Docs¶
# Install docs dependencies
uv add --dev mkdocs mkdocs-material mkdocstrings
# Serve locally
uv run mkdocs serve
# Build
uv run mkdocs build
Writing Docs¶
- Use Markdown with Material theme extensions
- Include code examples
- Add admonitions for tips/warnings:
Pull Request Process¶
- Fork the repository
- Create a feature branch:
- Make changes
- Run tests and linting:
- Commit with clear message:
- Push and create pull request
PR Checklist¶
- [ ] Tests pass
- [ ] Linting passes
- [ ] Documentation updated
- [ ] Type hints added
- [ ] Docstrings added
Reporting Issues¶
When reporting issues, include:
- Python version
- Operating system
- Steps to reproduce
- Expected behavior
- Actual behavior
- Logs/debug output
Code of Conduct¶
- Be respectful and inclusive
- Focus on constructive feedback
- Help others learn