1{
2 lib,
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.15.0";
18 pyproject = true;
19
20 disabled = pythonOlder "3.8";
21
22 src = fetchFromGitHub {
23 owner = "networktocode";
24 repo = "netutils";
25 tag = "v${version}";
26 hash = "sha256-BdxmzxnuccAb8BiE48KSYLXJzAaz7eSYMJA2bgSbWj4=";
27 };
28
29 build-system = [ poetry-core ];
30
31 dependencies = [ jsonschema ];
32
33 optional-dependencies.optionals = [
34 jsonschema
35 napalm
36 ];
37
38 nativeCheckInputs = [
39 jinja2
40 pytestCheckHook
41 pyyaml
42 toml
43 ];
44
45 pythonImportsCheck = [ "netutils" ];
46
47 disabledTests = [
48 # Tests require network access
49 "test_is_fqdn_resolvable"
50 "test_fqdn_to_ip"
51 "test_tcp_ping"
52 # Skip Sphinx test
53 "test_sphinx_build"
54 # OSError: [Errno 22] Invalid argument
55 "test_compare_type5"
56 "test_encrypt_type5"
57 "test_compare_cisco_type5"
58 "test_get_napalm_getters_napalm_installed_default"
59 "test_encrypt_cisco_type5"
60 ];
61
62 meta = with lib; {
63 description = "Library that is a collection of objects for common network automation tasks";
64 homepage = "https://github.com/networktocode/netutils";
65 changelog = "https://github.com/networktocode/netutils/releases/tag/${src.tag}";
66 license = licenses.asl20;
67 maintainers = with maintainers; [ fab ];
68 };
69}