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