otadump: init at 0.1.2 (#329129)
[NixPkgs.git] / pkgs / development / python-modules / safety / default.nix
blob84e7ea12308424e6e81bd6b2811006878cfe74cd
2   lib,
3   buildPythonPackage,
4   pythonOlder,
5   fetchFromGitHub,
6   setuptools,
7   click,
8   urllib3,
9   requests,
10   packaging,
11   dparse,
12   ruamel-yaml,
13   jinja2,
14   marshmallow,
15   authlib,
16   rich,
17   typer,
18   pydantic,
19   safety-schemas,
20   typing-extensions,
21   filelock,
22   psutil,
23   git,
24   pytestCheckHook,
27 buildPythonPackage rec {
28   pname = "safety";
29   version = "3.2.11";
31   disabled = pythonOlder "3.7";
33   pyproject = true;
35   src = fetchFromGitHub {
36     owner = "pyupio";
37     repo = "safety";
38     rev = "refs/tags/${version}";
39     hash = "sha256-ekJ0o+KWS8Fih1M/scboGEjETX0/2Uh6h/zne4h+3wI=";
40   };
42   postPatch = ''
43     substituteInPlace safety/safety.py \
44       --replace-fail "telemetry: bool = True" "telemetry: bool = False"
45     substituteInPlace safety/util.py \
46       --replace-fail "telemetry: bool = True" "telemetry: bool = False"
47     substituteInPlace safety/cli.py \
48       --replace-fail "disable-optional-telemetry', default=False" \
49                      "disable-optional-telemetry', default=True"
50     substituteInPlace safety/scan/finder/handlers.py \
51       --replace-fail "telemetry=True" "telemetry=False"
52   '';
54   build-system = [ setuptools ];
56   pythonRelaxDeps = [
57     "filelock"
58   ];
60   dependencies = [
61     setuptools
62     click
63     urllib3
64     requests
65     packaging
66     dparse
67     ruamel-yaml
68     jinja2
69     marshmallow
70     authlib
71     rich
72     typer
73     pydantic
74     safety-schemas
75     typing-extensions
76     filelock
77     psutil
78   ];
80   nativeCheckInputs = [
81     git
82     pytestCheckHook
83   ];
85   # Disable tests depending on online services
86   disabledTests = [
87     "test_announcements_if_is_not_tty"
88     "test_check_live"
89     "test_debug_flag"
90     "test_get_packages_licenses_without_api_key"
91     "test_validate_with_basic_policy_file"
92   ];
94   # ImportError: cannot import name 'get_command_for' from partially initialized module 'safety.cli_util' (most likely due to a circular import)
95   disabledTestPaths = [ "tests/alerts/test_utils.py" ];
97   preCheck = ''
98     export HOME=$(mktemp -d)
99   '';
101   meta = with lib; {
102     description = "Checks installed dependencies for known vulnerabilities";
103     mainProgram = "safety";
104     homepage = "https://github.com/pyupio/safety";
105     changelog = "https://github.com/pyupio/safety/blob/${version}/CHANGELOG.md";
106     license = licenses.mit;
107     maintainers = with maintainers; [
108       thomasdesr
109       dotlambda
110     ];
111   };