1{ lib
2, appdirs
3, buildPythonPackage
4, cvss
5, fetchFromGitHub
6, httpx
7, msgpack
8, orjson
9, packageurl-python
10, pytestCheckHook
11, pythonOlder
12, pythonRelaxDepsHook
13, semver
14, setuptools
15, tabulate
16}:
17
18buildPythonPackage rec {
19 pname = "appthreat-vulnerability-db";
20 version = "5.5.3";
21 pyproject = true;
22
23 disabled = pythonOlder "3.7";
24
25 src = fetchFromGitHub {
26 owner = "AppThreat";
27 repo = "vulnerability-db";
28 rev = "refs/tags/v${version}";
29 hash = "sha256-6kfkHLW5PftzrhKjywc670HpKCrrU0POEiJ3u2doBTk=";
30 };
31
32 postPatch = ''
33 substituteInPlace pytest.ini \
34 --replace " --cov-append --cov-report term --cov vdb" ""
35 '';
36
37 pythonRelaxDeps = [
38 "semver"
39 ];
40
41 nativeBuildInputs = [
42 pythonRelaxDepsHook
43 setuptools
44 ];
45
46 propagatedBuildInputs = [
47 appdirs
48 cvss
49 httpx
50 msgpack
51 orjson
52 packageurl-python
53 semver
54 tabulate
55 ] ++ httpx.optional-dependencies.http2;
56
57 nativeCheckInputs = [
58 pytestCheckHook
59 ];
60
61 preCheck = ''
62 export HOME=$(mktemp -d);
63 '';
64
65 disabledTests = [
66 # Tests require network access
67 "test_bulk_search"
68 "test_download_recent"
69 ];
70
71 pythonImportsCheck = [
72 "vdb"
73 ];
74
75 meta = with lib; {
76 description = "Vulnerability database and package search for sources such as OSV, NVD, GitHub and npm";
77 homepage = "https://github.com/appthreat/vulnerability-db";
78 changelog = "https://github.com/AppThreat/vulnerability-db/releases/tag/v${version}";
79 license = with licenses; [ mit ];
80 maintainers = with maintainers; [ fab ];
81 };
82}