Skip to content

Commit b76a372

Browse files
authored
Merge branch 'develop' into dependabot/pip/types-six-1.17.0.20250515
2 parents 318c251 + 5659743 commit b76a372

File tree

9 files changed

+10
-46
lines changed

9 files changed

+10
-46
lines changed

napalm/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import pkg_resources
1+
from importlib.metadata import version, PackageNotFoundError
22
import sys
33
import logging
44

@@ -23,8 +23,8 @@
2323
raise RuntimeError("NAPALM requires Python 3.7 or greater")
2424

2525
try:
26-
__version__ = pkg_resources.get_distribution("napalm").version
27-
except pkg_resources.DistributionNotFound:
26+
__version__ = version("napalm")
27+
except PackageNotFoundError:
2828
__version__ = "Not installed"
2929

3030
__all__ = ("get_network_driver", "SUPPORTED_DRIVERS")

napalm/base/clitools/cl_napalm.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
import logging
88
import argparse
99
import getpass
10-
import pkg_resources
10+
import pkgutil
11+
from importlib.metadata import version
1112
from functools import wraps
1213

1314

@@ -156,9 +157,9 @@ def check_installed_packages():
156157
logger.debug("Gathering napalm packages")
157158
napalm_packages = sorted(
158159
[
159-
"{}=={}".format(i.key, i.version)
160-
for i in pkg_resources.working_set
161-
if i.key.startswith("napalm")
160+
"{}=={}".format(i.name, version(i.name))
161+
for i in list(pkgutil.iter_modules())
162+
if i.name.startswith("napalm")
162163
]
163164
)
164165
for n in napalm_packages:

napalm/base/test/getters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def mock_wrapper(cls, test_case):
9090
attr.current_test = "" # Empty them to avoid side effects
9191
attr.current_test_case = "" # Empty them to avoid side effects
9292

93-
return result
93+
return None
9494

9595
@functools.wraps(func)
9696
def real_wrapper(cls, test_case):

napalm/iosxr/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,7 @@
1515

1616
"""napalm.iosxr package."""
1717

18-
# Import stdlib
19-
import pkg_resources
20-
2118
# Import local modules
2219
from napalm.iosxr.iosxr import IOSXRDriver # noqa
2320

2421
__all__ = ("IOSXRDriver",)
25-
26-
try:
27-
__version__ = pkg_resources.get_distribution("napalm-iosxr").version
28-
except pkg_resources.DistributionNotFound:
29-
__version__ = "Not installed"

napalm/iosxr_netconf/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,7 @@
1515

1616
"""napalm.iosxr_netconf package."""
1717

18-
# Import stdlib
19-
import pkg_resources
20-
2118
# Import local modules
2219
from napalm.iosxr_netconf.iosxr_netconf import IOSXRNETCONFDriver # noqa
2320

2421
__all__ = ("IOSXRNETCONFDriver",)
25-
26-
try:
27-
__version__ = pkg_resources.get_distribution("napalm-iosxr-netconf").version
28-
except pkg_resources.DistributionNotFound:
29-
__version__ = "Not installed"

napalm/nxos/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,8 @@
1515

1616
"""napalm.nxos package."""
1717

18-
# Import stdlib
19-
import pkg_resources
20-
2118
# Import local modules
2219
from napalm.nxos.nxos import NXOSDriver
2320
from napalm.nxos.nxos import NXOSDriverBase
2421

25-
try:
26-
__version__ = pkg_resources.get_distribution("napalm-nxos").version
27-
except pkg_resources.DistributionNotFound:
28-
__version__ = "Not installed"
29-
3022
__all__ = ("NXOSDriver", "NXOSDriverBase")

napalm/nxos_ssh/__init__.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,7 @@
1515

1616
"""napalm.nxos package."""
1717

18-
# Import stdlib
19-
import pkg_resources
20-
2118
# Import local modules
2219
from napalm.nxos_ssh.nxos_ssh import NXOSSSHDriver
2320

24-
25-
try:
26-
__version__ = pkg_resources.get_distribution("napalm-nxos-ssh").version
27-
except pkg_resources.DistributionNotFound:
28-
__version__ = "Not installed"
29-
3021
__all__ = ("NXOSSSHDriver",)

requirements.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ netaddr
88
pyYAML
99
pyeapi>=1.0.2
1010
netmiko>=4.4.0
11-
# Temp fix until PyEZ 2.7.4 is released (PY3.13 support)
12-
git+https://github.com/Juniper/py-junos-eznc.git@39bd1cfb007b6adea654baeaf78a26d1ad35f385
13-
scp
11+
junos-eznc>=2.7.4
1412
lxml>=4.3.0
1513
ncclient
1614
ttp

setup.cfg

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ python_files =
2727
test_*.py
2828
*_test.py
2929
tests.py
30-
json_report = report.json
31-
jsonapi = true
3230

3331
[coverage:run]
3432
include =

0 commit comments

Comments
 (0)