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