1{ 2 lib, 3 autopep8, 4 buildPythonPackage, 5 django, 6 factory-boy, 7 fetchFromGitHub, 8 fetchpatch, 9 freezegun, 10 gprof2dot, 11 jinja2, 12 mock, 13 networkx, 14 pillow, 15 pydot, 16 pygments, 17 python, 18 python-dateutil, 19 pythonOlder, 20 pytz, 21 requests, 22 setuptools-scm, 23 simplejson, 24 sqlparse, 25}: 26 27buildPythonPackage rec { 28 pname = "django-silk"; 29 version = "5.1.0"; 30 format = "setuptools"; 31 32 disabled = pythonOlder "3.7"; 33 34 src = fetchFromGitHub { 35 owner = "jazzband"; 36 repo = "django-silk"; 37 rev = "refs/tags/${version}"; 38 hash = "sha256-QqY1bRa0v4DZ2/gDbssyhJA9Kb+5jig4hZEBVKZiowY="; 39 }; 40 41 # "test_time_taken" tests aren't suitable for reproducible execution, but Django's 42 # test runner doesn't have an easy way to ignore tests - so instead prevent it from picking 43 # them up as tests 44 postPatch = '' 45 substituteInPlace project/tests/test_silky_profiler.py \ 46 --replace "def test_time_taken" "def _test_time_taken" 47 substituteInPlace setup.py \ 48 --replace 'use_scm_version=True' 'version="${version}"' 49 ''; 50 51 nativeBuildInputs = [ setuptools-scm ]; 52 53 buildInputs = [ mock ]; 54 55 propagatedBuildInputs = [ 56 autopep8 57 django 58 gprof2dot 59 jinja2 60 pillow 61 pygments 62 python-dateutil 63 pytz 64 requests 65 simplejson 66 sqlparse 67 ]; 68 69 nativeCheckInputs = [ 70 freezegun 71 networkx 72 pydot 73 factory-boy 74 ]; 75 76 pythonImportsCheck = [ "silk" ]; 77 78 checkPhase = '' 79 runHook preCheck 80 81 pushd project 82 DB_ENGINE=sqlite3 DB_NAME=':memory:' ${python.interpreter} manage.py test 83 popd # project 84 85 runHook postCheck 86 ''; 87 88 meta = with lib; { 89 description = "Silky smooth profiling for the Django Framework"; 90 homepage = "https://github.com/jazzband/django-silk"; 91 changelog = "https://github.com/jazzband/django-silk/blob/${version}/CHANGELOG.md"; 92 license = licenses.mit; 93 maintainers = with maintainers; [ ris ]; 94 }; 95}