biome: 1.9.2 -> 1.9.3 (#349335)
[NixPkgs.git] / pkgs / development / python-modules / safety / default.nix
blob4c9a40d06dc89bcbe1f7585a562ce15c523e2dc4
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.8";
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-H8YF9rax6dM6KCLGiRk7bIHhYVw0RNkH/B9VTZRHe9c=";
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     "dparse"
58     "filelock"
59   ];
61   dependencies = [
62     setuptools
63     click
64     urllib3
65     requests
66     packaging
67     dparse
68     ruamel-yaml
69     jinja2
70     marshmallow
71     authlib
72     rich
73     typer
74     pydantic
75     safety-schemas
76     typing-extensions
77     filelock
78     psutil
79   ];
81   nativeCheckInputs = [
82     git
83     pytestCheckHook
84   ];
86   # Disable tests depending on online services
87   disabledTests = [
88     "test_announcements_if_is_not_tty"
89     "test_check_live"
90     "test_debug_flag"
91     "test_get_packages_licenses_without_api_key"
92     "test_validate_with_basic_policy_file"
93   ];
95   # ImportError: cannot import name 'get_command_for' from partially initialized module 'safety.cli_util' (most likely due to a circular import)
96   disabledTestPaths = [ "tests/alerts/test_utils.py" ];
98   preCheck = ''
99     export HOME=$(mktemp -d)
100   '';
102   meta = with lib; {
103     description = "Checks installed dependencies for known vulnerabilities";
104     mainProgram = "safety";
105     homepage = "https://github.com/pyupio/safety";
106     changelog = "https://github.com/pyupio/safety/blob/${version}/CHANGELOG.md";
107     license = licenses.mit;
108     maintainers = with maintainers; [
109       thomasdesr
110       dotlambda
111     ];
112   };