Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-param for openSUSE:Factory 
checked in at 2024-01-21 23:09:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-param (Old)
 and      /work/SRC/openSUSE:Factory/.python-param.new.16006 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-param"

Sun Jan 21 23:09:24 2024 rev:26 rq:1140199 version:2.0.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-param/python-param.changes        
2023-12-17 21:34:41.642749323 +0100
+++ /work/SRC/openSUSE:Factory/.python-param.new.16006/python-param.changes     
2024-01-21 23:09:50.496754012 +0100
@@ -1,0 +2,8 @@
+Sat Jan 20 19:27:34 UTC 2024 - Dirk Müller <dmuel...@suse.com>
+
+- update to 2.0.2:
+  * Minor optimizations in hot codepaths accessing class parameters
+  * Unpack partial callables in iscoroutinefunction
+  * Fix building Param with setuptools-scm<7
+
+-------------------------------------------------------------------

Old:
----
  param-2.0.1.tar.gz

New:
----
  param-2.0.2.tar.gz

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

Other differences:
------------------
++++++ python-param.spec ++++++
--- /var/tmp/diff_new_pack.5t85Kx/_old  2024-01-21 23:09:51.060774572 +0100
+++ /var/tmp/diff_new_pack.5t85Kx/_new  2024-01-21 23:09:51.060774572 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-param
 #
-# Copyright (c) 2023 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
@@ -18,7 +18,7 @@
 
 %define modname param
 Name:           python-param
-Version:        2.0.1
+Version:        2.0.2
 Release:        0
 Summary:        Declarative Python programming using Parameters
 License:        BSD-3-Clause

++++++ param-2.0.1.tar.gz -> param-2.0.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/param-2.0.1/PKG-INFO new/param-2.0.2/PKG-INFO
--- old/param-2.0.1/PKG-INFO    2020-02-02 01:00:00.000000000 +0100
+++ new/param-2.0.2/PKG-INFO    2020-02-02 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: param
-Version: 2.0.1
+Version: 2.0.2
 Summary: Make your Python code clearer and more reliable by declaring 
Parameters.
 Project-URL: Homepage, https://param.holoviz.org/
 Project-URL: Tracker, https://github.com/holoviz/param/issues
@@ -31,7 +31,7 @@
 Requires-Dist: param[lint]; extra == 'all'
 Requires-Dist: param[tests-full]; extra == 'all'
 Provides-Extra: doc
-Requires-Dist: nbsite==0.8.2; extra == 'doc'
+Requires-Dist: nbsite==0.8.4; extra == 'doc'
 Requires-Dist: param[examples]; extra == 'doc'
 Requires-Dist: sphinx-remove-toctrees; extra == 'doc'
 Provides-Extra: examples
@@ -74,7 +74,7 @@
 
 |    |    |
 | --- | --- |
-| Build Status | [![Linux/MacOS/Windows Build 
Status](https://github.com/holoviz/param/workflows/pytest/badge.svg)](https://github.com/holoviz/param/actions/workflows/test.yml)
+| Build Status | [![Linux/MacOS/Windows Build 
Status](https://github.com/holoviz/param/workflows/tests/badge.svg)](https://github.com/holoviz/param/actions/workflows/test.yaml)
 | Coverage | 
[![codecov](https://codecov.io/gh/holoviz/param/branch/main/graph/badge.svg)](https://codecov.io/gh/holoviz/param)
 ||
 | Latest dev release | [![Github 
tag](https://img.shields.io/github/v/tag/holoviz/param.svg?label=tag&colorB=11ccbb)](https://github.com/holoviz/param/tags)
 
[![dev-site](https://img.shields.io/website-up-down-green-red/https/holoviz-dev.github.io/param.svg?label=dev%20website)](https://holoviz-dev.github.io/param/)
 |
 | Latest release | [![Github 
release](https://img.shields.io/github/release/holoviz/param.svg?label=tag&colorB=11ccbb)](https://github.com/holoviz/param/releases)
 [![PyPI 
version](https://img.shields.io/pypi/v/param.svg?colorB=cc77dd)](https://pypi.python.org/pypi/param)
 [![param 
version](https://img.shields.io/conda/v/pyviz/param.svg?colorB=4488ff&style=flat)](https://anaconda.org/pyviz/param)
 [![conda-forge 
version](https://img.shields.io/conda/v/conda-forge/param.svg?label=conda%7Cconda-forge&colorB=4488ff)](https://anaconda.org/conda-forge/param)
 [![defaults 
version](https://img.shields.io/conda/v/anaconda/param.svg?label=conda%7Cdefaults&style=flat&colorB=4488ff)](https://anaconda.org/anaconda/param)
 |
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/param-2.0.1/README.md new/param-2.0.2/README.md
--- old/param-2.0.1/README.md   2020-02-02 01:00:00.000000000 +0100
+++ new/param-2.0.2/README.md   2020-02-02 01:00:00.000000000 +0100
@@ -2,7 +2,7 @@
 
 |    |    |
 | --- | --- |
-| Build Status | [![Linux/MacOS/Windows Build 
Status](https://github.com/holoviz/param/workflows/pytest/badge.svg)](https://github.com/holoviz/param/actions/workflows/test.yml)
+| Build Status | [![Linux/MacOS/Windows Build 
Status](https://github.com/holoviz/param/workflows/tests/badge.svg)](https://github.com/holoviz/param/actions/workflows/test.yaml)
 | Coverage | 
[![codecov](https://codecov.io/gh/holoviz/param/branch/main/graph/badge.svg)](https://codecov.io/gh/holoviz/param)
 ||
 | Latest dev release | [![Github 
tag](https://img.shields.io/github/v/tag/holoviz/param.svg?label=tag&colorB=11ccbb)](https://github.com/holoviz/param/tags)
 
[![dev-site](https://img.shields.io/website-up-down-green-red/https/holoviz-dev.github.io/param.svg?label=dev%20website)](https://holoviz-dev.github.io/param/)
 |
 | Latest release | [![Github 
release](https://img.shields.io/github/release/holoviz/param.svg?label=tag&colorB=11ccbb)](https://github.com/holoviz/param/releases)
 [![PyPI 
version](https://img.shields.io/pypi/v/param.svg?colorB=cc77dd)](https://pypi.python.org/pypi/param)
 [![param 
version](https://img.shields.io/conda/v/pyviz/param.svg?colorB=4488ff&style=flat)](https://anaconda.org/pyviz/param)
 [![conda-forge 
version](https://img.shields.io/conda/v/conda-forge/param.svg?label=conda%7Cconda-forge&colorB=4488ff)](https://anaconda.org/conda-forge/param)
 [![defaults 
version](https://img.shields.io/conda/v/anaconda/param.svg?label=conda%7Cdefaults&style=flat&colorB=4488ff)](https://anaconda.org/anaconda/param)
 |
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/param-2.0.1/param/__init__.py 
new/param-2.0.2/param/__init__.py
--- old/param-2.0.1/param/__init__.py   2020-02-02 01:00:00.000000000 +0100
+++ new/param-2.0.2/param/__init__.py   2020-02-02 01:00:00.000000000 +0100
@@ -90,11 +90,23 @@
 except (ImportError, LookupError, FileNotFoundError):
     # As a fallback, use the version that is hard-coded in the file.
     try:
-        from ._version import __version__
-    except ModuleNotFoundError:
-        # The user is probably trying to run this without having installed
-        # the package.
-        __version__ = "0.0.0+unknown"
+        # __version__ was added in _version in setuptools-scm 7.0.0, we rely on
+        # the hopefully stable version variable.
+        from ._version import version as __version__
+    except (ModuleNotFoundError, ImportError):
+        # Either _version doesn't exist (ModuleNotFoundError) or version isn't
+        # in _version (ImportError). ModuleNotFoundError is a subclass of
+        # ImportError, let's be explicit anyway.
+
+        # Try something else:
+        from importlib.metadata import version as mversion, 
PackageNotFoundError
+
+        try:
+            __version__ = mversion("param")
+        except PackageNotFoundError:
+            # The user is probably trying to run this without having installed
+            # the package.
+            __version__ = "0.0.0+unknown"
 
 #: Top-level object to allow messaging not tied to a particular
 #: Parameterized object, as in 'param.main.warning("Invalid option")'.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/param-2.0.1/param/_utils.py 
new/param-2.0.2/param/_utils.py
--- old/param-2.0.1/param/_utils.py     2020-02-02 01:00:00.000000000 +0100
+++ new/param-2.0.2/param/_utils.py     2020-02-02 01:00:00.000000000 +0100
@@ -208,18 +208,16 @@
 
 def iscoroutinefunction(function):
     """
-    Whether the function is an asynchronous coroutine function.
+    Whether the function is an asynchronous generator or a coroutine.
     """
-    if not hasattr(inspect, 'iscoroutinefunction'):
-        return False
-    import asyncio
-    try:
-        return (
-            inspect.isasyncgenfunction(function) or
-            asyncio.iscoroutinefunction(function)
-        )
-    except AttributeError:
-        return False
+    # Partial unwrapping not required starting from Python 3.11.0
+    # See https://github.com/holoviz/param/pull/894#issuecomment-1867084447
+    while isinstance(function, functools.partial):
+        function = function.func
+    return (
+        inspect.isasyncgenfunction(function) or
+        inspect.iscoroutinefunction(function)
+    )
 
 
 def flatten(line):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/param-2.0.1/param/_version.py 
new/param-2.0.2/param/_version.py
--- old/param-2.0.1/param/_version.py   2020-02-02 01:00:00.000000000 +0100
+++ new/param-2.0.2/param/_version.py   2020-02-02 01:00:00.000000000 +0100
@@ -12,5 +12,5 @@
 __version_tuple__: VERSION_TUPLE
 version_tuple: VERSION_TUPLE
 
-__version__ = version = '2.0.1'
-__version_tuple__ = version_tuple = (2, 0, 1)
+__version__ = version = '2.0.2'
+__version_tuple__ = version_tuple = (2, 0, 2)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/param-2.0.1/param/parameterized.py 
new/param-2.0.2/param/parameterized.py
--- old/param-2.0.1/param/parameterized.py      2020-02-02 01:00:00.000000000 
+0100
+++ new/param-2.0.2/param/parameterized.py      2020-02-02 01:00:00.000000000 
+0100
@@ -1849,24 +1849,25 @@
         Returns the class or instance parameter
         """
         inst = self_.self
-        params = self_ if inst is None else inst.param
-        p = params.objects(False)[key]
-        return p if inst is None else _instantiated_parameter(inst, p)
+        if inst is None:
+            return self_._cls_parameters[key]
+        p = self_.objects(instance=False)[key]
+        return _instantiated_parameter(inst, p)
 
     def __dir__(self_):
         """
         Adds parameters to dir
         """
-        return super().__dir__() + list(self_)
+        return super().__dir__() + list(self_._cls_parameters)
 
     def __iter__(self_):
         """
         Iterates over the parameters on this object.
         """
-        yield from self_.objects(instance=False)
+        yield from self_._cls_parameters
 
     def __contains__(self_, param):
-        return param in list(self_)
+        return param in self_._cls_parameters
 
     def __getattr__(self_, attr):
         """
@@ -1876,12 +1877,7 @@
         if cls is None: # Class not initialized
             raise AttributeError
 
-        params = list(cls._param__private.params)
-        if not params:
-            params = [n for class_ in classlist(cls) for n, v in 
class_.__dict__.items()
-                      if isinstance(v, Parameter)]
-
-        if attr in params:
+        if attr in self_._cls_parameters:
             return self_.__getitem__(attr)
         elif self_.self is None:
             raise AttributeError(f"type object '{self_.cls.__name__}.param' 
has no attribute {attr!r}")
@@ -1914,7 +1910,8 @@
         ## Deepcopy all 'instantiate=True' parameters
         params_to_deepcopy = {}
         params_to_ref = {}
-        for pname, p in self_.objects(instance=False).items():
+        objects = self_._cls_parameters
+        for pname, p in objects.items():
             if p.instantiate and pname != "name":
                 params_to_deepcopy[pname] = p
             elif p.constant and pname != 'name':
@@ -1927,7 +1924,6 @@
 
         ## keyword arg setting
         deps, refs = {}, {}
-        objects = self.param.objects(instance=False)
         for name, val in params.items():
             desc = self_.cls.get_param_descriptor(name)[0] # pylint: 
disable-msg=E1101
             if not desc:
@@ -2235,8 +2231,8 @@
         # would need to handle the params() cache as well
         # (which is tricky but important for startup speed).
         cls = self_.cls
-        type.__setattr__(cls,param_name,param_obj)
-        ParameterizedMetaclass._initialize_parameter(cls,param_name,param_obj)
+        type.__setattr__(cls, param_name, param_obj)
+        ParameterizedMetaclass._initialize_parameter(cls, param_name, 
param_obj)
         # delete cached params()
         cls._param__private.params.clear()
 
@@ -2352,6 +2348,31 @@
                                  (self_or_cls.name))
         return self_.update(kwargs)
 
+    @property
+    def _cls_parameters(self_):
+        """
+        Class parameters are cached because they are accessed often,
+        and parameters are rarely added (and cannot be deleted)
+        """
+        cls = self_.cls
+        pdict = cls._param__private.params
+        if pdict:
+            return pdict
+
+        paramdict = {}
+        for class_ in classlist(cls):
+            for name, val in class_.__dict__.items():
+                if isinstance(val, Parameter):
+                    paramdict[name] = val
+
+        # We only want the cache to be visible to the cls on which
+        # params() is called, so we mangle the name ourselves at
+        # runtime (if we were to mangle it now, it would be
+        # _Parameterized.__params for all classes).
+        # cls._param__private.params[f'_{cls.__name__}__params'] = paramdict
+        cls._param__private.params = paramdict
+        return paramdict
+
     def objects(self_, instance=True):
         """
         Returns the Parameters of this instance or class
@@ -2376,25 +2397,7 @@
                 stacklevel=2,
             )
 
-        cls = self_.cls
-        # We cache the parameters because this method is called often,
-        # and parameters are rarely added (and cannot be deleted)
-        pdict = cls._param__private.params
-        if not pdict:
-            paramdict = {}
-            for class_ in classlist(cls):
-                for name, val in class_.__dict__.items():
-                    if isinstance(val, Parameter):
-                        paramdict[name] = val
-
-            # We only want the cache to be visible to the cls on which
-            # params() is called, so we mangle the name ourselves at
-            # runtime (if we were to mangle it now, it would be
-            # _Parameterized.__params for all classes).
-            # cls._param__private.params[f'_{cls.__name__}__params'] = 
paramdict
-            cls._param__private.params = paramdict
-            pdict = paramdict
-
+        pdict = self_._cls_parameters
         if instance and self_.self is not None:
             if instance == 'existing':
                 if getattr(self_.self._param__private, 'initialized', False) 
and self_.self._param__private.params:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/param-2.0.1/pyproject.toml 
new/param-2.0.2/pyproject.toml
--- old/param-2.0.1/pyproject.toml      2020-02-02 01:00:00.000000000 +0100
+++ new/param-2.0.2/pyproject.toml      2020-02-02 01:00:00.000000000 +0100
@@ -41,7 +41,7 @@
 ]
 doc = [
     "param[examples]",
-    "nbsite ==0.8.2",
+    "nbsite ==0.8.4",
     "sphinx-remove-toctrees",
 ]
 tests = [
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/param-2.0.1/tests/testutils.py 
new/param-2.0.2/tests/testutils.py
--- old/param-2.0.1/tests/testutils.py  2020-02-02 01:00:00.000000000 +0100
+++ new/param-2.0.2/tests/testutils.py  2020-02-02 01:00:00.000000000 +0100
@@ -1,12 +1,14 @@
 import datetime as dt
 import os
 
+from functools import partial
+
 import param
 import pytest
 
 from param import guess_param_types, resolve_path
 from param.parameterized import bothmethod
-from param._utils import _is_mutable_container
+from param._utils import _is_mutable_container, iscoroutinefunction
 
 
 try:
@@ -393,3 +395,29 @@
 )
 def test__is_mutable_container(obj, ismutable):
     assert _is_mutable_container(obj) is ismutable
+
+
+async def coro():
+    return
+
+
+def test_iscoroutinefunction_coroutine():
+    assert iscoroutinefunction(coro)
+
+
+def test_iscoroutinefunction_partial_coroutine():
+    pcoro = partial(partial(coro))
+    assert iscoroutinefunction(pcoro)
+
+
+async def agen():
+    yield
+
+
+def test_iscoroutinefunction_asyncgen():
+    assert iscoroutinefunction(agen)
+
+
+def test_iscoroutinefunction_partial_asyncgen():
+    pagen = partial(partial(agen))
+    assert iscoroutinefunction(pagen)

Reply via email to