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