Complete guide to setting up your development environment
- Python 3.10+ (3.10, 3.11, 3.12 tested)
- Git (for version control)
- pip (Python package manager)
- virtualenv or venv (for isolation)
- Ollama (for local LLM inference)
- Docker (for containerized development)
- VS Code or PyCharm (recommended IDEs)
Best for: Reproducible, isolated testing environment
# Clone the repository
git clone https://github.com/SoftwareDevLabs/unstructuredDataHandler.git
cd unstructuredDataHandler
# Run tests in isolated venv (creates .venv_ci automatically)
./scripts/run-tests.sh
# Or run specific tests
./scripts/run-tests.sh test/unit -k deepagentThis script:
- Creates
.venv_civirtual environment automatically - Installs pinned pytest for reliable test runs
- Runs tests with proper PYTHONPATH configuration
- Reuses the same environment on subsequent runs
Best for: Active development and debugging
# Clone the repository
git clone https://github.com/SoftwareDevLabs/unstructuredDataHandler.git
cd unstructuredDataHandler# Create virtual environment
python3 -m venv .venv
# Activate (macOS/Linux)
source .venv/bin/activate
# Activate (Windows)
.venv\Scripts\activate# Upgrade pip
pip install --upgrade pip
# Install development dependencies
pip install -r requirements-dev.txt
# Install documentation dependencies (optional)
pip install -r requirements-docs.txt# macOS/Linux
export PYTHONPATH=.
# Windows
set PYTHONPATH=.
# Or add to .bashrc/.zshrc (macOS/Linux)
echo 'export PYTHONPATH=.' >> ~/.zshrc
source ~/.zshrc# Run tests
python -m pytest test/ -v
# Check linting
python -m pylint src/ --exit-zero
# Check type checking
python -m mypy src/ --ignore-missing-imports# Create environment
python3 -m venv .venv
# Activate
source .venv/bin/activate # macOS/Linux
.venv\Scripts\activate # Windows
# Install packages
pip install -r requirements-dev.txt# Create environment
conda create -n unstructuredDataHandler python=3.11
# Activate
conda activate unstructuredDataHandler
# Install packages
pip install -r requirements-dev.txt# Install Python 3.11
pyenv install 3.11.5
# Set local version
pyenv local 3.11.5
# Create virtualenv
python -m venv .venv
source .venv/bin/activate
# Install packages
pip install -r requirements-dev.txt# requirements.txt
docling>=2.55.1 # Document parsing
docling-core>=2.48.4 # Docling core library
pydantic>=2.0.0 # Data validation
requests>=2.31.0 # HTTP requests
pyyaml>=6.0 # YAML configuration# requirements-dev.txt
pytest>=8.0.0 # Testing framework
pytest-cov>=4.1.0 # Coverage reporting
pytest-timeout>=2.2.0 # Test timeouts
pylint>=3.0.0 # Linting
mypy>=1.8.0 # Type checking
ruff>=0.1.0 # Fast linting
black>=23.0.0 # Code formatting
isort>=5.12.0 # Import sorting# requirements-streamlit.txt
streamlit>=1.28.0 # Web UI
markdown>=3.5.0 # Markdown rendering
pandas>=2.0.0 # Data manipulation
plotly>=5.17.0 # Visualizations (optional)# requirements-docs.txt
mkdocs>=1.5.0 # Documentation site
mkdocs-material>=9.0.0 # Material theme
mkdocstrings>=0.24.0 # API documentation# macOS
brew install ollama
# Linux
curl -fsSL https://ollama.com/install.sh | sh
# Windows
# Download from https://ollama.com/download# Start server (runs in background)
ollama serve &
# Verify it's running
curl http://localhost:11434/api/tags# Recommended: Balanced model
ollama pull qwen2.5:7b
# Alternative: Faster model
ollama pull qwen2.5:3b
# Alternative: Better quality
ollama pull qwen3:14b
# Alternative: LLaMA
ollama pull llama3.1:8b# .env file
DEFAULT_LLM_PROVIDER=ollama
DEFAULT_LLM_MODEL=qwen2.5:7b
OLLAMA_BASE_URL=http://localhost:11434# Test Ollama
ollama run qwen2.5:7b "Hello, how are you?"
# Test in Python
python -c "from src.utils.config_loader import create_llm_from_config; llm = create_llm_from_config(); print(llm.generate('Hello!'))"# Get API key from https://platform.openai.com/api-keys
# Set in .env
OPENAI_API_KEY=sk-...
DEFAULT_LLM_PROVIDER=openai
DEFAULT_LLM_MODEL=gpt-4o-mini# Get API key from https://cloud.cerebras.ai/
# Set in .env
CEREBRAS_API_KEY=your-key-here
DEFAULT_LLM_PROVIDER=cerebras
DEFAULT_LLM_MODEL=llama3.1-8b# Get API key from https://console.anthropic.com/
# Set in .env
ANTHROPIC_API_KEY=sk-ant-...
DEFAULT_LLM_PROVIDER=anthropic
DEFAULT_LLM_MODEL=claude-3-5-sonnet-20241022code --install-extension ms-python.python
code --install-extension ms-python.vscode-pylance
code --install-extension ms-python.black-formatter
code --install-extension charliermarsh.ruffCreate .vscode/settings.json:
{
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.provider": "black",
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}Create .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"env": {
"PYTHONPATH": "${workspaceFolder}"
}
},
{
"name": "Pytest: Current File",
"type": "python",
"request": "launch",
"module": "pytest",
"args": ["${file}", "-v"],
"console": "integratedTerminal",
"env": {
"PYTHONPATH": "${workspaceFolder}"
}
},
{
"name": "Streamlit UI",
"type": "python",
"request": "launch",
"module": "streamlit",
"args": ["run", "test/debug/streamlit_document_parser.py"],
"console": "integratedTerminal",
"env": {
"PYTHONPATH": "${workspaceFolder}"
}
}
]
}- Open Settings → Project → Python Interpreter
- Click Add Interpreter → Virtualenv Environment
- Select Existing environment
- Choose
.venv/bin/python
- Open Run → Edit Configurations
- Add Environment variables:
PYTHONPATH=.
- Open Settings → Tools → Python Integrated Tools
- Set Default test runner to pytest
# Copy template
cp .env.example .env
# Edit with your settings
vim .envMinimal .env:
# LLM Provider
DEFAULT_LLM_PROVIDER=ollama
DEFAULT_LLM_MODEL=qwen2.5:7b
OLLAMA_BASE_URL=http://localhost:11434
# Logging
LOG_LEVEL=INFO
DEBUG=false
# Storage
LOCAL_IMAGE_DIR=./data/outputs/embeddingspip install pre-commitrepos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruffpre-commit install# All tests
PYTHONPATH=. python -m pytest test/ -v
# Specific suite
PYTHONPATH=. python -m pytest test/unit/ -v
PYTHONPATH=. python -m pytest test/integration/ -v
# With coverage
PYTHONPATH=. python -m pytest test/ --cov=src/ --cov-report=html
# Open coverage report
open htmlcov/index.html# Run only unit tests
pytest -m unit
# Skip slow tests
pytest -m "not slow"
# Skip tests requiring Ollama
pytest -m "not requires_ollama"
# Skip tests requiring API keys
pytest -m "not requires_api_key"# Pylint
python -m pylint src/ --exit-zero
# Ruff (faster alternative)
python -m ruff check src/
# Fix automatically
python -m ruff check src/ --fix# Mypy
python -m mypy src/ --ignore-missing-imports
# Specific module
python -m mypy src/agents/document_agent.py# Black
python -m black src/ test/
# Check only (no changes)
python -m black src/ test/ --check
# isort (import sorting)
python -m isort src/ test/# Feature branches
dev/<alias>/<feature-name>
# Example
dev/johndoe/add-new-llm-provider
# Bug fix branches
dev/<alias>/fix-<issue-number>
# Example
dev/johndoe/fix-123# Create feature branch from dev/main
git checkout dev/main
git pull origin dev/main
git checkout -b dev/yourname/your-feature
# Make changes and commit
git add .
git commit -m "feat: add new feature"
# Push to remote
git push origin dev/yourname/your-feature
# Create pull request on GitHub- Develop on feature branch (
dev/<alias>/<feature>) - Create PR to
dev/main - Get approval and merge (squash recommended)
- Cherry-pick to
inboxbranch - Git2Git auto-creates PR to Overall Tool Repo
- Approve and complete the auto-PR
Solution: Set PYTHONPATH
export PYTHONPATH=.
python -m pytest test/ -vSolution: Install dependencies
pip install -r requirements-dev.txtSolution: Start Ollama server
ollama serve &Solution: Set API key or skip those tests
# Set API key
export OPENAI_API_KEY="your-key"
# Or skip those tests
pytest -m "not requires_api_key"Solution: Add ignore flag or fix types
# Ignore missing imports
mypy src/ --ignore-missing-imports
# Or fix by adding type stubs
pip install types-requests types-pyyaml# Install build tools
pip install build twine
# Build distribution
python -m build
# Check distribution
twine check dist/*# Build Docker image
docker build -t unstructuredDataHandler .
# Run container
docker run -p 8501:8501 unstructuredDataHandler- Quick Start:
doc/user-guide/quick-start.md - Configuration:
doc/user-guide/configuration.md - Architecture:
doc/developer-guide/architecture.md - Testing Guide:
doc/user-guide/testing.md - Contributing:
CONTRIBUTING.md
- Python 3.10+ installed
- Repository cloned
- Virtual environment created
- Dependencies installed
- PYTHONPATH set
- Tests passing
- Ollama installed (or cloud API key)
- Model pulled (Ollama) or key set (cloud)
- .env file configured
- LLM test successful
- IDE configured (VS Code or PyCharm)
- Extensions/plugins installed
- Linting enabled
- Testing framework configured
- Pre-commit hooks installed (optional)
- Linting tools working
- Type checking working
- Code formatting working
Last Updated: 2025-01-XX
Version: 2.0