1{ lib
2, backoff
3, buildPythonPackage
4, fetchFromGitHub
5, importlib-metadata
6, parameterized
7, poetry-core
8, pytest-mock
9, pytestCheckHook
10, pythonOlder
11, pythonRelaxDepsHook
12, requests
13, requests-mock
14, responses
15, rich
16}:
17
18buildPythonPackage rec {
19 pname = "censys";
20 version = "2.1.9";
21 format = "pyproject";
22
23 disabled = pythonOlder "3.7";
24
25 src = fetchFromGitHub {
26 owner = "censys";
27 repo = "censys-python";
28 rev = "refs/tags/v${version}";
29 hash = "sha256-BB/pLpPK2qh5902bZp9QM3Wiu/l48pzq7HcjaAtM4D0=";
30 };
31
32 nativeBuildInputs = [
33 poetry-core
34 pythonRelaxDepsHook
35 ];
36
37 propagatedBuildInputs = [
38 backoff
39 requests
40 rich
41 importlib-metadata
42 ];
43
44 checkInputs = [
45 parameterized
46 pytest-mock
47 pytestCheckHook
48 requests-mock
49 responses
50 ];
51
52 pythonRelaxDeps = [
53 "backoff"
54 "requests"
55 "rich"
56 ];
57
58 postPatch = ''
59 substituteInPlace pytest.ini \
60 --replace "--cov" ""
61 '';
62
63 # The tests want to write a configuration file
64 preCheck = ''
65 export HOME=$(mktemp -d)
66 mkdir -p $HOME
67 '';
68
69 pythonImportsCheck = [
70 "censys"
71 ];
72
73 meta = with lib; {
74 description = "Python API wrapper for the Censys Search Engine (censys.io)";
75 homepage = "https://github.com/censys/censys-python";
76 license = with licenses; [ asl20 ];
77 maintainers = with maintainers; [ fab ];
78 };
79}