Contributions to Document Merge Service are very welcome! Best have a look at the open issues and open a GitHub pull request. See instructions below how to setup development environment. Before writing any code, best discuss your proposed change in a GitHub issue to see if the proposed change makes sense for the project.
To work on Document Merge Service you first need to clone
git clone https://github.com/adfinis/document-merge-service.git
cd document-merge-service
Once it is cloned you can easily open a shell in the docker container to open an development environment.
# needed for permission handling
# only needs to be run once
echo UID=$UID > .env
# open shell
docker-compose run --rm document-merge-service bash
Once you have shelled in docker container as described above you can use common python tooling for formatting, linting, testing etc.
poetry shell
# linting
ruff check --diff .
# format code
ruff format .
# running tests
pytest
# create migrations
./manage.py makemigrations
# install debugger or other temporary dependencies
pip install --user pdbpp
Writing of code can still happen outside the docker container of course.
In case you're adding new requirements you simply need to build the docker container again for those to be installed and re-open shell.
docker-compose build --pull
Pre commit hooks is an additional option instead of executing checks in your editor of choice.
First create a virtualenv with the tool of your choice before running below commands:
poetry shell
pip install pre-commit
pre-commit install --hook=pre-commit
pre-commit install --hook=commit-msg
This will activate commit hooks to validate your code as well as your commit messages.
If you want to have your commit message automatically linted, execute below commands:
npm install @commitlint/{config-conventional,cli}
ln -s "$(pwd)/commit-msg" .git/hooks/commit-msg