diff --git a/dev-requirements.txt b/dev-requirements.txt index 9512d6e8a..3c88ed465 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,17 +1,17 @@ -pytest==7.0.1 +pytest==7.3.0 flake8==6.0.0 black==23.3.0 -mypy==0.971 +mypy==1.2.0 isort==5.12.0 PyYAML==6.0 -docker==5.0.0 +docker==6.0.1 six==1.16.0 -types-requests==0.1.9 +types-requests==2.28.11.17 types-dataclasses==0.6.6 -types-psutil==5.8.19 -types-PyYAML==6.0.3 +types-psutil==5.9.5.11 +types-PyYAML==6.0.12.9 types-pkg-resources==0.1.3 -types-protobuf==3.19.22 -types-toml==0.10.8 -types-retry==0.9.9 -types-beautifulsoup4==4.11.1 +types-protobuf==4.22.0.2 +types-toml==0.10.8.6 +types-retry==0.9.9.3 +types-beautifulsoup4==4.12.0.3 diff --git a/gprofiler/metadata/py_module_version.py b/gprofiler/metadata/py_module_version.py index 6eb663927..7b457819d 100644 --- a/gprofiler/metadata/py_module_version.py +++ b/gprofiler/metadata/py_module_version.py @@ -219,8 +219,8 @@ def _populate_packages_versions(packages_versions: Dict[str, Optional[Tuple[str, # This function resolves symlinks and makes paths absolute for comparison purposes which isn't required # for our usage. if hasattr(pkg_resources, "_normalize_cached"): - original__normalize_cache = pkg_resources._normalize_cached # type: ignore - pkg_resources._normalize_cached = lambda path: path # type: ignore + original__normalize_cache = pkg_resources._normalize_cached + pkg_resources._normalize_cached = lambda path: path else: global _warned_no__normalized_cached if not _warned_no__normalized_cached: @@ -250,7 +250,7 @@ def _populate_packages_versions(packages_versions: Dict[str, Optional[Tuple[str, packages_versions[module_path] = package_info finally: # Don't forget to restore the original implementation in case someone else uses this function - pkg_resources._normalize_cached = original__normalize_cache # type: ignore + pkg_resources._normalize_cached = original__normalize_cache _exceptions_logged = 0 diff --git a/gprofiler/metadata/system_metadata.py b/gprofiler/metadata/system_metadata.py index 285ea3859..5e6a9996e 100644 --- a/gprofiler/metadata/system_metadata.py +++ b/gprofiler/metadata/system_metadata.py @@ -1,4 +1,5 @@ import array +import codecs import errno import ipaddress import os @@ -259,8 +260,7 @@ def get_static_system_info() -> SystemInfo: processors=cpu_count, cpu_model_name=cpu_model_name, cpu_flags=cpu_flags, - memory_capacity_mb=round(psutil.virtual_memory().total / 1024 / 1024), # type: ignore # virtual_memory doesn't - # have a return type is types-psutil + memory_capacity_mb=round(psutil.virtual_memory().total / 1024 / 1024), hostname=hostname, system=platform.system(), os_name=os_name, @@ -325,6 +325,10 @@ def _initialize_system_info() -> Any: mac_address = UNKNOWN_VALUE local_ip = UNKNOWN_VALUE + # ensure the "ascii" codec module is loaded - it used used by "distro" which is run in a separate + # mount namespace, unable to load the library if loaded lazily. + codecs.lookup("ascii") + # move to host mount NS for distro & ldd. # now, distro will read the files on host. # also move to host UTS NS for the hostname. diff --git a/gprofiler/system_metrics.py b/gprofiler/system_metrics.py index 8508d42e8..641d2de09 100644 --- a/gprofiler/system_metrics.py +++ b/gprofiler/system_metrics.py @@ -70,8 +70,7 @@ def stop(self) -> None: def _continuously_poll_memory(self, polling_rate_seconds: int) -> None: while not self._stop_event.is_set(): - current_ram_percent = psutil.virtual_memory().percent # type: ignore # virtual_memory doesn't have a - # return type is types-psutil + current_ram_percent = psutil.virtual_memory().percent self._mem_percentages.append(current_ram_percent) self._stop_event.wait(timeout=polling_rate_seconds) diff --git a/requirements.txt b/requirements.txt index 88f998dc9..aea275c54 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,17 +1,17 @@ -importlib-resources==5.1.0 -psutil==5.8.0 -requests==2.27.1 -ConfigArgParse==1.3 -distro==1.7.0 -setuptools==65.5.1 # For pkg_resources +importlib-resources==5.12.0 +psutil==5.9.4 +requests==2.28.2 +ConfigArgParse==1.5.3 +distro==1.8.0 +setuptools==67.6.1 # For pkg_resources six==1.16.0 packaging==23.1 -pyelftools==0.28 +pyelftools==0.29 curlify==2.2.1 retry==0.9.2 -websocket-client==1.3.1 +websocket-client==1.5.1 netifaces==0.11.0; sys.platform == "win32" WMI==1.5.1; sys.platform == "win32" ./granulate-utils/ humanfriendly==10.0 -beautifulsoup4==4.11.1 +beautifulsoup4==4.12.2 diff --git a/tests/conftest.py b/tests/conftest.py index 297a606e4..5e12cb57d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -76,8 +76,7 @@ def chdir(path: Path) -> Iterator[None]: @fixture(params=[False, True], ids=["on_host", "in_container"]) def in_container(request: FixtureRequest) -> bool: - return cast(bool, request.param) # type: ignore # SubRequest isn't exported yet, - # https://github.com/pytest-dev/pytest/issues/7469 + return cast(bool, request.param) @fixture diff --git a/tests/containers/python/lister.py b/tests/containers/python/lister.py index 0a0f2c7a4..a6606864c 100755 --- a/tests/containers/python/lister.py +++ b/tests/containers/python/lister.py @@ -30,7 +30,7 @@ def parser(): while True: # Have some package stacks. # Notice the name of the package name (PyYAML) is different from the name of the module (yaml) - yaml.parse("") # type: ignore + yaml.parse("") if __name__ == "__main__":