1{ lib
2, buildPythonPackage
3, pythonOlder
4, fetchPypi
5, setuptools
6, click
7, requests
8, packaging
9, dparse
10, ruamel-yaml
11, pytestCheckHook
12}:
13
14buildPythonPackage rec {
15 pname = "safety";
16 version = "2.3.1";
17
18 disabled = pythonOlder "3.6";
19
20 format = "pyproject";
21
22 src = fetchPypi {
23 inherit pname version;
24 hash = "sha256-bm/LfU6DIQmM8on1m2UFHK/TRn8InG5XyfiUrjLCO3E=";
25 };
26
27 postPatch = ''
28 substituteInPlace safety/safety.py \
29 --replace "telemetry=True" "telemetry=False"
30 substituteInPlace safety/util.py \
31 --replace "telemetry=True" "telemetry=False"
32 substituteInPlace safety/cli.py \
33 --replace "telemetry', default=True" "telemetry', default=False"
34 '';
35
36 nativeBuildInputs = [
37 setuptools
38 ];
39
40 propagatedBuildInputs = [
41 setuptools
42 click
43 requests
44 packaging
45 dparse
46 ruamel-yaml
47 ];
48
49 checkInputs = [
50 pytestCheckHook
51 ];
52
53 # Disable tests depending on online services
54 disabledTests = [
55 "test_announcements_if_is_not_tty"
56 "test_check_live"
57 "test_check_live_cached"
58 "test_check_vulnerabilities"
59 "test_license"
60 "test_chained_review"
61 ];
62
63 preCheck = ''
64 export HOME=$(mktemp -d)
65 '';
66
67 meta = with lib; {
68 description = "Checks installed dependencies for known vulnerabilities";
69 homepage = "https://github.com/pyupio/safety";
70 changelog = "https://github.com/pyupio/safety/blob/${version}/CHANGELOG.md";
71 license = licenses.mit;
72 maintainers = with maintainers; [ thomasdesr dotlambda ];
73 };
74}