nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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.7.0";
35 pyproject = true;
36
37 src = fetchFromGitHub {
38 owner = "pyupio";
39 repo = "safety";
40 tag = version;
41 hash = "sha256-BPLK/V7YQBCGopfRFAWdra8ve8Ww5KN1+oZKyoEPiFc=";
42 };
43
44 patches = [
45 ./disable-telemetry.patch
46 ];
47
48 build-system = [ hatchling ];
49
50 pythonRelaxDeps = [
51 "filelock"
52 "pydantic"
53 "psutil"
54 "safety-schemas"
55 ];
56
57 dependencies = [
58 setuptools
59 click
60 requests
61 packaging
62 dparse
63 ruamel-yaml
64 jinja2
65 marshmallow
66 nltk
67 authlib
68 typer
69 pydantic
70 safety-schemas
71 typing-extensions
72 filelock
73 psutil
74 httpx
75 tenacity
76 tomlkit
77 ];
78
79 nativeCheckInputs = [
80 git
81 pytestCheckHook
82 tomli
83 writableTmpDirAsHomeHook
84 ];
85
86 disabledTests = [
87 # Disable tests depending on online services
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_init_project"
93 "test_validate_with_basic_policy_file"
94 ];
95
96 # ImportError: cannot import name 'get_command_for' from partially initialized module 'safety.cli_util' (most likely due to a circular import)
97 disabledTestPaths = [ "tests/alerts/test_utils.py" ];
98
99 meta = {
100 description = "Checks installed dependencies for known vulnerabilities";
101 mainProgram = "safety";
102 homepage = "https://github.com/pyupio/safety";
103 changelog = "https://github.com/pyupio/safety/blob/${src.tag}/CHANGELOG.md";
104 license = lib.licenses.mit;
105 maintainers = with lib.maintainers; [
106 thomasdesr
107 dotlambda
108 ];
109 };
110}