Development Setup¶
Set up your development environment for contributing to Polymathy.
Prerequisites¶
- Rust 1.70+ (stable)
- Git
- Docker (optional, for running dependencies)
Install Rust¶
Clone and Build¶
# Clone the repository
git clone https://github.com/skelfresearch/polymathy.git
cd polymathy
# Build the project
cargo build
# Run tests
cargo test
Development Environment¶
Environment Variables¶
Copy the sample environment file:
Edit .env with your local settings:
SEARXNG_URL=http://localhost:8888/search
PROCESSOR_URL=http://localhost:8081/v1/process
SERVER_HOST=127.0.0.1
SERVER_PORT=8080
RUST_LOG=debug
Running Locally¶
Setting Up Dependencies¶
Option 1: Docker Compose¶
Create a docker-compose.dev.yml:
version: '3.8'
services:
searxng:
image: searxng/searxng:latest
ports:
- "8888:8080"
volumes:
- ./dev/searxng:/etc/searxng
Start dependencies:
Option 2: Manual Setup¶
Follow the SearxNG installation guide to set up a local instance.
Development Workflow¶
1. Create a Branch¶
2. Make Changes¶
Edit code, following our code style guide.
3. Test Your Changes¶
# Run all tests
cargo test
# Run specific test
cargo test test_name
# Run with output
cargo test -- --nocapture
4. Format and Lint¶
5. Build Documentation¶
# Rust documentation
cargo doc --open
# MkDocs (from documentation/ directory)
cd documentation
pip install mkdocs-material
mkdocs serve
6. Commit Changes¶
Follow Conventional Commits.
IDE Setup¶
VS Code¶
Recommended extensions:
rust-analyzer- Rust language supportEven Better TOML- TOML file supportcrates- Dependency version checking
Settings (.vscode/settings.json):
{
"rust-analyzer.checkOnSave.command": "clippy",
"editor.formatOnSave": true,
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
}
}
IntelliJ IDEA / CLion¶
Install the Rust plugin for full IDE support.
Useful Commands¶
| Command | Description |
|---|---|
cargo build |
Build the project |
cargo run |
Run the binary |
cargo test |
Run tests |
cargo fmt |
Format code |
cargo clippy |
Run linter |
cargo doc --open |
Generate and view docs |
cargo update |
Update dependencies |
cargo tree |
Show dependency tree |