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