Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 buildPythonPackage, 4 pythonOlder, 5 fetchPypi, 6 setuptools, 7 click, 8 urllib3, 9 requests, 10 packaging, 11 dparse, 12 ruamel-yaml, 13 jinja2, 14 marshmallow, 15 authlib, 16 jwt, 17 rich, 18 typer, 19 pydantic, 20 safety-schemas, 21 typing-extensions, 22 filelock, 23 pytestCheckHook, 24}: 25 26buildPythonPackage rec { 27 pname = "safety"; 28 version = "3.2.4"; 29 30 disabled = pythonOlder "3.7"; 31 32 pyproject = true; 33 34 src = fetchPypi { 35 inherit pname version; 36 hash = "sha256-usAgIBbXNqIRgFeWSg45g/og/yVj/RA8rD86we0/6hE="; 37 }; 38 39 postPatch = '' 40 substituteInPlace safety/safety.py \ 41 --replace-fail "telemetry=True" "telemetry=False" 42 substituteInPlace safety/util.py \ 43 --replace-fail "telemetry = True" "telemetry = False" 44 substituteInPlace safety/cli.py \ 45 --replace-fail "disable-optional-telemetry', default=False" \ 46 "disable-optional-telemetry', default=True" 47 substituteInPlace safety/scan/finder/handlers.py \ 48 --replace-fail "telemetry=True" "telemetry=False" 49 ''; 50 51 build-system = [ setuptools ]; 52 53 pythonRelaxDeps = [ 54 "dparse" 55 "filelock" 56 ]; 57 58 dependencies = [ 59 setuptools 60 click 61 urllib3 62 requests 63 packaging 64 dparse 65 ruamel-yaml 66 jinja2 67 marshmallow 68 authlib 69 jwt 70 rich 71 typer 72 pydantic 73 safety-schemas 74 typing-extensions 75 filelock 76 ]; 77 78 nativeCheckInputs = [ pytestCheckHook ]; 79 80 # Disable tests depending on online services 81 disabledTests = [ 82 "test_announcements_if_is_not_tty" 83 "test_check_live" 84 "test_check_live_cached" 85 "test_get_packages_licenses_without_api_key" 86 "test_validate_with_policy_file_using_invalid_keyword" 87 "test_validate_with_basic_policy_file" 88 ]; 89 90 # ImportError: cannot import name 'get_command_for' from partially initialized module 'safety.cli_util' (most likely due to a circular import) 91 disabledTestPaths = [ "tests/alerts/test_utils.py" ]; 92 93 preCheck = '' 94 export HOME=$(mktemp -d) 95 ''; 96 97 meta = with lib; { 98 description = "Checks installed dependencies for known vulnerabilities"; 99 mainProgram = "safety"; 100 homepage = "https://github.com/pyupio/safety"; 101 changelog = "https://github.com/pyupio/safety/blob/${version}/CHANGELOG.md"; 102 license = licenses.mit; 103 maintainers = with maintainers; [ 104 thomasdesr 105 dotlambda 106 ]; 107 }; 108}