Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-pyperf for openSUSE:Factory 
checked in at 2024-01-07 21:42:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pyperf (Old)
 and      /work/SRC/openSUSE:Factory/.python-pyperf.new.28375 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pyperf"

Sun Jan  7 21:42:43 2024 rev:8 rq:1137437 version:2.6.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pyperf/python-pyperf.changes      
2022-11-12 17:41:09.718165425 +0100
+++ /work/SRC/openSUSE:Factory/.python-pyperf.new.28375/python-pyperf.changes   
2024-01-07 21:42:49.773535267 +0100
@@ -1,0 +2,11 @@
+Sun Jan  7 20:18:54 UTC 2024 - Dirk Müller <dmuel...@suse.com>
+
+- update to 2.6.2:
+  * Now, pystats stats are collected during warmups.
+  * system: Fix detection of battery.
+  * Fix a possible attribute error in argument parsing.
+  * Inherit PYTHONPATH environment variable by default.
+  * Runner.bench_async_func() takes an optional loop_factory to
+    support custom loop construction.
+
+-------------------------------------------------------------------

Old:
----
  pyperf-2.5.0.tar.gz

New:
----
  pyperf-2.6.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pyperf.spec ++++++
--- /var/tmp/diff_new_pack.HtDDHj/_old  2024-01-07 21:42:50.213551278 +0100
+++ /var/tmp/diff_new_pack.HtDDHj/_new  2024-01-07 21:42:50.213551278 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-pyperf
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2024 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,16 +16,17 @@
 #
 
 
-%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-%define skip_python2 1
+%{?sle15_python_module_pythons}
 Name:           python-pyperf
-Version:        2.5.0
+Version:        2.6.2
 Release:        0
 Summary:        Python module to run and analyze benchmarks
 License:        MIT
 URL:            https://github.com/vstinner/pyperf
 Source:         
https://files.pythonhosted.org/packages/source/p/pyperf/pyperf-%{version}.tar.gz
+BuildRequires:  %{python_module pip}
 BuildRequires:  %{python_module setuptools}
+BuildRequires:  %{python_module wheel}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
 Requires(post): update-alternatives
@@ -45,10 +46,10 @@
 %setup -q -n pyperf-%{version}
 
 %build
-%python_build
+%pyproject_wheel
 
 %install
-%python_install
+%pyproject_install
 %python_clone -a %{buildroot}%{_bindir}/pyperf
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 

++++++ pyperf-2.5.0.tar.gz -> pyperf-2.6.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/PKG-INFO new/pyperf-2.6.2/PKG-INFO
--- old/pyperf-2.5.0/PKG-INFO   2022-11-04 15:25:21.172275500 +0100
+++ new/pyperf-2.6.2/PKG-INFO   2023-11-02 16:16:57.173724200 +0100
@@ -1,11 +1,11 @@
 Metadata-Version: 2.1
 Name: pyperf
-Version: 2.5.0
+Version: 2.6.2
 Summary: Python module to run and analyze benchmarks
-Home-page: https://github.com/psf/pyperf
-Author: Victor Stinner
-Author-email: vstin...@redhat.com
-License: MIT license
+Author-email: Victor Stinner <vstin...@redhat.com>
+Maintainer-email: Dong-hee Na <donghee...@python.org>
+License: MIT
+Project-URL: Homepage, https://github.com/psf/pyperf
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: MIT License
@@ -13,7 +13,13 @@
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 3
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Requires-Python: >=3.7
+Description-Content-Type: text/x-rst
 License-File: COPYING
+Requires-Dist: psutil>=5.9.0
+Provides-Extra: dev
+Requires-Dist: tox; extra == "dev"
+Requires-Dist: importlib-metadata; python_version < "3.8" and extra == "dev"
 
 ******
 pyperf
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/doc/api.rst new/pyperf-2.6.2/doc/api.rst
--- old/pyperf-2.5.0/doc/api.rst        2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/doc/api.rst        2023-11-02 16:16:47.000000000 +0100
@@ -539,7 +539,7 @@
 
       See the :ref:`bench_func() example <bench_func_example>`.
 
-   .. method:: bench_async_func(name, func, \*args, inner_loops=None, 
metadata=None)
+   .. method:: bench_async_func(name, func, \*args, inner_loops=None, 
metadata=None, loop_factory=None)
 
       Benchmark the function ``await func(*args)`` in asyncio event loop.
 
@@ -548,6 +548,9 @@
       The *inner_loops* parameter is used to normalize timing per loop
       iteration.
 
+      The *loop_factory* parameter, if specified, will be used to create the
+      event loop used by the benchmark.
+
       To call ``func()`` with keyword arguments, use ``functools.partial``.
 
       Return a :class:`Benchmark` instance.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/doc/changelog.rst 
new/pyperf-2.6.2/doc/changelog.rst
--- old/pyperf-2.5.0/doc/changelog.rst  2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/doc/changelog.rst  2023-11-02 16:16:47.000000000 +0100
@@ -1,8 +1,31 @@
 Changelog
 =========
 
+Version 2.6.2 (2023-11-02)
+---------------------------
+
+* Now, pystats stats are collected during warmups.
+  Patch by Mike Droettboom.
+* system: Fix detection of battery.
+  Patch by Victor Stinner
+
+Version 2.6.1 (2023-06-12)
+---------------------------
+
+* Fix a possible attribute error in argument parsing.
+  Patch by Colton Myers
+
+Version 2.6.0 (2023-03-22)
+--------------------------
+
+* Inherit ``PYTHONPATH`` environment variable by default.
+  Patch by Theodore Ni.
+
+* ``Runner.bench_async_func()`` takes an optional ``loop_factory`` to support 
custom loop construction.
+  Patch by Itamar O.
+
 Version 2.5.0 (2022-11-04)
--------------
+--------------------------
 
 * Support collecting specialization statistics from running benchmarks.
   Patch by Mike Droettboom.
@@ -11,7 +34,7 @@
   Patch by Michael Droettboom
 
 Version 2.4.1 (2022-08-07)
--------------
+--------------------------
 
 * Reject --tracemalloc in ``pyperf command``.
   Patch by Yichen Yan
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/doc/cli.rst new/pyperf-2.6.2/doc/cli.rst
--- old/pyperf-2.5.0/doc/cli.rst        2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/doc/cli.rst        2023-11-02 16:16:47.000000000 +0100
@@ -109,7 +109,7 @@
 .. versionchanged:: 1.2
    The ``--benchmark`` option can now be specified multiple times.
 
-.. versionchnaged:: 2.3
+.. versionchanged:: 2.3
    The ``--table-format`` option now can designate format between reST and 
markdown.
 
 pyperf determines whether two samples differ significantly using a `Student's
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/doc/conf.py new/pyperf-2.6.2/doc/conf.py
--- old/pyperf-2.5.0/doc/conf.py        2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/doc/conf.py        2023-11-02 16:16:47.000000000 +0100
@@ -12,10 +12,6 @@
 # All configuration values have a default; values that are commented out
 # serve to show the default.
 
-import sys
-import os
-import shlex
-
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -55,14 +51,14 @@
 # built documents.
 #
 # The short X.Y version.
-version = release = '2.5.0'
+version = release = '2.6.2'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
 #
 # This is also used if you do content translation via gettext catalogs.
 # Usually you set "language" from the command line for these cases.
-language = None
+language = "en"
 
 # There are two options for replacing |today|: either, you set today to some
 # non-false value, then it is used:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pyperf-2.5.0/doc/examples/bench_async_func_with_loop_factory.py 
new/pyperf-2.6.2/doc/examples/bench_async_func_with_loop_factory.py
--- old/pyperf-2.5.0/doc/examples/bench_async_func_with_loop_factory.py 
1970-01-01 01:00:00.000000000 +0100
+++ new/pyperf-2.6.2/doc/examples/bench_async_func_with_loop_factory.py 
2023-11-02 16:16:47.000000000 +0100
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+import asyncio
+import pyperf
+
+
+def loop_factory():
+    return asyncio.new_event_loop()
+
+
+async def func():
+    await asyncio.sleep(0.001)
+
+
+runner = pyperf.Runner()
+runner.bench_async_func('async_sleep', func, loop_factory=loop_factory)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/doc/examples/bench_time_func.py 
new/pyperf-2.6.2/doc/examples/bench_time_func.py
--- old/pyperf-2.5.0/doc/examples/bench_time_func.py    2022-11-04 
15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/doc/examples/bench_time_func.py    2023-11-02 
16:16:47.000000000 +0100
@@ -6,7 +6,7 @@
     range_it = range(loops)
     t0 = pyperf.perf_counter()
 
-    for loops in range_it:
+    for _ in range_it:
         mydict['0']
         mydict['100']
         mydict['200']
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/doc/runner.rst 
new/pyperf-2.6.2/doc/runner.rst
--- old/pyperf-2.5.0/doc/runner.rst     2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/doc/runner.rst     2023-11-02 16:16:47.000000000 +0100
@@ -118,9 +118,10 @@
   isolated CPUs are found. See :ref:`CPU pinning and CPU isolation <pin-cpu>`.
 * ``--inherit-environ=VARS``: ``VARS`` is a comma-separated list of environment
   variable names which are inherited by worker child processes. By default,
-  only the following variables are inherited: ``PATH``, ``HOME``, ``TEMP``,
-  ``COMSPEC``, ``SystemRoot`` and locale environment variables. See the
-  ``--no-locale`` below for locale environment variables.
+  only the following variables are inherited: ``PATH``, ``PYTHONPATH``,
+  ``HOME``, ``TEMP``, ``COMSPEC``, ``SystemRoot``, ``SystemDrive``, and locale
+  environment variables. See the ``--no-locale`` below for locale environment
+  variables.
 * ``--copy-env``: Inherit all environment variables.
 * ``--no-locale``: Don't inherit locale environment variables:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/__init__.py 
new/pyperf-2.6.2/pyperf/__init__.py
--- old/pyperf-2.5.0/pyperf/__init__.py 2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/pyperf/__init__.py 2023-11-02 16:16:47.000000000 +0100
@@ -1,6 +1,6 @@
 from time import perf_counter
 
-VERSION = (2, 5, 0)
+VERSION = (2, 6, 2)
 __version__ = '.'.join(map(str, VERSION))
 
 # Export pyperf.perf_counter for backward compatibility with pyperf 1.7
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/__main__.py 
new/pyperf-2.6.2/pyperf/__main__.py
--- old/pyperf-2.5.0/pyperf/__main__.py 2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/pyperf/__main__.py 2023-11-02 16:16:47.000000000 +0100
@@ -357,7 +357,7 @@
                 yield (suite, ignored)
 
 
-def load_benchmarks(args, name=True):
+def load_benchmarks(args):
     data = Benchmarks()
     data.load_benchmark_suites(args.filenames)
     if getattr(args, 'benchmarks', None):
@@ -681,7 +681,6 @@
                       file=sys.stderr)
                 sys.exit(1)
             except TypeError:
-                raise
                 print("ERROR: Metadata %r of benchmark %r is not an integer"
                       % (name, benchmark.get_name()),
                       file=sys.stderr)
@@ -699,7 +698,7 @@
 
 
 def cmd_slowest(args):
-    data = load_benchmarks(args, name=False)
+    data = load_benchmarks(args)
     nslowest = args.n
 
     use_title = (data.get_nsuite() > 1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/_bench.py 
new/pyperf-2.6.2/pyperf/_bench.py
--- old/pyperf-2.5.0/pyperf/_bench.py   2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/pyperf/_bench.py   2023-11-02 16:16:47.000000000 +0100
@@ -10,7 +10,7 @@
                               _common_metadata, get_metadata_info,
                               _exclude_common_metadata)
 from pyperf._formatter import DEFAULT_UNIT, format_values
-from pyperf._utils import parse_iso8601, median_abs_dev, percentile
+from pyperf._utils import median_abs_dev, percentile
 
 
 # JSON format history:
@@ -521,8 +521,7 @@
         metadata = self._get_common_metadata()
         common_metadata = dict(metadata, **suite_metadata)
 
-        data = {}
-        data['runs'] = [run._as_json(common_metadata) for run in self._runs]
+        data = {'runs': [run._as_json(common_metadata) for run in self._runs]}
         metadata = _exclude_common_metadata(metadata, suite_metadata)
         if metadata:
             data['metadata'] = metadata
@@ -595,7 +594,7 @@
             run_start = run._get_date()
             if run_start is None:
                 continue
-            run_start = parse_iso8601(run_start)
+            run_start = datetime.datetime.fromisoformat(run_start)
 
             duration = run._get_duration()
             duration = int(math.ceil(duration))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/_cli.py 
new/pyperf-2.6.2/pyperf/_cli.py
--- old/pyperf-2.5.0/pyperf/_cli.py     2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/pyperf/_cli.py     2023-11-02 16:16:47.000000000 +0100
@@ -87,7 +87,6 @@
             loops, value = warmup
             raw_value = value * (loops * inner_loops)
             if raw:
-                text = format_value(raw_value)
                 text = ("%s (loops: %s)"
                         % (format_value(raw_value),
                            format_number(loops)))
@@ -273,8 +272,7 @@
     lines.append('')
 
     # Minimum
-    table = []
-    table.append(("Minimum", bench.format_value(min(values))))
+    table = [("Minimum", bench.format_value(min(values)))]
 
     # Median +- MAD
     median = bench.median()
@@ -382,8 +380,6 @@
 
         value_width = max([len(bench.format_value(bucket * value_k))
                            for bucket in range(bucket_min, bucket_max + 1)])
-        width = columns - value_width
-
         line = ': %s #' % count_max
         width = columns - (value_width + len(line))
         if not extend:
@@ -517,7 +513,7 @@
     return _format_result_value(bench)
 
 
-def format_result(bench, prefix=True):
+def format_result(bench):
     loops = None
     warmups = None
     for run in bench._runs:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/_collect_metadata.py 
new/pyperf-2.6.2/pyperf/_collect_metadata.py
--- old/pyperf-2.5.0/pyperf/_collect_metadata.py        2022-11-04 
15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/pyperf/_collect_metadata.py        2023-11-02 
16:16:47.000000000 +0100
@@ -233,7 +233,6 @@
                 # Example: "processor 0: version = 00,  identification = [...]"
                 match = re.match(r'^processor ([0-9]+): ', line)
                 if match is None:
-                    raise Exception
                     # unknown /proc/cpuinfo format: silently ignore and exit
                     return
 
@@ -410,9 +409,7 @@
 
 
 def collect_metadata(process=True):
-    metadata = {}
-    metadata['perf_version'] = pyperf.__version__
-    metadata['date'] = format_datetime(datetime.datetime.now())
+    metadata = {'perf_version': pyperf.__version__, 'date': 
format_datetime(datetime.datetime.now())}
 
     collect_system_metadata(metadata)
     collect_cpu_metadata(metadata)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/_compare.py 
new/pyperf-2.6.2/pyperf/_compare.py
--- old/pyperf-2.5.0/pyperf/_compare.py 2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/pyperf/_compare.py 2023-11-02 16:16:47.000000000 +0100
@@ -284,9 +284,7 @@
         for item in self.all_results[0]:
             headers.append(item.changed.name)
 
-        all_norm_means = []
-        for column in headers[2:]:
-            all_norm_means.append([])
+        all_norm_means = [[] for _ in range(len(headers[2:]))]
 
         rows = []
         not_significant = []
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/_process_time.py 
new/pyperf-2.6.2/pyperf/_process_time.py
--- old/pyperf-2.5.0/pyperf/_process_time.py    2022-11-04 15:25:18.000000000 
+0100
+++ new/pyperf-2.6.2/pyperf/_process_time.py    2023-11-02 16:16:47.000000000 
+0100
@@ -60,7 +60,7 @@
         temp_profile_filename = tempfile.mktemp()
         args = [args[0], "-m", "cProfile", "-o", temp_profile_filename] + 
args[1:]
 
-    for loop in range_it:
+    for _ in range_it:
         start_rss = get_max_rss()
 
         proc = subprocess.Popen(args, **kw)
@@ -75,8 +75,6 @@
                 os.unlink(temp_profile_filename)
             sys.exit(exitcode)
 
-        proc = None
-
         rss = get_max_rss() - start_rss
         max_rss = max(max_rss, rss)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/_runner.py 
new/pyperf-2.6.2/pyperf/_runner.py
--- old/pyperf-2.5.0/pyperf/_runner.py  2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/pyperf/_runner.py  2023-11-02 16:16:47.000000000 +0100
@@ -71,7 +71,7 @@
 
     # Default parameters are chosen to have approximatively a run of 0.5 second
     # and so a total duration of 5 seconds by default
-    def __init__(self, values=None, warmups=None, processes=None,
+    def __init__(self, values=None, processes=None,
                  loops=0, min_time=0.1, metadata=None,
                  show_name=True,
                  program_args=None, add_cmdline_args=None,
@@ -331,7 +331,7 @@
             self._only_in_worker("--worker-task")
 
         if args.tracemalloc:
-            if args.action == 'command':
+            if getattr(args, 'action', None) == 'command':
                 raise CLIError('--tracemalloc cannot be used with pyperf 
command')
             try:
                 import tracemalloc   # noqa
@@ -485,7 +485,7 @@
         if self.args.profile:
             profiler, time_func = profiling_wrapper(time_func)
 
-        def task_func(task, loops):
+        def task_func(_, loops):
             return time_func(loops, *args)
 
         task = WorkerProcessTask(self, name, task_func, metadata)
@@ -514,7 +514,7 @@
         if self.args.profile:
             profiler, func = profiling_wrapper(func)
 
-        def task_func(task, loops):
+        def task_func(_, loops):
             # use fast local variables
             local_timer = time.perf_counter
             local_func = func
@@ -546,6 +546,7 @@
 
         inner_loops = kwargs.pop('inner_loops', None)
         metadata = kwargs.pop('metadata', None)
+        loop_factory = kwargs.pop('loop_factory', None)
         self._no_keyword_argument(kwargs)
 
         if not self._check_worker_task():
@@ -557,7 +558,7 @@
         if self.args.profile:
             profiler, func = profiling_wrapper(func)
 
-        def task_func(task, loops):
+        def task_func(_, loops):
             if loops != 1:
                 async def main():
                     # use fast local variables
@@ -582,16 +583,20 @@
                     return dt
 
             import asyncio
-            if hasattr(asyncio, 'run'):  # Python 3.7+
-                dt = asyncio.run(main())
-            else:  # Python 3.6
+            # using the lower level loop API instead of asyncio.run because
+            # asyncio.run gained the `loop_factory` arg only in Python 3.12.
+            # we can go back to asyncio.run when Python 3.12 is the oldest
+            # supported version for pyperf.
+            if loop_factory is None:
                 loop = asyncio.new_event_loop()
-                asyncio.set_event_loop(loop)
-                try:
-                    dt = loop.run_until_complete(main())
-                finally:
-                    asyncio.set_event_loop(None)
-                    loop.close()
+            else:
+                loop = loop_factory()
+            asyncio.set_event_loop(loop)
+            try:
+                dt = loop.run_until_complete(main())
+            finally:
+                asyncio.set_event_loop(None)
+                loop.close()
 
             return dt
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/_system.py 
new/pyperf-2.6.2/pyperf/_system.py
--- old/pyperf-2.5.0/pyperf/_system.py  2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/pyperf/_system.py  2023-11-02 16:16:47.000000000 +0100
@@ -37,10 +37,9 @@
 def run_cmd(cmd):
     try:
         # ignore stdout and stderr
-        # FIXME: redirect output to /dev/null
         proc = subprocess.Popen(cmd,
-                                stdout=subprocess.PIPE,
-                                stderr=subprocess.PIPE)
+                                stdout=subprocess.DEVNULL,
+                                stderr=subprocess.DEVNULL)
     except OSError as exc:
         if exc.errno == errno.ENOENT:
             return 127
@@ -214,7 +213,7 @@
             fd = os.open(path, os.O_WRONLY)
             try:
                 if hasattr(os, 'pwrite'):
-                    data = os.pwrite(fd, data, reg_num)
+                    os.pwrite(fd, data, reg_num)
                 else:
                     os.lseek(fd, reg_num, os.SEEK_SET)
                     os.write(fd, data)
@@ -866,6 +865,12 @@
     def read_power_supply(self):
         # Python implementation of the on_ac_power shell script
         for name in os.listdir(self.path):
+            # Ignore "USB" and "Battery" types
+            filename = os.path.join(self.path, name, 'type')
+            sys_type = self.read_first_line(filename)
+            if sys_type.strip() != "Mains":
+                continue
+
             filename = os.path.join(self.path, name, 'online')
             if not os.path.exists(filename):
                 continue
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/_timeit.py 
new/pyperf-2.6.2/pyperf/_timeit.py
--- old/pyperf-2.5.0/pyperf/_timeit.py  2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/pyperf/_timeit.py  2023-11-02 16:16:47.000000000 +0100
@@ -108,7 +108,7 @@
         exec(code, global_ns, local_ns)
         return local_ns["inner"]
 
-    def update_linecache(self, file=None):
+    def update_linecache(self):
         import linecache
 
         linecache.cache[self.filename] = (len(self.src),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/_utils.py 
new/pyperf-2.6.2/pyperf/_utils.py
--- old/pyperf-2.5.0/pyperf/_utils.py   2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/pyperf/_utils.py   2023-11-02 16:16:47.000000000 +0100
@@ -1,5 +1,4 @@
 import contextlib
-import datetime
 import math
 import os
 import statistics
@@ -14,21 +13,6 @@
 if MS_WINDOWS:
     import msvcrt
 
-
-def parse_iso8601(date):
-    if '.' in date:
-        date, floatpart = date.split('.', 1)
-        floatpart = float('.' + floatpart)
-    else:
-        floatpart = 0
-    try:
-        dt = datetime.datetime.strptime(date, '%Y-%m-%d %H:%M:%S')
-    except ValueError:
-        dt = datetime.datetime.strptime(date, '%Y-%m-%dT%H:%M:%S')
-    dt += datetime.timedelta(seconds=floatpart)
-    return dt
-
-
 # A table of 95% confidence intervals for a two-tailed t distribution, as a
 # function of the degrees of freedom. For larger degrees of freedom, we
 # approximate. While this may look less elegant than simply calculating the
@@ -279,7 +263,7 @@
         return os.environ
     env = {}
 
-    copy_env = ["PATH", "HOME", "TEMP", "COMSPEC", "SystemRoot", "SystemDrive"]
+    copy_env = ["PATH", "PYTHONPATH", "HOME", "TEMP", "COMSPEC", "SystemRoot", 
"SystemDrive"]
     if locale:
         copy_env.extend(('LANG', 'LC_ADDRESS', 'LC_ALL', 'LC_COLLATE',
                          'LC_CTYPE', 'LC_IDENTIFICATION', 'LC_MEASUREMENT',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/_worker.py 
new/pyperf-2.6.2/pyperf/_worker.py
--- old/pyperf-2.5.0/pyperf/_worker.py  2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/pyperf/_worker.py  2023-11-02 16:16:47.000000000 +0100
@@ -59,8 +59,8 @@
         task_func = self.task_func
 
         # If we are on a pystats build, turn on stats collection around the
-        # actual work, but only if we aren't warming up or calibrating.
-        if hasattr(sys, "_stats_on") and not is_warmup and not calibrate_loops:
+        # actual work, except when calibrating.
+        if hasattr(sys, "_stats_on") and not calibrate_loops:
             core_task_func = task_func
 
             def stats_func(*args):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/tests/test_bench.py 
new/pyperf-2.6.2/pyperf/tests/test_bench.py
--- old/pyperf-2.5.0/pyperf/tests/test_bench.py 2022-11-04 15:25:18.000000000 
+0100
+++ new/pyperf-2.6.2/pyperf/tests/test_bench.py 2023-11-02 16:16:47.000000000 
+0100
@@ -375,7 +375,7 @@
         self.assertEqual(bench.median_abs_dev(), 24.0)
 
     def test_stats_same(self):
-        values = [5.0 for i in range(10)]
+        values = [5.0 for _ in range(10)]
         run = create_run(values)
         bench = pyperf.Benchmark([run])
         self.assertEqual(bench.mean(), 5.0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/tests/test_examples.py 
new/pyperf-2.6.2/pyperf/tests/test_examples.py
--- old/pyperf-2.5.0/pyperf/tests/test_examples.py      2022-11-04 
15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/pyperf/tests/test_examples.py      2023-11-02 
16:16:47.000000000 +0100
@@ -23,11 +23,11 @@
         if not_tested:
             raise Exception("not tested scripts: %s" % sorted(not_tested))
 
-    def check_command(self, script, args, nproc=3):
+    def check_command(self, script, args):
         self.TESTED.add(script)
         script = os.path.join(EXAMPLES_DIR, script)
 
-        cmd = [sys.executable] + [script] + args + ["--inherit-env=PYTHONPATH"]
+        cmd = [sys.executable] + [script] + args
         proc = tests.get_output(cmd)
 
         self.assertRegex(proc.stdout,
@@ -51,6 +51,12 @@
         # Use -w1 --min-time=0.001 to reduce the duration of the test
         args = ['-p2', '-w1', '--min-time=0.001']
         self.check_command(script, args)
+
+    def test_bench_async_func_with_loop_factory(self):
+        script = 'bench_async_func_with_loop_factory.py'
+        # Use -w1 --min-time=0.001 to reduce the duration of the test
+        args = ['-p2', '-w1', '--min-time=0.001']
+        self.check_command(script, args)
 
     def test_bench_time_func(self):
         script = 'bench_time_func.py'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/tests/test_misc.py 
new/pyperf-2.6.2/pyperf/tests/test_misc.py
--- old/pyperf-2.5.0/pyperf/tests/test_misc.py  2022-11-04 15:25:18.000000000 
+0100
+++ new/pyperf-2.6.2/pyperf/tests/test_misc.py  2023-11-02 16:16:47.000000000 
+0100
@@ -67,8 +67,13 @@
         self.assertRaises(ValueError, parse_run_list, '1,')
 
     def test_setup_version(self):
-        import setup
-        self.assertEqual(pyperf.__version__, setup.VERSION)
+        try:
+            from importlib.metadata import version
+        except ModuleNotFoundError:
+            # Workaround for Python 3.7
+            from importlib_metadata import version
+
+        self.assertEqual(pyperf.__version__, version("pyperf"))
 
     def test_doc_version(self):
         doc_path = os.path.join(os.path.dirname(__file__), '..', '..', 'doc')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/tests/test_timeit.py 
new/pyperf-2.6.2/pyperf/tests/test_timeit.py
--- old/pyperf-2.5.0/pyperf/tests/test_timeit.py        2022-11-04 
15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/pyperf/tests/test_timeit.py        2023-11-02 
16:16:47.000000000 +0100
@@ -237,8 +237,7 @@
 
             # Run benchmark to check if --python works
             args = ('--metadata',
-                    '--python', tmp_exe,
-                    '--inherit-env', 'PYTHONPATH')
+                    '--python', tmp_exe)
             args = PERF_TIMEIT + args + FAST_BENCH_ARGS
             cmd = tests.get_output(args, env=env)
         finally:
@@ -393,22 +392,24 @@
             Timer(setup="foo = 'bar', \\ ", stmt="bar = 'baz'")
 
         err = cm.exception
+        found = False
+        for msg in ["Unknown character", "unexpected character after line"]:
+            if msg in str(err):
+                found = True
 
-        if PYPY:
-            self.assertTrue("Unknown character" in str(err))
-        else:
-            self.assertTrue('unexpected character after line' in str(err))
+        self.assertTrue(found)
 
     def test_raises_if_stmt_and_teardown_contain_invalid_syntax(self):
         with self.assertRaises(SyntaxError) as cm:
             Timer(stmt="foo = 'bar', \\ ", teardown="bar = 'baz'")
 
         err = cm.exception
+        found = False
+        for msg in ["Unknown character", "unexpected character after line"]:
+            if msg in str(err):
+                found = True
 
-        if PYPY:
-            self.assertTrue("Unknown character" in str(err))
-        else:
-            self.assertTrue('unexpected character after line' in str(err))
+        self.assertTrue(found)
 
     def test_returns_valid_template_if_setup_is_str(self):
         setup = "foo = 'bar'\nbar = 'baz'"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf/tests/test_utils.py 
new/pyperf-2.6.2/pyperf/tests/test_utils.py
--- old/pyperf-2.5.0/pyperf/tests/test_utils.py 2022-11-04 15:25:18.000000000 
+0100
+++ new/pyperf-2.6.2/pyperf/tests/test_utils.py 2023-11-02 16:16:47.000000000 
+0100
@@ -1,4 +1,3 @@
-import datetime
 import io
 import time
 import unittest
@@ -75,16 +74,6 @@
 
 
 class TestUtils(unittest.TestCase):
-    def test_parse_iso8601(self):
-        # Default format using 'T' separator
-        self.assertEqual(utils.parse_iso8601('2016-07-20T14:06:07'),
-                         datetime.datetime(2016, 7, 20, 14, 6, 7))
-        # Microseconds
-        self.assertEqual(utils.parse_iso8601('2016-07-20T14:06:07.608319'),
-                         datetime.datetime(2016, 7, 20, 14, 6, 7, 608319))
-        # Space separator
-        self.assertEqual(utils.parse_iso8601('2016-07-20 14:06:07'),
-                         datetime.datetime(2016, 7, 20, 14, 6, 7))
 
     def test_format_seconds(self):
         self.assertEqual(format_seconds(0),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf.egg-info/PKG-INFO 
new/pyperf-2.6.2/pyperf.egg-info/PKG-INFO
--- old/pyperf-2.5.0/pyperf.egg-info/PKG-INFO   2022-11-04 15:25:21.000000000 
+0100
+++ new/pyperf-2.6.2/pyperf.egg-info/PKG-INFO   2023-11-02 16:16:57.000000000 
+0100
@@ -1,11 +1,11 @@
 Metadata-Version: 2.1
 Name: pyperf
-Version: 2.5.0
+Version: 2.6.2
 Summary: Python module to run and analyze benchmarks
-Home-page: https://github.com/psf/pyperf
-Author: Victor Stinner
-Author-email: vstin...@redhat.com
-License: MIT license
+Author-email: Victor Stinner <vstin...@redhat.com>
+Maintainer-email: Dong-hee Na <donghee...@python.org>
+License: MIT
+Project-URL: Homepage, https://github.com/psf/pyperf
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: MIT License
@@ -13,7 +13,13 @@
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 3
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Requires-Python: >=3.7
+Description-Content-Type: text/x-rst
 License-File: COPYING
+Requires-Dist: psutil>=5.9.0
+Provides-Extra: dev
+Requires-Dist: tox; extra == "dev"
+Requires-Dist: importlib-metadata; python_version < "3.8" and extra == "dev"
 
 ******
 pyperf
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf.egg-info/SOURCES.txt 
new/pyperf-2.6.2/pyperf.egg-info/SOURCES.txt
--- old/pyperf-2.5.0/pyperf.egg-info/SOURCES.txt        2022-11-04 
15:25:21.000000000 +0100
+++ new/pyperf-2.6.2/pyperf.egg-info/SOURCES.txt        2023-11-02 
16:16:57.000000000 +0100
@@ -2,8 +2,7 @@
 MANIFEST.in
 README.rst
 TODO.rst
-setup.py
-test-requirements.txt
+pyproject.toml
 tox.ini
 doc/Makefile
 doc/analyze.rst
@@ -25,6 +24,7 @@
 doc/timeit_strip.json.gz
 doc/user_guide.rst
 doc/examples/bench_async_func.py
+doc/examples/bench_async_func_with_loop_factory.py
 doc/examples/bench_command.py
 doc/examples/bench_func.py
 doc/examples/bench_time_func.py
@@ -57,6 +57,7 @@
 pyperf.egg-info/SOURCES.txt
 pyperf.egg-info/dependency_links.txt
 pyperf.egg-info/entry_points.txt
+pyperf.egg-info/requires.txt
 pyperf.egg-info/top_level.txt
 pyperf/tests/__init__.py
 pyperf/tests/mult_list_bench.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyperf.egg-info/requires.txt 
new/pyperf-2.6.2/pyperf.egg-info/requires.txt
--- old/pyperf-2.5.0/pyperf.egg-info/requires.txt       1970-01-01 
01:00:00.000000000 +0100
+++ new/pyperf-2.6.2/pyperf.egg-info/requires.txt       2023-11-02 
16:16:57.000000000 +0100
@@ -0,0 +1,7 @@
+psutil>=5.9.0
+
+[dev]
+tox
+
+[dev:python_version < "3.8"]
+importlib-metadata
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/pyproject.toml 
new/pyperf-2.6.2/pyproject.toml
--- old/pyperf-2.5.0/pyproject.toml     1970-01-01 01:00:00.000000000 +0100
+++ new/pyperf-2.6.2/pyproject.toml     2023-11-02 16:16:47.000000000 +0100
@@ -0,0 +1,63 @@
+# Prepare a release:
+#
+#  - git pull --rebase
+#  - update version in pyperf/__init__.py and doc/conf.py
+#  - set release date in doc/changelog.rst
+#  - git commit -a -m "prepare release x.y"
+#  - Remove untracked files/dirs: git clean -fdx
+#  - run tests: tox --parallel auto
+#  - git push or send the PR to the repository
+#  - check Github Action CI: 
https://github.com/psf/pyperf/actions/workflows/build.yml
+#
+# Release a new version:
+#
+#  - go to the GitHub release tab: https://github.com/psf/pyperf/releases
+#  - click "Draft a new release" and fill the contents
+#  - finally click the "Publish release" button! Done!
+#  - monitor the publish status: 
https://github.com/psf/pyperf/actions/workflows/publish.yml
+#
+# After the release:
+#
+#  - set version to n+1
+#  - git commit -a -m "post-release"
+#  - git push or send the PR to the repository
+
+[build-system]
+requires = ["setuptools >= 61"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "pyperf"
+dynamic = ["version"]
+license = {text = "MIT"}
+description = "Python module to run and analyze benchmarks"
+readme = "README.rst"
+urls = {Homepage = "https://github.com/psf/pyperf"}
+authors= [{name = "Victor Stinner", email = "vstin...@redhat.com"}]
+maintainers = [{name = "Dong-hee Na", email = "donghee...@python.org"}]
+classifiers = [
+    "Development Status :: 5 - Production/Stable",
+    "Intended Audience :: Developers",
+    "License :: OSI Approved :: MIT License",
+    "Natural Language :: English",
+    "Operating System :: OS Independent",
+    "Programming Language :: Python :: 3",
+    "Topic :: Software Development :: Libraries :: Python Modules"
+]
+requires-python = ">=3.7"
+dependencies = ["psutil>=5.9.0"]
+
+[project.optional-dependencies]
+dev = [
+    'tox',
+    'importlib-metadata; python_version < "3.8"'
+]
+
+[project.scripts]
+pyperf = "pyperf.__main__:main"
+
+[tool.setuptools]
+packages = ["pyperf", "pyperf.tests"]
+
+[tool.setuptools.dynamic]
+version = {attr = "pyperf.__version__"}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/setup.py new/pyperf-2.6.2/setup.py
--- old/pyperf-2.5.0/setup.py   2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/setup.py   1970-01-01 01:00:00.000000000 +0100
@@ -1,74 +0,0 @@
-#!/usr/bin/env python3
-
-# Prepare a release:
-#
-#  - git pull --rebase
-#  - update version in setup.py, pyperf/__init__.py and doc/conf.py
-#  - set release date in doc/changelog.rst
-#  - git commit -a -m "prepare release x.y"
-#  - Remove untracked files/dirs: git clean -fdx
-#  - run tests: tox --parallel auto
-#  - git push or send the PR to the repository
-#  - check Github Action CI: 
https://github.com/psf/pyperf/actions/workflows/build.yml
-#
-# Release a new version:
-#
-#  - go to the GitHub release tab: https://github.com/psf/pyperf/releases
-#  - click "Draft a new release" and fill the contents
-#  - finally click the "Publish release" button! Done!
-#  - monitor the publish status: 
https://github.com/psf/pyperf/actions/workflows/publish.yml
-#
-# After the release:
-#
-#  - set version to n+1
-#  - git commit -a -m "post-release"
-#  - git push or send the PR to the repository
-
-VERSION = '2.5.0'
-
-DESCRIPTION = 'Python module to run and analyze benchmarks'
-CLASSIFIERS = [
-    'Development Status :: 5 - Production/Stable',
-    'Intended Audience :: Developers',
-    'License :: OSI Approved :: MIT License',
-    'Natural Language :: English',
-    'Operating System :: OS Independent',
-    'Programming Language :: Python :: 3',
-    'Topic :: Software Development :: Libraries :: Python Modules',
-]
-
-
-# put most of the code inside main() to be able to import setup.py in
-# test_tools.py, to ensure that VERSION is the same as
-# pyperf.__version__.
-def main():
-    from setuptools import setup
-
-    with open('README.rst') as fp:
-        long_description = fp.read().strip()
-
-    options = {
-        'name': 'pyperf',
-        'version': VERSION,
-        'license': 'MIT license',
-        'description': DESCRIPTION,
-        'long_description': long_description,
-        'url': 'https://github.com/psf/pyperf',
-        'author': 'Victor Stinner',
-        'author_email': 'vstin...@redhat.com',
-        'classifiers': CLASSIFIERS,
-        'packages': ['pyperf', 'pyperf.tests'],
-        'install_requires': [],
-        # don't use environment markers in install_requires, but use weird
-        # syntax of extras_require, to support setuptools 18
-        'entry_points': {
-            'console_scripts': ['pyperf=pyperf.__main__:main']
-        }
-        # Optional dependencies:
-        # 'psutil'
-    }
-    setup(**options)
-
-
-if __name__ == '__main__':
-    main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/test-requirements.txt 
new/pyperf-2.6.2/test-requirements.txt
--- old/pyperf-2.5.0/test-requirements.txt      2022-11-04 15:25:18.000000000 
+0100
+++ new/pyperf-2.6.2/test-requirements.txt      1970-01-01 01:00:00.000000000 
+0100
@@ -1 +0,0 @@
-psutil; platform_python_implementation != "PyPy"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyperf-2.5.0/tox.ini new/pyperf-2.6.2/tox.ini
--- old/pyperf-2.5.0/tox.ini    2022-11-04 15:25:18.000000000 +0100
+++ new/pyperf-2.6.2/tox.ini    2023-11-02 16:16:47.000000000 +0100
@@ -1,8 +1,9 @@
 [tox]
 envlist = py3, pypy3, doc, pep8
+isolated_build = True
 
 [testenv]
-deps=-r test-requirements.txt
+extras=dev
 commands=
     python -bb -Wd -m unittest discover -s pyperf/tests/ -v
 

Reply via email to