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