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