Spaces:
Running
Running
File size: 4,736 Bytes
cc59214 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | # Contributing to Docling Studio
Thank you for your interest in contributing to Docling Studio! This guide will help you get started.
## Getting Started
1. **Fork** the repository on GitHub
2. **Clone** your fork locally:
```bash
git clone https://github.com/<your-username>/Docling-Studio.git
cd Docling-Studio
```
3. **Create a branch** for your work:
```bash
git checkout -b feature/my-feature
```
## Development Setup
### Backend (Python 3.12+)
```bash
cd document-parser
python -m venv .venv && source .venv/bin/activate
# Remote mode (lightweight β delegates to Docling Serve)
pip install -r requirements.txt
# Local mode (full β runs Docling in-process)
pip install -r requirements-local.txt
pip install ruff pytest pytest-asyncio httpx # dev tools
uvicorn main:app --reload --port 8000
```
### Frontend (Node 20+)
```bash
cd frontend
npm install
npm run dev
```
## Code Quality
### Backend β Ruff
We use [Ruff](https://docs.astral.sh/ruff/) for linting and formatting Python code.
```bash
cd document-parser
ruff check . # lint
ruff check . --fix # lint with auto-fix
ruff format . # format
```
### Frontend β TypeScript + ESLint + Prettier
```bash
cd frontend
npm run type-check # type check (vue-tsc)
npx eslint src/ # lint
npx prettier --check src/ # check formatting
npx prettier --write src/ # auto-format
```
## Running Tests
```bash
# Backend (199 tests)
cd document-parser
pytest tests/ -v
# Frontend (129 tests)
cd frontend
npm run test:run
```
All tests must pass before submitting a PR.
## Submitting Changes
1. **Commit** with clear, descriptive messages
2. **Push** your branch to your fork
3. Open a **Pull Request** against `main`
4. Describe **what** changed and **why** in the PR description
5. Ensure CI passes (tests + build)
## Branching Strategy
We follow a simplified Git Flow:
| Branch | Purpose |
|--------|---------|
| `main` | Always stable β latest release merged back |
| `release/X.Y.Z` | Release preparation (freeze, bugfixes, changelog) |
| `feature/*` | New features β PR to `main` |
| `fix/*` | Bug fixes β PR to `main` (or `release/*` for pre-release fixes) |
| `hotfix/X.Y.Z` | Urgent fix on a released version β PR to `main` |
Rules:
- All PRs target `main` (never stack branches on other feature branches)
- `release/*` branches are created from `main` when preparing a release
- `hotfix/*` branches are created from the release tag
## Versioning
We use [Semantic Versioning](https://semver.org/): `MAJOR.MINOR.PATCH`.
- **Source of truth**: the git tag (`vX.Y.Z`)
- `package.json` version should match the current release branch
- The build injects the version automatically (Vite `__APP_VERSION__` for frontend, `APP_VERSION` env var for backend)
## Release Process
1. **Create the release branch** from `main`:
```bash
git checkout main && git pull
git checkout -b release/X.Y.Z
```
2. **On the release branch**, only:
- Bug fixes
- Move `[Unreleased]` to `[X.Y.Z] - YYYY-MM-DD` in `CHANGELOG.md`
- Update `version` in `frontend/package.json`
3. **Merge into `main`** via PR, then **tag on `main`**:
```bash
git checkout main && git pull
git tag vX.Y.Z
git push origin vX.Y.Z
```
4. The tag triggers the **release workflow** which builds and pushes the Docker image to `ghcr.io`.
### Docker Image Tags
Each release produces two image variants:
| Tag | Description |
|-----|-------------|
| `X.Y.Z-remote` | Exact version β lightweight (Docling Serve) |
| `X.Y.Z-local` | Exact version β full (in-process Docling) |
| `X.Y-remote` | Latest patch of this minor β lightweight |
| `X.Y-local` | Latest patch of this minor β full |
| `latest-remote` | Latest stable β lightweight |
| `latest-local` | Latest stable β full |
### Hotfix
```bash
git checkout vX.Y.Z # from the release tag
git checkout -b hotfix/X.Y.Z+1
# fix, commit, PR to main
git tag vX.Y.Z+1 # tag on main after merge
```
### Changelog
We follow [Keep a Changelog](https://keepachangelog.com/). Every PR should add a line under `[Unreleased]` in `CHANGELOG.md`. The release branch moves `[Unreleased]` to the versioned section.
## Pull Request Guidelines
- Keep PRs focused β one feature or fix per PR
- Add tests for new functionality
- Update documentation if behavior changes
- Follow existing code style and conventions
## Reporting Issues
- Use GitHub Issues to report bugs or request features
- Include steps to reproduce for bugs
- Mention your OS, Python/Node version, and Docker version if relevant
## License
By contributing, you agree that your contributions will be licensed under the [MIT License](LICENSE).
|