open-research / sumatra

http://neuralensemble.org/sumatra/
BSD 2-Clause "Simplified" License
127 stars 48 forks source link

Enh: Make django optional #401

Open alcrene opened 7 months ago

alcrene commented 7 months ago

The outdated Django causes a bunch of headaches when trying to install Sumatra into a project, since it creates dependency conflicts with any other library that uses Django. This happens for example when I install bokeh in the same project. At present my solution is to not use the Django record store at all, and just rely on the ShelveRecordStore. It’s not as performant, doesn’t support concurrency, but comparatively it’s still more reliable. However, Sumatra still lists Django as a hard dependency, and some of the core modules can’t be imported without it, even though with a different record store the Django dependency is never actually used.

This patch removes Django from the required dependencies, and creates a new extra dependency so it can be installed with pip install sumatra[django]. It also adds an import guard in sumatra/projects.py so that module can be imported without errors when Django is not installed.