1{ lib
2, buildPythonPackage
3, pythonOlder
4, fetchFromGitHub
5, prometheus-client
6, pytest-django
7, pytestCheckHook
8}:
9
10buildPythonPackage rec {
11 pname = "django-prometheus";
12 version = "2.3.1";
13 format = "setuptools";
14 disabled = pythonOlder "3.6";
15
16 src = fetchFromGitHub {
17 owner = "korfuri";
18 repo = pname;
19 rev = "v${version}";
20 hash = "sha256-JiLH+4mmNdb9BN81J5YFiMPna/3gaKUK6ARjmCa3fE8=";
21 };
22
23 patches = [
24 ./drop-untestable-database-backends.patch
25 ];
26
27 postPatch = ''
28 substituteInPlace setup.py \
29 --replace '"pytest-runner"' ""
30 '';
31
32 propagatedBuildInputs = [
33 prometheus-client
34 ];
35
36 pythonImportsCheck = [
37 "django_prometheus"
38 ];
39
40 nativeCheckInputs = [
41 pytest-django
42 pytestCheckHook
43 ];
44
45 meta = with lib; {
46 changelog = "https://github.com/korfuri/django-prometheus/releases/tag/v${version}";
47 description = "Django middlewares to monitor your application with Prometheus.io";
48 homepage = "https://github.com/korfuri/django-prometheus";
49 license = licenses.asl20;
50 maintainers = with maintainers; [ hexa ];
51 };
52}