|
| 1 | +# Contributing to DS |
| 2 | + |
| 3 | +Thank you for your interest in contributing to DS! We welcome issues and pull requests from everyone. |
| 4 | + |
| 5 | +This document provides guidelines and instructions for contributing to the project. |
| 6 | + |
| 7 | +## Table of Contents |
| 8 | + |
| 9 | +- [Getting Started](#getting-started) |
| 10 | +- [Development Environment](#development-environment) |
| 11 | +- [Code Style](#code-style) |
| 12 | +- [Pre-commit Hooks](#pre-commit-hooks) |
| 13 | +- [Running Tests](#running-tests) |
| 14 | +- [Submitting Pull Requests](#submitting-pull-requests) |
| 15 | +- [License](#license) |
| 16 | + |
| 17 | +## Getting Started |
| 18 | + |
| 19 | +DS is a deductive system for logical inference implemented in C++, with bindings for Python (via pybind11) and TypeScript/JavaScript (via Emscripten/WebAssembly). |
| 20 | + |
| 21 | +To get started: |
| 22 | + |
| 23 | +1. Fork the repository on GitHub |
| 24 | +2. Clone your fork locally: |
| 25 | + ```bash |
| 26 | + git clone https://github.com/YOUR_USERNAME/ds.git |
| 27 | + cd ds |
| 28 | + ``` |
| 29 | +3. Set up your development environment (see below) |
| 30 | + |
| 31 | +## Development Environment |
| 32 | + |
| 33 | +### Prerequisites |
| 34 | + |
| 35 | +- **C++**: C++20 compatible compiler (GCC 10+, Clang 10+, MSVC 2019+), CMake 3.30+ |
| 36 | +- **Python**: Python 3.10-3.14 |
| 37 | +- **TypeScript/JavaScript**: Node.js 20+, Emscripten SDK (for building WebAssembly) |
| 38 | + |
| 39 | +### Building the Project |
| 40 | + |
| 41 | +#### C++ Core Library |
| 42 | + |
| 43 | +```bash |
| 44 | +cmake -B build |
| 45 | +cmake --build build |
| 46 | +``` |
| 47 | + |
| 48 | +#### Python Package |
| 49 | + |
| 50 | +```bash |
| 51 | +uv sync --extra dev |
| 52 | +``` |
| 53 | + |
| 54 | +#### TypeScript/JavaScript Package |
| 55 | + |
| 56 | +Requires [Emscripten SDK](https://emscripten.org/docs/getting_started/downloads.html) to be installed. |
| 57 | + |
| 58 | +```bash |
| 59 | +npm install |
| 60 | +npm run build |
| 61 | +``` |
| 62 | + |
| 63 | +## Code Style |
| 64 | + |
| 65 | +This project uses automated code formatting tools to ensure consistency. Please make sure your code follows these styles before submitting. |
| 66 | + |
| 67 | +### C++ |
| 68 | + |
| 69 | +- Uses [clang-format](https://clang.llvm.org/docs/ClangFormat.html) for formatting |
| 70 | +- Configuration is in `.clang-format` |
| 71 | +- Run manually: `clang-format -i <file>` |
| 72 | + |
| 73 | +### Python |
| 74 | + |
| 75 | +- Uses [ruff](https://github.com/astral-sh/ruff) for linting and formatting |
| 76 | +- Configuration is in `pyproject.toml` |
| 77 | +- Run manually: |
| 78 | + ```bash |
| 79 | + ruff check --fix |
| 80 | + ruff format |
| 81 | + ``` |
| 82 | + |
| 83 | +### TypeScript/JavaScript |
| 84 | + |
| 85 | +- Uses [Biome](https://biomejs.dev/) for linting and formatting |
| 86 | +- Configuration is in `biome.json` |
| 87 | +- Run manually: `npx @biomejs/biome check` |
| 88 | + |
| 89 | +## Pre-commit Hooks |
| 90 | + |
| 91 | +This project uses [pre-commit](https://pre-commit.com/) to run code quality checks automatically before each commit. |
| 92 | + |
| 93 | +### Setup |
| 94 | + |
| 95 | +Install pre-commit hooks: |
| 96 | + |
| 97 | +```bash |
| 98 | +pip install pre-commit |
| 99 | +pre-commit install |
| 100 | +``` |
| 101 | + |
| 102 | +The hooks will automatically run on staged files when you commit. To run all hooks manually: |
| 103 | + |
| 104 | +```bash |
| 105 | +pre-commit run --all-files |
| 106 | +``` |
| 107 | + |
| 108 | +### Configured Hooks |
| 109 | + |
| 110 | +- **clang-format**: Formats C/C++/CUDA files |
| 111 | +- **ruff-check**: Lints Python files (with auto-fix) |
| 112 | +- **ruff-format**: Formats Python files |
| 113 | +- **biome-check**: Lints and formats TypeScript/JavaScript files |
| 114 | + |
| 115 | +## Running Tests |
| 116 | + |
| 117 | +### TypeScript/JavaScript |
| 118 | + |
| 119 | +```bash |
| 120 | +npm test |
| 121 | +``` |
| 122 | + |
| 123 | +### Python |
| 124 | + |
| 125 | +```bash |
| 126 | +uv run pytest |
| 127 | +``` |
| 128 | + |
| 129 | +### C++ |
| 130 | + |
| 131 | +```bash |
| 132 | +cd build |
| 133 | +ctest |
| 134 | +``` |
| 135 | + |
| 136 | +## Submitting Pull Requests |
| 137 | + |
| 138 | +1. Create a new branch for your changes |
| 139 | + |
| 140 | +2. Make your changes and commit with a clear, descriptive commit message |
| 141 | + |
| 142 | +3. Push to your fork and submit a pull request to the main repository |
| 143 | + |
| 144 | +## License |
| 145 | + |
| 146 | +By contributing to DS, you agree that your contributions will be licensed under the [GNU Affero General Public License v3.0 or later](LICENSE.md). |
0 commit comments