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