1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, jinja2
6, jsonschema
7, napalm
8, poetry-core
9, pytestCheckHook
10, pythonOlder
11, pyyaml
12, toml
13}:
14
15buildPythonPackage rec {
16 pname = "netutils";
17 version = "1.6.0";
18 format = "pyproject";
19
20 disabled = pythonOlder "3.8";
21
22 src = fetchFromGitHub {
23 owner = "networktocode";
24 repo = pname;
25 rev = "refs/tags/v${version}";
26 hash = "sha256-ocajE7E4xIatEmv58/9gEpWF2plJdiZXjk6ajD2vTzw=";
27 };
28
29 nativeBuildInputs = [
30 poetry-core
31 ];
32
33 propagatedBuildInputs = [
34 jsonschema
35 napalm
36 ];
37
38 passthru.optional-dependencies.optionals = [
39 jsonschema
40 napalm
41 ];
42
43 nativeCheckInputs = [
44 jinja2
45 pytestCheckHook
46 pyyaml
47 toml
48 ];
49
50 pythonImportsCheck = [
51 "netutils"
52 ];
53
54 disabledTests = [
55 # Tests require network access
56 "test_is_fqdn_resolvable"
57 "test_fqdn_to_ip"
58 "test_tcp_ping"
59 # Skip Sphinx test
60 "test_sphinx_build"
61 # OSError: [Errno 22] Invalid argument
62 "test_compare_type5"
63 "test_encrypt_type5"
64 "test_compare_cisco_type5"
65 "test_get_napalm_getters_napalm_installed_default"
66 "test_encrypt_cisco_type5"
67 ];
68
69 meta = with lib; {
70 description = "Library that is a collection of objects for common network automation tasks";
71 homepage = "https://github.com/networktocode/netutils";
72 changelog = "https://github.com/networktocode/netutils/releases/tag/v${version}";
73 license = licenses.asl20;
74 maintainers = with maintainers; [ fab ];
75 broken = stdenv.isDarwin;
76 };
77}