Thank you for your interest in OpenViking! We welcome contributions of all kinds:
- Bug reports
- Feature requests
- Documentation improvements
- Code contributions
- Python: 3.9+
- Go: 1.25.1+ (Required for building AGFS components)
- C++ Compiler: GCC 9+ or Clang 11+ (Required for building core extensions, must support C++17)
- CMake: 3.12+
git clone https://github.com/YOUR_USERNAME/openviking.git
cd openvikingWe recommend using uv for Python environment management:
# Install uv (if not installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Sync dependencies and create virtual environment
uv sync --all-extras
source .venv/bin/activate # Linux/macOS
# or .venv\Scripts\activate # Windows
Create a configuration file ov.conf:
{
"embedding": {
"dense": {
"provider": "volcengine",
"api_key": "your-api-key",
"model": "doubao-embedding-vision-250615",
"api_base": "https://ark.cn-beijing.volces.com/api/v3",
"dimension": 1024,
"input": "multimodal"
}
},
"vlm": {
"api_key": "your-api-key",
"model": "doubao-seed-1-8-251228",
"api_base": "https://ark.cn-beijing.volces.com/api/v3"
}
}Set the environment variable:
export OPENVIKING_CONFIG_FILE=ov.confimport asyncio
import openviking as ov
async def main():
client = ov.AsyncOpenViking(path="./test_data")
await client.initialize()
print("OpenViking initialized successfully!")
await client.close()
asyncio.run(main())openviking/
├── pyproject.toml # Project configuration
├── third_party/ # Third-party dependencies
│ └── agfs/ # AGFS filesystem
│
├── openviking/ # Python SDK
│ ├── async_client.py # AsyncOpenViking client
│ ├── sync_client.py # SyncOpenViking client
│ │
│ ├── core/ # Core data models
│ │ ├── context.py # Context base class
│ │ └── directories.py # Directory definitions
│ │
│ ├── parse/ # Resource parsers
│ │ ├── parsers/ # Parser implementations
│ │ ├── tree_builder.py
│ │ └── registry.py
│ │
│ ├── retrieve/ # Retrieval system
│ │ ├── retriever.py # Main retriever
│ │ ├── reranker.py # Reranking
│ │ └── intent_analyzer.py
│ │
│ ├── session/ # Session management
│ │ ├── session.py # Session core
│ │ └── compressor.py # Compression
│ │
│ ├── storage/ # Storage layer
│ │ ├── viking_fs.py # VikingFS
│ │ └── vectordb/ # Vector database
│ │
│ ├── utils/ # Utilities
│ │ └── config/ # Configuration
│ │
│ └── prompts/ # Prompt templates
│
├── tests/ # Test suite
└── docs/ # Documentation
├── en/ # English docs
└── zh/ # Chinese docs
We use the following tools to maintain code consistency:
| Tool | Purpose | Config |
|---|---|---|
| Ruff | Linting, Formatting, Import sorting | pyproject.toml |
| mypy | Type checking | pyproject.toml |
We use pre-commit to automatically run these checks before every commit. This ensures your code always meets the standards without manual effort.
-
Install pre-commit:
pip install pre-commit
-
Install the git hooks:
pre-commit install
Now, ruff (check & format) will run automatically when you run git commit. If any check fails, it may automatically fix the file. You just need to add the changes and commit again.
# Format code
ruff format openviking/
# Lint
ruff check openviking/
# Type check
mypy openviking/- Line width: 100 characters
- Indentation: 4 spaces
- Strings: Prefer double quotes
- Type hints: Encouraged but not required
- Docstrings: Required for public APIs (1-2 lines max)
# Run all tests
pytest
# Run specific test file
pytest tests/test_parser.py
# Run with coverage
pytest --cov=openviking --cov-report=term-missing
# Run with verbose output
pytest -vPlace test files in tests/ directory with test_*.py naming:
# tests/test_client.py
import pytest
from openviking import AsyncOpenViking
class TestAsyncOpenViking:
@pytest.mark.asyncio
async def test_initialize(self, tmp_path):
client = AsyncOpenViking(path=str(tmp_path / "data"))
await client.initialize()
assert client._viking_fs is not None
await client.close()
@pytest.mark.asyncio
async def test_add_resource(self, tmp_path):
client = AsyncOpenViking(path=str(tmp_path / "data"))
await client.initialize()
result = await client.add_resource(
"./test.md",
reason="test document"
)
assert result["status"] == "success"
assert "root_uri" in result
await client.close()git checkout main
git pull origin main
git checkout -b feature/your-feature-nameBranch naming conventions:
feature/xxx- New featuresfix/xxx- Bug fixesdocs/xxx- Documentation updatesrefactor/xxx- Code refactoring
- Follow code style guidelines
- Add tests for new functionality
- Update documentation as needed
git add .
git commit -m "feat: add new parser for xlsx files"git push origin feature/your-feature-nameThen create a Pull Request on GitHub.
We follow Conventional Commits:
<type>(<scope>): <subject>
<body>
<footer>
| Type | Description |
|---|---|
feat |
New feature |
fix |
Bug fix |
docs |
Documentation |
style |
Code style (no logic change) |
refactor |
Code refactoring |
perf |
Performance improvement |
test |
Tests |
chore |
Build/tooling |
# New feature
git commit -m "feat(parser): add support for xlsx files"
# Bug fix
git commit -m "fix(retrieval): fix score calculation in rerank"
# Documentation
git commit -m "docs: update quick start guide"
# Refactoring
git commit -m "refactor(storage): simplify interface methods"Use the same format as commit messages.
## Summary
Brief description of the changes and their purpose.
## Type of Change
- [ ] New feature (feat)
- [ ] Bug fix (fix)
- [ ] Documentation (docs)
- [ ] Refactoring (refactor)
- [ ] Other
## Testing
Describe how to test these changes:
- [ ] Unit tests pass
- [ ] Manual testing completed
## Related Issues
- Fixes #123
- Related to #456
## Checklist
- [ ] Code follows project style guidelines
- [ ] Tests added for new functionality
- [ ] Documentation updated (if needed)
- [ ] All tests passWe use GitHub Actions for Continuous Integration and Continuous Deployment. Our workflows are designed to be modular and tiered.
| Event | Workflow | Description |
|---|---|---|
| Pull Request | pr.yml |
Runs Lint (Ruff, Mypy) and Test Lite (Integration tests on Linux + Python 3.10). Fast feedback for contributors. |
| Push to Main | ci.yml |
Runs Test Full (All OS: Linux/Win/Mac, All Py: 3.9-3.12) and CodeQL (Security scan). Ensures main branch stability. |
| Release Published | release.yml |
Triggered when you create a Release on GitHub. Automatically builds wheels, verifies the Git Tag matches pyproject.toml, and publishes to PyPI. |
| Weekly Cron | schedule.yml |
Runs CodeQL security scan every Sunday. |
Maintainers can manually trigger workflows from the "Actions" tab to perform specific tasks or debug issues.
You can run tests with custom matrix configurations using _Test Lite.
- Inputs:
os_json: JSON string array of OS to run on (e.g.,["ubuntu-latest", "windows-latest"]).python_json: JSON string array of Python versions (e.g.,["3.10", "3.12"]).
You can manually trigger the release.yml workflow (listed as "Publish to PyPI") to build and publish without creating a GitHub Release.
- Inputs:
target: Select where to publish.none: Build artifacts only (no publish). Good for verifying build capability.testpypi: Publish to TestPyPI. Good for beta testing.pypi: Publish to official PyPI.both: Publish to both.
Note: For manual triggers, the strict "Git Tag matches pyproject.toml" check is relaxed to a warning, allowing you to test builds on non-tagged commits.
Please provide:
-
Environment
- Python version
- OpenViking version
- Operating system
-
Steps to Reproduce
- Detailed steps
- Code snippets
-
Expected vs Actual Behavior
-
Error Logs (if any)
Please describe:
- Problem: What problem are you trying to solve?
- Solution: What solution do you propose?
- Alternatives: Have you considered other approaches?
Documentation is in Markdown format under docs/:
docs/en/- English documentationdocs/zh/- Chinese documentation
- Code examples must be runnable
- Keep documentation in sync with code
- Use clear, concise language
By participating in this project, you agree to:
- Be respectful: Maintain a friendly and professional attitude
- Be inclusive: Welcome contributors from all backgrounds
- Be constructive: Provide helpful feedback
- Stay focused: Keep discussions technical
If you have questions:
Thank you for contributing!