2024-07-15 09:42:42 +02:00
## Contributing In General
Our project welcomes external contributions. If you have an itch, please feel
free to scratch it.
2025-03-19 09:05:57 +01:00
For more details on the contributing guidelines head to the Docling Project [community repository ](https://github.com/docling-project/community ).
2024-07-15 09:42:42 +02:00
## Developing
2025-06-03 15:18:54 +02:00
### Usage of uv
2024-07-15 09:42:42 +02:00
2025-06-03 15:18:54 +02:00
We use [uv ](https://docs.astral.sh/uv/ ) as package and project manager.
2024-07-15 09:42:42 +02:00
2024-10-22 10:31:48 +05:30
#### Installation
2024-07-15 09:42:42 +02:00
2025-06-03 15:18:54 +02:00
To install `uv` , check the documentation on [Installing uv ](https://docs.astral.sh/uv/getting-started/installation/ ).
2024-07-15 09:42:42 +02:00
2025-06-03 15:18:54 +02:00
#### Create an environment and sync it
2024-07-15 09:42:42 +02:00
2025-06-03 15:18:54 +02:00
You can use the `uv sync` to create a project virtual environment (if it does not already exist) and sync
the project's dependencies with the environment.
2024-07-15 09:42:42 +02:00
```bash
2025-06-03 15:18:54 +02:00
uv sync
2024-07-15 09:42:42 +02:00
```
2025-06-03 15:18:54 +02:00
#### Use a specific Python version (optional)
2024-07-15 09:42:42 +02:00
2025-06-03 15:18:54 +02:00
If you need to work with a specific version of Python, you can create a new virtual environment for that version
and run the sync comm and:
2024-07-15 09:42:42 +02:00
```bash
2025-06-03 15:18:54 +02:00
uv venv --python 3.12
uv sync
2024-07-15 09:42:42 +02:00
```
2025-06-03 15:18:54 +02:00
More detailed options are described on the [Using Python environments ](https://docs.astral.sh/uv/pip/environments/ ) documentation.
#### Add a new dependency
2024-07-15 09:42:42 +02:00
2025-06-03 15:18:54 +02:00
Simply use the `uv add` command. The `pyproject.toml` and `uv.lock` files will be updated.
2024-07-15 09:42:42 +02:00
```bash
2025-06-03 15:18:54 +02:00
uv add [OPTIONS] < PACKAGES | --requirements < REQUIREMENTS > >
2024-07-15 09:42:42 +02:00
```
2024-10-22 10:31:48 +05:30
## Coding Style Guidelines
2024-07-15 09:42:42 +02:00
We use the following tools to enforce code style:
2025-06-03 15:18:54 +02:00
- [Ruff ](https://docs.astral.sh/ruff/ ), as linter and code formatter
- [MyPy ](https://mypy.readthedocs.io ), as static type checker
2024-07-15 09:42:42 +02:00
2025-06-03 15:18:54 +02:00
A set of styling checks, as well as regression tests, are defined and managed through the [pre-commit ](https://pre-commit.com/ ) framework.
To ensure that those scripts run automatically before a commit is finalized, install `pre-commit` on your local repository:
2024-07-15 09:42:42 +02:00
```bash
pre-commit install
```
To run the checks on-demand, run:
2024-10-22 10:31:48 +05:30
```bash
2024-07-15 09:42:42 +02:00
pre-commit run --all-files
```
2025-06-03 15:18:54 +02:00
Note: Checks like `Ruff` will "fail" if they modify files. This is because `pre-commit` doesn't like to see files modified by its hooks. In these cases, `git add` the modified files and `git commit` again.
2024-07-15 09:42:42 +02:00
2025-04-14 12:31:48 +02:00
## Tests
When submitting a new feature or fix, please consider adding a short test for it.
### Reference test documents
When a change improves the conversion results, multiple reference documents must be regenerated and reviewed.
The reference data can be regenerated with
```sh
2025-06-03 15:18:54 +02:00
DOCLING_GEN_TEST_DATA=1 uv run pytest
2025-04-14 12:31:48 +02:00
```
All PRs modifying the reference test data require a double review to guarantee we don't miss edge cases.
2024-07-15 09:42:42 +02:00
## Documentation
We use [MkDocs ](https://www.mkdocs.org/ ) to write documentation.
2024-10-22 10:31:48 +05:30
To run the documentation server, run:
2024-07-15 09:42:42 +02:00
```bash
mkdocs serve
```
2024-10-22 10:31:48 +05:30
The server will be available at [http://localhost:8000 ](http://localhost:8000 ).
2024-07-15 09:42:42 +02:00
2024-10-22 10:31:48 +05:30
### Pushing Documentation to GitHub Pages
2024-07-15 09:42:42 +02:00
Run the following:
```bash
mkdocs gh-deploy
```