File size: 5,111 Bytes
44657b5
a513e62
44657b5
 
 
258f9e2
44657b5
 
258f9e2
44657b5
 
258f9e2
44657b5
 
 
 
 
 
 
258f9e2
44657b5
 
 
 
 
 
258f9e2
44657b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a513e62
44657b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a513e62
44657b5
 
 
 
 
 
a513e62
44657b5
 
 
 
 
258f9e2
44657b5
 
 
 
 
 
 
 
 
a513e62
44657b5
 
a513e62
44657b5
 
 
a513e62
44657b5
 
 
 
a513e62
44657b5
 
 
a513e62
44657b5
a513e62
44657b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a513e62
44657b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76be2fc
44657b5
 
 
 
 
 
 
 
 
a513e62
44657b5
 
 
76be2fc
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
## Contributing In General

Our project welcomes external contributions. If you have an itch, please feel
free to scratch it.

To contribute code or documentation, please submit a [pull request](https://github.com/docling-project/docling-serve/pulls).

A good way to familiarize yourself with the codebase and contribution process is
to look for and tackle low-hanging fruit in the [issue tracker](https://github.com/docling-project/docling-serve/issues).
Before embarking on a more ambitious contribution, please quickly [get in touch](#communication) with us.

For general questions or support requests, please refer to the [discussion section](https://github.com/docling-project/docling-serve/discussions).

**Note: We appreciate your effort, and want to avoid a situation where a contribution
requires extensive rework (by you or by us), sits in backlog for a long time, or
cannot be accepted at all!**

### Proposing new features

If you would like to implement a new feature, please [raise an issue](https://github.com/docling-project/docling-serve/issues)
before sending a pull request so the feature can be discussed. This is to avoid
you wasting your valuable time working on a feature that the project developers
are not interested in accepting into the code base.

### Fixing bugs

If you would like to fix a bug, please [raise an issue](https://github.com/docling-project/docling-serve/issues) before sending a
pull request so it can be tracked.

### Merge approval

The project maintainers use LGTM (Looks Good To Me) in comments on the code
review to indicate acceptance. A change requires LGTMs from two of the
maintainers of each component affected.

For a list of the maintainers, see the [MAINTAINERS.md](MAINTAINERS.md) page.

## Legal

Each source file must include a license header for the MIT
Software. Using the SPDX format is the simplest approach.
e.g.

```text
/*
Copyright IBM Inc. All rights reserved.

SPDX-License-Identifier: MIT
*/
```

We have tried to make it as easy as possible to make contributions. This
applies to how we handle the legal aspects of contribution. We use the
same approach - the [Developer's Certificate of Origin 1.1 (DCO)](https://github.com/hyperledger/fabric/blob/master/docs/source/DCO1.1.txt) - that the Linux® Kernel [community](https://elinux.org/Developer_Certificate_Of_Origin)
uses to manage code contributions.

We simply ask that when submitting a patch for review, the developer
must include a sign-off statement in the commit message.

Here is an example Signed-off-by line, which indicates that the
submitter accepts the DCO:

```text
Signed-off-by: John Doe <[email protected]>
```

You can include this automatically when you commit a change to your
local git repository using the following command:

```text
git commit -s
```

## Communication

Please feel free to connect with us using the [discussion section](https://github.com/docling-project/docling-serve/discussions).

## Developing

### Usage of Poetry

We use Poetry to manage dependencies.

#### Install

To install, see the documentation here: <https://python-poetry.org/docs/master/#installing-with-the-official-installer>

1. Install the Poetry globally in your machine

    ```bash
    curl -sSL https://install.python-poetry.org | python3 -
    ```

    The installation script will print the installation bin folder `POETRY_BIN` which you need in the next steps.

2. Make sure Poetry is in your `$PATH`
    - for `zsh`

        ```sh
        echo 'export PATH="POETRY_BIN:$PATH"' >> ~/.zshrc
        ```

    - for `bash`

        ```sh
        echo 'export PATH="POETRY_BIN:$PATH"' >> ~/.bashrc
        ```

3. The official guidelines linked above include useful details on the configuration of autocomplete for most shell environments, e.g. Bash and Zsh.

#### Create a Virtual Environment and Install Dependencies

To activate the Virtual Environment, run:

```bash
poetry shell
```

To spawn a shell with the Virtual Environment activated. If the Virtual Environment doesn't exist, Poetry will create one for you. Then, to install dependencies, run:

```bash
poetry install
```

#### (Advanced) Use a Specific Python Version

If for whatever reason you need to work in a specific (older) version of Python, run:

```bash
poetry env use $(which python3.10)
```

This creates a Virtual Environment with Python 3.10. For other versions, replace `$(which python3.10)` by the path to the interpreter (e.g., `/usr/bin/python3.8`) or use `$(which pythonX.Y)`.

#### Add a new dependency

```bash
poetry add NAME
```

## Coding style guidelines

We use the following tools to enforce code style:

- ruff, to sort imports and format code

We run a series of checks on the code base on every commit, using `pre-commit`. To install the hooks, run:

```bash
pre-commit install
```

To run the checks on-demand, run:

```shell
pre-commit run --all-files
```

Note: Formatting checks like `ruff` will "fail" if they modify files. This is because `pre-commit` doesn't like to see files modified by their Hooks. In these cases, `git add` the modified files and `git commit` again.