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