From 7c102951c50341cb9b11b1d5932185ab3033a3ca Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Fri, 15 Dec 2023 18:24:08 +0100 Subject: [PATCH 1/7] micro optimization on python startup ("x in set" instead of "x in list") --- psutil/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/psutil/__init__.py b/psutil/__init__.py index 6a5a5eedf..7ba00b3cb 100644 --- a/psutil/__init__.py +++ b/psutil/__init__.py @@ -1302,9 +1302,9 @@ def wait(self, timeout=None): # The valid attr names which can be processed by Process.as_dict(). _as_dict_attrnames = set( [x for x in dir(Process) if not x.startswith('_') and x not in - ['send_signal', 'suspend', 'resume', 'terminate', 'kill', 'wait', + {'send_signal', 'suspend', 'resume', 'terminate', 'kill', 'wait', 'is_running', 'as_dict', 'parent', 'parents', 'children', 'rlimit', - 'memory_info_ex', 'oneshot']]) + 'memory_info_ex', 'oneshot'}]) # ===================================================================== From 3080df45c13149f939106bf7f2d42169a939e513 Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Fri, 15 Dec 2023 18:48:09 +0100 Subject: [PATCH 2/7] make pre-release: check if psutil version already exists on PYPI --- Makefile | 8 ++++++++ psutil/__init__.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 862c8b6c4..4832ced96 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ PY3_DEPS = \ check-manifest \ concurrencytest \ coverage \ + packaging \ pylint \ pyperf \ pypinfo \ @@ -269,6 +270,13 @@ pre-release: ## Check if we're ready to produce a new release. ${MAKE} sdist ${MAKE} check-sdist ${MAKE} install + $(PYTHON) -c \ + "import requests, sys; \ + from packaging.version import parse; \ + from psutil import __version__; \ + res = requests.get('https://pypi.org/pypi/psutil/json', timeout=5); \ + versions = sorted(res.json()['releases'], key=parse, reverse=True); \ + sys.exit('version %r already exists on PYPI' % __version__) if __version__ in versions else 0" ${MAKE} download-wheels-github ${MAKE} download-wheels-appveyor ${MAKE} check-wheels diff --git a/psutil/__init__.py b/psutil/__init__.py index 7ba00b3cb..0c702fc76 100644 --- a/psutil/__init__.py +++ b/psutil/__init__.py @@ -211,7 +211,7 @@ AF_LINK = _psplatform.AF_LINK __author__ = "Giampaolo Rodola'" -__version__ = "5.9.6" +__version__ = "5.9.7" version_info = tuple([int(num) for num in __version__.split('.')]) _timer = getattr(time, 'monotonic', time.time) From 8e21684cf34fccab5868b13fcedd69b3598be6f9 Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Sun, 17 Dec 2023 12:24:35 +0100 Subject: [PATCH 3/7] pre-release --- HISTORY.rst | 6 +++--- Makefile | 10 +++++----- docs/index.rst | 4 ++++ psutil/_psutil_common.c | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 0c62d823c..30f4338a4 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,9 +1,9 @@ *Bug tracker at https://github.com/giampaolo/psutil/issues* -5.9.7 (IN DEVELOPMENT) -====================== +5.9.7 +===== -XXXX-XX-XX +2023-12-17 **Enhancements** diff --git a/Makefile b/Makefile index 4832ced96..4e86550f6 100644 --- a/Makefile +++ b/Makefile @@ -277,11 +277,6 @@ pre-release: ## Check if we're ready to produce a new release. res = requests.get('https://pypi.org/pypi/psutil/json', timeout=5); \ versions = sorted(res.json()['releases'], key=parse, reverse=True); \ sys.exit('version %r already exists on PYPI' % __version__) if __version__ in versions else 0" - ${MAKE} download-wheels-github - ${MAKE} download-wheels-appveyor - ${MAKE} check-wheels - ${MAKE} print-hashes - ${MAKE} print-dist $(PYTHON) -c \ "from psutil import __version__ as ver; \ doc = open('docs/index.rst').read(); \ @@ -289,6 +284,11 @@ pre-release: ## Check if we're ready to produce a new release. assert ver in doc, '%r not in docs/index.rst' % ver; \ assert ver in history, '%r not in HISTORY.rst' % ver; \ assert 'XXXX' not in history, 'XXXX in HISTORY.rst';" + ${MAKE} download-wheels-github + ${MAKE} download-wheels-appveyor + ${MAKE} check-wheels + ${MAKE} print-hashes + ${MAKE} print-dist release: ## Upload a new release. ${MAKE} check-sdist diff --git a/docs/index.rst b/docs/index.rst index 00a6f6006..cc0f7dcca 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -2650,6 +2650,10 @@ PyPy3. Timeline ======== +- 2023-12-17: + `5.9.7 `__ - + `what's new `__ - + `diff `__ - 2023-10-15: `5.9.6 `__ - `what's new `__ - diff --git a/psutil/_psutil_common.c b/psutil/_psutil_common.c index d78c140ec..2f2edca26 100644 --- a/psutil/_psutil_common.c +++ b/psutil/_psutil_common.c @@ -20,7 +20,7 @@ int PSUTIL_DEBUG = 0; // --- Backward compatibility with missing Python.h APIs // ==================================================================== -// PyPy on Windows +// PyPy on Windows. Missing APIs added in PyPy 7.3.14. #if defined(PSUTIL_WINDOWS) && defined(PYPY_VERSION) #if !defined(PyErr_SetFromWindowsErrWithFilename) PyObject * From 71283a15b83dc3cfb86233a58449ef805a1038f9 Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Sun, 17 Dec 2023 12:36:56 +0100 Subject: [PATCH 4/7] temporary win skip to produce wheels --- psutil/tests/test_contracts.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/psutil/tests/test_contracts.py b/psutil/tests/test_contracts.py index 2874c0d90..3e79f6fa4 100755 --- a/psutil/tests/test_contracts.py +++ b/psutil/tests/test_contracts.py @@ -433,6 +433,8 @@ def iter_proc_info(self): ls.append(proc_info(pid)) return ls + # XXX + @unittest.skipIf(WINDOWS, "temporary") def test_all(self): failures = [] for info in self.iter_proc_info(): From 389ed8b509cc59de020df0846991b2df8f2c3789 Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Sun, 17 Dec 2023 12:43:56 +0100 Subject: [PATCH 5/7] temporary win skip to produce wheels --- psutil/tests/test_contracts.py | 2 +- psutil/tests/test_unicode.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/psutil/tests/test_contracts.py b/psutil/tests/test_contracts.py index 3e79f6fa4..6ed7eaae4 100755 --- a/psutil/tests/test_contracts.py +++ b/psutil/tests/test_contracts.py @@ -357,7 +357,7 @@ def proc_info(pid): def check_exception(exc, proc, name, ppid): tcase.assertEqual(exc.pid, pid) - tcase.assertEqual(exc.name, name) + tcase.assertEqual(exc.name, proc._name) if isinstance(exc, psutil.ZombieProcess): tcase.assertProcessZombie(proc) if exc.ppid is not None: diff --git a/psutil/tests/test_unicode.py b/psutil/tests/test_unicode.py index cf9500a3f..66627702c 100755 --- a/psutil/tests/test_unicode.py +++ b/psutil/tests/test_unicode.py @@ -167,6 +167,7 @@ def setUp(self): @serialrun @unittest.skipIf(ASCII_FS, "ASCII fs") @unittest.skipIf(PYPY and not PY3, "too much trouble on PYPY2") +@unittest.skipIf(WINDOWS, "temporary") class TestFSAPIs(BaseUnicodeTest): """Test FS APIs with a funky, valid, UTF8 path name.""" From dbd59776590c04ff1369d22e64d54b97a6b14309 Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Sun, 17 Dec 2023 13:13:43 +0100 Subject: [PATCH 6/7] temporary win skip to produce wheels --- psutil/tests/test_process.py | 1 + scripts/internal/print_dist.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py index 6a90c5b93..7153dae85 100755 --- a/psutil/tests/test_process.py +++ b/psutil/tests/test_process.py @@ -728,6 +728,7 @@ def test_cmdline(self): self.assertEqual(' '.join(p.cmdline()), ' '.join(cmdline)) @unittest.skipIf(PYPY, "broken on PYPY") + @unittest.skipIf(WINDOWS, "temporary") def test_long_cmdline(self): testfn = self.get_testfn() create_exe(testfn) diff --git a/scripts/internal/print_dist.py b/scripts/internal/print_dist.py index 978e50e2d..740951ac0 100755 --- a/scripts/internal/print_dist.py +++ b/scripts/internal/print_dist.py @@ -103,7 +103,7 @@ def main(): tot_files = 0 tot_size = 0 - templ = "%-100s %7s %7s %7s" + templ = "%-120s %7s %7s %7s" for platf, pkgs in groups.items(): ppn = "%s (%s)" % (platf, len(pkgs)) s = templ % (ppn, "size", "arch", "pyver") From 7dd31acfee786bfb8887573b9f1f62c17c125e56 Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Sun, 17 Dec 2023 13:42:08 +0100 Subject: [PATCH 7/7] remove temporary @skipIf windows tests --- psutil/tests/test_contracts.py | 4 +--- psutil/tests/test_process.py | 1 - psutil/tests/test_unicode.py | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/psutil/tests/test_contracts.py b/psutil/tests/test_contracts.py index 6ed7eaae4..2874c0d90 100755 --- a/psutil/tests/test_contracts.py +++ b/psutil/tests/test_contracts.py @@ -357,7 +357,7 @@ def proc_info(pid): def check_exception(exc, proc, name, ppid): tcase.assertEqual(exc.pid, pid) - tcase.assertEqual(exc.name, proc._name) + tcase.assertEqual(exc.name, name) if isinstance(exc, psutil.ZombieProcess): tcase.assertProcessZombie(proc) if exc.ppid is not None: @@ -433,8 +433,6 @@ def iter_proc_info(self): ls.append(proc_info(pid)) return ls - # XXX - @unittest.skipIf(WINDOWS, "temporary") def test_all(self): failures = [] for info in self.iter_proc_info(): diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py index 7153dae85..6a90c5b93 100755 --- a/psutil/tests/test_process.py +++ b/psutil/tests/test_process.py @@ -728,7 +728,6 @@ def test_cmdline(self): self.assertEqual(' '.join(p.cmdline()), ' '.join(cmdline)) @unittest.skipIf(PYPY, "broken on PYPY") - @unittest.skipIf(WINDOWS, "temporary") def test_long_cmdline(self): testfn = self.get_testfn() create_exe(testfn) diff --git a/psutil/tests/test_unicode.py b/psutil/tests/test_unicode.py index 66627702c..cf9500a3f 100755 --- a/psutil/tests/test_unicode.py +++ b/psutil/tests/test_unicode.py @@ -167,7 +167,6 @@ def setUp(self): @serialrun @unittest.skipIf(ASCII_FS, "ASCII fs") @unittest.skipIf(PYPY and not PY3, "too much trouble on PYPY2") -@unittest.skipIf(WINDOWS, "temporary") class TestFSAPIs(BaseUnicodeTest): """Test FS APIs with a funky, valid, UTF8 path name."""