1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 hatchling,
7 setuptools,
8 click,
9 requests,
10 packaging,
11 dparse,
12 ruamel-yaml,
13 jinja2,
14 marshmallow,
15 nltk,
16 authlib,
17 typer,
18 pydantic,
19 safety-schemas,
20 typing-extensions,
21 filelock,
22 psutil,
23 httpx,
24 tenacity,
25 tomlkit,
26 git,
27 pytestCheckHook,
28 tomli,
29 writableTmpDirAsHomeHook,
30}:
31
32buildPythonPackage rec {
33 pname = "safety";
34 version = "3.6.2";
35 pyproject = true;
36
37 src = fetchFromGitHub {
38 owner = "pyupio";
39 repo = "safety";
40 tag = version;
41 hash = "sha256-oGz2ZHGYaHi4RusNbZ5iqxuz2JBbchP5ip+uHHV10U0=";
42 };
43
44 patches = [
45 ./disable-telemetry.patch
46 ];
47
48 build-system = [ hatchling ];
49
50 pythonRelaxDeps = [
51 "filelock"
52 "pydantic"
53 "psutil"
54 ];
55
56 dependencies = [
57 setuptools
58 click
59 requests
60 packaging
61 dparse
62 ruamel-yaml
63 jinja2
64 marshmallow
65 nltk
66 authlib
67 typer
68 pydantic
69 safety-schemas
70 typing-extensions
71 filelock
72 psutil
73 httpx
74 tenacity
75 tomlkit
76 ];
77
78 nativeCheckInputs = [
79 git
80 pytestCheckHook
81 tomli
82 writableTmpDirAsHomeHook
83 ];
84
85 disabledTests = [
86 # Disable tests depending on online services
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_init_project"
92 "test_validate_with_basic_policy_file"
93 ];
94
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" ];
97
98 meta = {
99 description = "Checks installed dependencies for known vulnerabilities";
100 mainProgram = "safety";
101 homepage = "https://github.com/pyupio/safety";
102 changelog = "https://github.com/pyupio/safety/blob/${src.tag}/CHANGELOG.md";
103 license = lib.licenses.mit;
104 maintainers = with lib.maintainers; [
105 thomasdesr
106 dotlambda
107 ];
108 };
109}