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