1{
2 lib,
3 beautifulsoup4,
4 boto3,
5 buildPythonPackage,
6 cryptography,
7 dnspython,
8 fetchFromGitHub,
9 importlib-metadata,
10 localzone,
11 oci,
12 poetry-core,
13 pyotp,
14 pytest-vcr,
15 pytestCheckHook,
16 pythonOlder,
17 pyyaml,
18 requests,
19 softlayer,
20 tldextract,
21 zeep,
22}:
23
24buildPythonPackage rec {
25 pname = "dns_lexicon";
26 version = "3.16.1";
27 pyproject = true;
28
29 disabled = pythonOlder "3.8";
30
31 src = fetchFromGitHub {
32 owner = "Analogj";
33 repo = "lexicon";
34 tag = "v${version}";
35 hash = "sha256-79/zz0TOCpx26TEo6gi9JDBQeVW2azWnxAjWr/FGRLA=";
36 };
37
38 # https://beautiful-soup-4.readthedocs.io/en/latest/#method-names
39 postPatch = ''
40 sed 's/\<findAll\>/find_all/g' \
41 -i src/lexicon/_private/providers/*.py
42 sed 's/\<renderContents\>/encode_contents/g' \
43 -i src/lexicon/_private/providers/*.py
44 '';
45
46 nativeBuildInputs = [ poetry-core ];
47
48 propagatedBuildInputs = [
49 beautifulsoup4
50 cryptography
51 pyotp
52 pyyaml
53 requests
54 tldextract
55 ]
56 ++ lib.optionals (pythonOlder "3.10") [ importlib-metadata ];
57
58 optional-dependencies = {
59 route53 = [ boto3 ];
60 localzone = [ localzone ];
61 softlayer = [ softlayer ];
62 ddns = [ dnspython ];
63 duckdns = [ dnspython ];
64 oci = [ oci ];
65 full = [
66 boto3
67 dnspython
68 localzone
69 oci
70 softlayer
71 zeep
72 ];
73 };
74
75 nativeCheckInputs = [
76 pytestCheckHook
77 pytest-vcr
78 ]
79 ++ optional-dependencies.full;
80
81 enabledTestPaths = [ "tests/" ];
82
83 disabledTestPaths = [
84 # Needs network access
85 "tests/providers/test_auto.py"
86 # Needs network access (and an API token)
87 "tests/providers/test_namecheap.py"
88 ];
89
90 disabledTests = [
91 # Tests want to download Public Suffix List
92 "test_client_legacy_init"
93 "test_client_basic_init"
94 "test_client_init"
95 "test_client_parse_env"
96 "test_missing"
97 "action_is_correctly"
98 ];
99
100 pythonImportsCheck = [ "lexicon" ];
101
102 meta = with lib; {
103 description = "Manipulate DNS records on various DNS providers in a standardized way";
104 mainProgram = "lexicon";
105 homepage = "https://github.com/AnalogJ/lexicon";
106 changelog = "https://github.com/AnalogJ/lexicon/blob/v${version}/CHANGELOG.md";
107 license = with licenses; [ mit ];
108 maintainers = with maintainers; [ aviallon ];
109 };
110}