Developing
This page contains guidance for developing Django Modelsearch itself.
Developer installation
From the root of the cloned repository, run:
pip install -e ".[test,docs,dev]"
Testing
To run the test suite, run:
python ./runtests.py --backend BACKEND
where BACKEND is one of: db, elasticsearch7, elasticsearch8, elasticsearch9, opensearch2, opensearch3.
Linting
This project uses Ruff for code linting and formatting. To run the linter:
make lint
To install the pre-commit hook so that linting is applied on every commit, run:
pre-commit install
Documentation
To build the documentation, run the following from docs:
make html
Test coverage reporting
A configuration script for a Vagrant virtual machine is provided to assist in setting up all of the supported backends for testing. This also allows generating a code coverage report. To start the VM, run:
vagrant up
vagrant ssh
Within the VM, a coverage report can be generated by running:
cd /vagrant
make vagrantcoverage
The vagrantcoverage task is tailored to the specific server configurations as installed in the Vagrant VM, and is unlikely to work outside of it.