1{ lib 2, buildPythonPackage 3, python 4, pythonAtLeast 5, fetchFromGitHub 6, fetchpatch 7, django 8, pygments 9, simplejson 10, python-dateutil 11, requests 12, setuptools-scm 13, sqlparse 14, jinja2 15, autopep8 16, pytz 17, pillow 18, mock 19, gprof2dot 20, freezegun 21, contextlib2 22, networkx 23, pydot 24, factory_boy 25}: 26 27buildPythonPackage rec { 28 pname = "django-silk"; 29 version = "4.1.0"; 30 31 # pypi tarball doesn't include test project 32 src = fetchFromGitHub { 33 owner = "jazzband"; 34 repo = "django-silk"; 35 rev = version; 36 sha256 = "1km3hmx1sir0c5gqr2p1h2938slhxp2hzf10cb80q98mas8spjkn"; 37 }; 38 39 patches = lib.optional (pythonAtLeast "3.9") (fetchpatch { 40 # should be able to remove after 4.1.1 41 name = "python-3.9-support.patch"; 42 url = "https://github.com/jazzband/django-silk/commit/134089e4cad7bd3b76fb0f70c423082cb7d2b34a.patch"; 43 sha256 = "09c1xd9y33h3ibiv5w9af9d79c909rgc1g5sxpd4y232h5id3c8r"; 44 }); 45 46 # "test_time_taken" tests aren't suitable for reproducible execution, but django's 47 # test runner doesn't have an easy way to ignore tests - so instead prevent it from picking 48 # them up as tests 49 postPatch = '' 50 substituteInPlace project/tests/test_silky_profiler.py \ 51 --replace "def test_time_taken" "def _test_time_taken" 52 substituteInPlace setup.py \ 53 --replace 'use_scm_version=True' 'version="${version}"' 54 ''; 55 56 nativeBuildInputs = [ setuptools-scm ]; 57 buildInputs = [ mock ]; 58 propagatedBuildInputs = [ 59 django pygments simplejson python-dateutil requests 60 sqlparse jinja2 autopep8 pytz pillow gprof2dot 61 ]; 62 63 checkInputs = [ freezegun contextlib2 networkx pydot factory_boy ]; 64 checkPhase = '' 65 cd project 66 DB=sqlite3 DB_NAME=db.sqlite3 ${python.interpreter} manage.py test 67 ''; 68 69 meta = with lib; { 70 description = "Silky smooth profiling for the Django Framework"; 71 homepage = "https://github.com/jazzband/django-silk"; 72 license = licenses.mit; 73 maintainers = with maintainers; [ ris ]; 74 }; 75 76}