Get up and running with Oraculus-DI-Auditor in under 5 minutes.
# Clone the repository
git clone https://github.com/SynTechRev/Oraculus-DI-Auditor.git
cd Oraculus-DI-Auditor
# Create virtual environment
python3.11 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install in editable mode with dev dependencies
pip install -e ".[dev]"
# Run tests to verify installation
pytest
# Run linter
ruff check src tests
# Install pre-commit hooks
pre-commit installExpected Output:
- All 143 tests should pass
- Ruff should report "All checks passed!"
- Pre-commit hooks installed successfully
- Python: 3.11 or higher
- pip: Latest version (update with
pip install --upgrade pip) - Git: For version control
- pyenv or asdf: For managing multiple Python versions
- direnv: For automatic virtual environment activation
- VS Code or PyCharm: With Python extensions
- Linux: Ubuntu 20.04+, Debian 11+, Arch, Fedora
- macOS: 11 (Big Sur) or newer
- Windows: 10/11 with WSL2 recommended
sudo apt update
sudo apt install python3.11 python3.11-venv python3.11-devbrew install python@3.11Download from python.org or use:
winget install Python.Python.3.11# SSH (recommended for contributors)
git clone git@github.com:SynTechRev/Oraculus-DI-Auditor.git
# HTTPS (for read-only access)
git clone https://github.com/SynTechRev/Oraculus-DI-Auditor.git
cd Oraculus-DI-Auditor# Create virtual environment
python3.11 -m venv .venv
# Activate (Linux/macOS)
source .venv/bin/activate
# Activate (Windows PowerShell)
.\.venv\Scripts\Activate.ps1
# Activate (Windows cmd.exe)
.venv\Scripts\activate.batVerify Activation:
which python # Should show path inside .venv
python --version # Should show 3.11+pip install -e ".[dev]"pip install -r requirements.txt
pip install -r dev-requirements.txtWhat Gets Installed:
- Core:
pypdf,jsonschema,scikit-learn,numpy - Dev:
pytest,pytest-cov,black,ruff,pre-commit,isort
# Run full test suite
pytest
# Run with coverage report
pytest --cov=src/oraculus --cov=src/oraculus_di_auditor --cov-report=term-missing
# Check code formatting
black --check src tests
# Run linter
ruff check src tests
# Check for complexity warnings
ruff check src --statisticsInstall pre-commit hooks to automatically check code before committing:
pre-commit installWhat it does:
- Runs
rufflinter on changed files - Formats code with
black - Checks for trailing whitespace, merge conflicts, etc.
- Validates JSON and YAML files
Manual run:
pre-commit run --all-filespytestpytest tests/test_audit_engine.pypytest tests/test_audit_engine.py::test_analyze_document_smokepytest -vpytest --cov=src --cov-report=html
# Open htmlcov/index.html in browserpip install pytest-watch
ptw# Check formatting (don't modify)
black --check src tests
# Apply formatting
black src tests# Check for issues
ruff check src tests
# Auto-fix issues
ruff check src tests --fix# Check imports
isort --check-only src tests
# Fix imports
isort src testsThe project includes pyrightconfig.json for static type checking:
# Install pyright
pip install pyright
# Run type checker
pyright srcOraculus-DI-Auditor/
├── src/
│ ├── oraculus/ # Advanced legislative system
│ │ ├── auditing/ # Provenance tracking
│ │ ├── ingestion/ # Legislative loaders
│ │ └── ...
│ └── oraculus_di_auditor/ # Foundational scaffold
│ ├── analysis/ # Audit detectors
│ │ ├── audit_engine.py
│ │ ├── fiscal.py
│ │ ├── constitutional.py
│ │ ├── surveillance.py
│ │ ├── cross_reference.py
│ │ └── scalar_core.py
│ ├── ingestion/ # XML parser, checksum tracker
│ ├── interface/ # API interfaces (future)
│ ├── cli.py # Command-line interface
│ ├── config.py # Configuration
│ ├── ingest.py # Document ingestion
│ ├── normalize.py # Text normalization
│ ├── embeddings.py # TF-IDF embeddings
│ ├── retriever.py # Vector search
│ ├── analyzer.py # Anomaly analyzer
│ └── reporter.py # Report generation
├── tests/ # Test suite (143 tests)
├── docs/ # Documentation
├── config/ # Configuration files
├── data/ # Runtime data (gitignored)
├── schemas/ # JSON schemas
├── scripts/ # Utility scripts
└── pyproject.toml # Project metadata and config
- Create detector module:
# src/oraculus_di_auditor/analysis/my_detector.py
from typing import Any
def detect_my_anomalies(doc: dict[str, Any]) -> list[dict[str, Any]]:
"""Detect specific anomalies."""
anomalies = []
# Detection logic here
return anomalies- Register in audit engine:
# src/oraculus_di_auditor/analysis/audit_engine.py
from .my_detector import detect_my_anomalies
def analyze_document(doc: dict[str, Any]) -> dict[str, Any]:
anomalies = []
anomalies.extend(detect_fiscal_anomalies(doc))
anomalies.extend(detect_my_anomalies(doc)) # Add here
# ...- Write tests:
# tests/test_my_detector.py
def test_detect_my_anomalies():
doc = {"field": "value"}
result = detect_my_anomalies(doc)
assert isinstance(result, list)- Run tests and lint:
pytest tests/test_my_detector.py
ruff check src/oraculus_di_auditor/analysis/my_detector.py# Ingest documents
python -m oraculus_di_auditor.cli ingest --source data/sources
# Or use scripts
python scripts/ingest_and_index.py --source data/sources --analyze# Generate API documentation (future)
pip install pdoc3
pdoc --html --output-dir docs/api src/oraculus_di_auditorProblem: ModuleNotFoundError: No module named 'oraculus_di_auditor'
Solution:
# Ensure installed in editable mode
pip install -e .
# Verify installation
pip list | grep oraculusProblem: Tests fail with missing fixtures
Solution:
# Ensure pytest discovers fixtures
# Check that tests/conftest.py exists
ls tests/conftest.py
# Run with verbose output
pytest -vProblem: Ruff reports complexity warnings (C901)
Solution:
# These are informational (not blocking)
# Refactor complex functions iteratively
ruff check src --statisticsProblem: Wrong Python version or packages not found
Solution:
# Deactivate current environment
deactivate
# Remove old environment
rm -rf .venv
# Recreate with correct Python version
python3.11 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"Recommended Extensions:
- Python (ms-python.python)
- Pylance (ms-python.vscode-pylance)
- Ruff (charliermarsh.ruff)
- Black Formatter (ms-python.black-formatter)
Settings (.vscode/settings.json):
{
"python.defaultInterpreterPath": ".venv/bin/python",
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"python.linting.enabled": true,
"editor.formatOnSave": true,
"python.formatting.provider": "black",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}
}- Open Project: File → Open → Select
Oraculus-DI-Auditor - Configure Interpreter: Settings → Project → Python Interpreter → Add → Virtualenv Environment → Existing →
.venv/bin/python - Enable pytest: Settings → Tools → Python Integrated Tools → Testing → Default test runner: pytest
- Enable Black: Settings → Tools → Black → On code reformat
- Enable Ruff: Settings → Tools → External Tools → Add Ruff
The project uses GitHub Actions for continuous integration:
Workflow: .github/workflows/python-ci.yml
Checks:
- Pytest (all 143 tests)
- Ruff linting
- Code formatting (Black)
Local CI Simulation:
# Run exactly what CI runs
pytest
ruff check src tests
black --check src testsmain: Stable releasesdevelop: Integration branch (not currently used)feature/X: New featuresfix/X: Bug fixescopilot/X: AI-assisted development branches
Follow Conventional Commits:
feat: add constitutional delegation detector
fix: resolve provenance hash validation
docs: update audit methodology guide
test: add integration tests for audit engine
chore: update dependencies
- Create feature branch
- Make minimal, focused changes
- Ensure all tests pass
- Run linter and formatter
- Update documentation
- Submit PR with clear description
- Address code review feedback
- All tests pass
- Linter reports no errors
- Code is formatted with Black
- Docstrings added for public functions
- Tests added for new functionality
- Documentation updated
- No secrets or sensitive data committed
- Architecture:
docs/ARCHITECTURE.md - Audit Methodology:
docs/audit-methodology.md - Recursive Scalar Model:
docs/recursive-scalar-model.md - Phase Planning:
docs/PHASE_PLAN.md - Data Provenance:
docs/DATA_PROVENANCE.md
- GitHub Repository: https://github.com/SynTechRev/Oraculus-DI-Auditor
- Issue Tracker: https://github.com/SynTechRev/Oraculus-DI-Auditor/issues
- Ruff Documentation: https://docs.astral.sh/ruff/
- Pytest Documentation: https://docs.pytest.org/
For questions or issues:
- Check existing documentation
- Search GitHub issues
- Open a new issue with detailed description
- Contact: syntechrev@gmail.com
After completing setup:
- Explore the codebase: Read
docs/ARCHITECTURE.md - Run the test suite:
pytest -v - Try the CLI:
python -m oraculus_di_auditor.cli --help - Read methodology:
docs/audit-methodology.md - Contribute: Pick an issue from the roadmap
Welcome to the Oraculus-DI-Auditor project! 🚀