Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-lazy-loader for 
openSUSE:Factory checked in at 2023-12-08 22:32:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-lazy-loader (Old)
 and      /work/SRC/openSUSE:Factory/.python-lazy-loader.new.25432 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-lazy-loader"

Fri Dec  8 22:32:11 2023 rev:2 rq:1131739 version:0.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-lazy-loader/python-lazy-loader.changes    
2023-04-03 17:46:39.918016380 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-lazy-loader.new.25432/python-lazy-loader.changes
 2023-12-08 22:32:42.113431470 +0100
@@ -1,0 +2,13 @@
+Thu Dec  7 22:42:50 UTC 2023 - Dirk Müller <[email protected]>
+
+- update to 0.3:
+  * Announce Python 3.12 support
+  * Ignore B028
+  * Use dependabot to update requirements
+  * Use dependabot to update GH actions
+  * Use ruff
+  * Update requirements
+  * Warn and discourage lazy.load of subpackages
+  * Test on Python 3.12.0-beta.2
+
+-------------------------------------------------------------------

Old:
----
  lazy_loader-0.2.tar.gz

New:
----
  lazy_loader-0.3.tar.gz

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

Other differences:
------------------
++++++ python-lazy-loader.spec ++++++
--- /var/tmp/diff_new_pack.rzpNNt/_old  2023-12-08 22:32:42.557447807 +0100
+++ /var/tmp/diff_new_pack.rzpNNt/_new  2023-12-08 22:32:42.557447807 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           python-lazy-loader
-Version:        0.2
+Version:        0.3
 Release:        0
 Summary:        Populate library namespace without incurring immediate import 
costs
 License:        BSD-3-Clause

++++++ lazy_loader-0.2.tar.gz -> lazy_loader-0.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lazy_loader-0.2/.flake8 new/lazy_loader-0.3/.flake8
--- old/lazy_loader-0.2/.flake8 2022-08-29 14:38:20.243086600 +0200
+++ new/lazy_loader-0.3/.flake8 1970-01-01 01:00:00.000000000 +0100
@@ -1,16 +0,0 @@
-# See:
-#
-# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes  (E, W)
-# https://flake8.pycqa.org/en/latest/user/error-codes.html (F)
-# https://github.com/PyCQA/flake8-bugbear
-#
-# for error codes.  And
-#
-# 
https://flake8.pycqa.org/en/latest/user/violations.html#selecting-violations-with-flake8
-#
-# for error classes selected below.
-
-[flake8]
-max-line-length = 88
-select = C,E,F,W,B,B950
-ignore = E501, W503
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lazy_loader-0.2/.github/dependabot.yml 
new/lazy_loader-0.3/.github/dependabot.yml
--- old/lazy_loader-0.2/.github/dependabot.yml  1970-01-01 01:00:00.000000000 
+0100
+++ new/lazy_loader-0.3/.github/dependabot.yml  2023-06-28 03:54:21.971546200 
+0200
@@ -0,0 +1,10 @@
+version: 2
+updates:
+  - package-ecosystem: "github-actions"
+    directory: "/"
+    schedule:
+      interval: "monthly"
+  - package-ecosystem: "pip"
+    directory: "/"
+    schedule:
+      interval: "monthly"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lazy_loader-0.2/.github/workflows/test.yml 
new/lazy_loader-0.3/.github/workflows/test.yml
--- old/lazy_loader-0.2/.github/workflows/test.yml      2023-03-11 
01:04:48.471309200 +0100
+++ new/lazy_loader-0.3/.github/workflows/test.yml      2023-06-27 
21:28:19.549616300 +0200
@@ -9,7 +9,16 @@
       matrix:
         os: [ubuntu, macos, windows]
         python-version:
-          ["3.7", "3.8", "3.9", "3.10", "3.11", "pypy-3.8", "pypy-3.9"]
+          [
+            "3.7",
+            "3.8",
+            "3.9",
+            "3.10",
+            "3.11",
+            "3.12-dev",
+            "pypy-3.8",
+            "pypy-3.9",
+          ]
 
     steps:
       - uses: actions/checkout@v3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lazy_loader-0.2/.pre-commit-config.yaml 
new/lazy_loader-0.3/.pre-commit-config.yaml
--- old/lazy_loader-0.2/.pre-commit-config.yaml 2023-03-11 00:56:36.092310700 
+0100
+++ new/lazy_loader-0.3/.pre-commit-config.yaml 2023-06-28 03:54:21.971546200 
+0200
@@ -3,7 +3,7 @@
 
 repos:
   - repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v4.4.0
+    rev: f71fa2c1f9cf5cb705f73dffe4b21f7c61470ba9 # v4.4.0
     hooks:
       - id: trailing-whitespace
       - id: end-of-file-fixer
@@ -15,27 +15,21 @@
       - id: check-json
       - id: check-toml
       - id: check-added-large-files
-  - repo: https://github.com/psf/black
-    rev: 23.1.0
-    hooks:
-      - id: black
-  - repo: https://github.com/pycqa/flake8
-    rev: 6.0.0
-    hooks:
-      - id: flake8
-        pass_filenames: true
-  - repo: https://github.com/pycqa/isort
-    rev: 5.12.0
-    hooks:
-      - id: isort
-  - repo: https://github.com/asottile/pyupgrade
-    rev: v3.3.1
-    hooks:
-      - id: pyupgrade
-        args: [--py38-plus]
+
   - repo: https://github.com/pre-commit/mirrors-prettier
-    rev: v2.7.1
+    rev: 50c5478ed9e10bf360335449280cf2a67f4edb7a # v2.7.1
     hooks:
       - id: prettier
         files: \.(html|md|yml|yaml|toml)
         args: [--prose-wrap=preserve]
+
+  - repo: https://github.com/psf/black
+    rev: bf7a16254ec96b084a6caf3d435ec18f0f245cc7 # 23.3.0
+    hooks:
+      - id: black
+
+  - repo: https://github.com/astral-sh/ruff-pre-commit
+    rev: 1ac904bbe451ef0b5a437d1d3b331a244c1f272c # v0.0.275
+    hooks:
+      - id: ruff
+        args: [--fix, --exit-non-zero-on-fix]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lazy_loader-0.2/CHANGELOG.md 
new/lazy_loader-0.3/CHANGELOG.md
--- old/lazy_loader-0.2/CHANGELOG.md    2023-03-21 17:23:19.928018600 +0100
+++ new/lazy_loader-0.3/CHANGELOG.md    2023-06-30 23:04:45.684111000 +0200
@@ -1,6 +1,21 @@
 # Changelog
 
-## [v0.2rc0](https://github.com/scientific-python/lazy_loader/tree/v0.2)
+## [v0.3](https://github.com/scientific-python/lazy_loader/tree/v0.3) 
(2023-06-30)
+
+[Full 
Changelog](https://github.com/scientific-python/lazy_loader/compare/v0.2...v0.3)
+
+**Merged pull requests:**
+
+- Announce Python 3.12 support 
[\#63](https://github.com/scientific-python/lazy_loader/pull/63) 
([jarrodmillman](https://github.com/jarrodmillman))
+- Ignore B028 [\#62](https://github.com/scientific-python/lazy_loader/pull/62) 
([jarrodmillman](https://github.com/jarrodmillman))
+- Use dependabot to update requirements 
[\#61](https://github.com/scientific-python/lazy_loader/pull/61) 
([jarrodmillman](https://github.com/jarrodmillman))
+- Use dependabot to update GH actions 
[\#60](https://github.com/scientific-python/lazy_loader/pull/60) 
([jarrodmillman](https://github.com/jarrodmillman))
+- Use ruff [\#59](https://github.com/scientific-python/lazy_loader/pull/59) 
([jarrodmillman](https://github.com/jarrodmillman))
+- Update requirements 
[\#58](https://github.com/scientific-python/lazy_loader/pull/58) 
([jarrodmillman](https://github.com/jarrodmillman))
+- Warn and discourage lazy.load of subpackages 
[\#57](https://github.com/scientific-python/lazy_loader/pull/57) 
([dschult](https://github.com/dschult))
+- Test on Python 3.12.0-beta.2 
[\#53](https://github.com/scientific-python/lazy_loader/pull/53) 
([jarrodmillman](https://github.com/jarrodmillman))
+
+## [v0.2](https://github.com/scientific-python/lazy_loader/tree/v0.2)
 
 [Full 
Changelog](https://github.com/scientific-python/lazy_loader/compare/v0.1...v0.2)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lazy_loader-0.2/PKG-INFO new/lazy_loader-0.3/PKG-INFO
--- old/lazy_loader-0.2/PKG-INFO        1970-01-01 01:00:00.000000000 +0100
+++ new/lazy_loader-0.3/PKG-INFO        1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: lazy_loader
-Version: 0.2
+Version: 0.3
 Summary: lazy_loader
 Author: Scientific Python Developers
 Requires-Python: >=3.7
@@ -13,9 +13,10 @@
 Classifier: Programming Language :: Python :: 3.9
 Classifier: Programming Language :: Python :: 3.10
 Classifier: Programming Language :: Python :: 3.11
-Requires-Dist: pre-commit >= 3.1 ; extra == "lint"
-Requires-Dist: pytest >= 7.2 ; extra == "test"
-Requires-Dist: pytest-cov >= 4.0 ; extra == "test"
+Classifier: Programming Language :: Python :: 3.12
+Requires-Dist: pre-commit >= 3.3 ; extra == "lint"
+Requires-Dist: pytest >= 7.4 ; extra == "test"
+Requires-Dist: pytest-cov >= 4.1 ; extra == "test"
 Project-URL: Home, https://scientific-python.org/specs/spec-0001/
 Project-URL: Source, https://github.com/scientific-python/lazy_loader
 Provides-Extra: lint
@@ -127,10 +128,16 @@
 Use `lazy.load` to lazily import external libraries:
 
 ```python
-linalg = lazy.load('scipy.linalg')  # `linalg` will only be loaded when 
accessed
+sp = lazy.load('scipy')  # `sp` will only be loaded when accessed
+sp.linalg.norm(...)
 ```
 
-You can also ask `lazy.load` to raise import errors as soon as it is called:
+_Note that lazily importing *sub*packages,
+i.e. `load('scipy.linalg')` will cause the package containing the
+subpackage to be imported immediately; thus, this usage is
+discouraged._
+
+You can ask `lazy.load` to raise import errors as soon as it is called:
 
 ```
 linalg = lazy.load('scipy.linalg', error_on_import=True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lazy_loader-0.2/README.md 
new/lazy_loader-0.3/README.md
--- old/lazy_loader-0.2/README.md       2023-03-17 00:49:10.428869500 +0100
+++ new/lazy_loader-0.3/README.md       2023-06-28 03:54:21.971546200 +0200
@@ -104,10 +104,16 @@
 Use `lazy.load` to lazily import external libraries:
 
 ```python
-linalg = lazy.load('scipy.linalg')  # `linalg` will only be loaded when 
accessed
+sp = lazy.load('scipy')  # `sp` will only be loaded when accessed
+sp.linalg.norm(...)
 ```
 
-You can also ask `lazy.load` to raise import errors as soon as it is called:
+_Note that lazily importing *sub*packages,
+i.e. `load('scipy.linalg')` will cause the package containing the
+subpackage to be imported immediately; thus, this usage is
+discouraged._
+
+You can ask `lazy.load` to raise import errors as soon as it is called:
 
 ```
 linalg = lazy.load('scipy.linalg', error_on_import=True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lazy_loader-0.2/lazy_loader/__init__.py 
new/lazy_loader-0.3/lazy_loader/__init__.py
--- old/lazy_loader-0.2/lazy_loader/__init__.py 2023-03-11 00:41:47.566938200 
+0100
+++ new/lazy_loader-0.3/lazy_loader/__init__.py 2023-06-28 03:54:21.972546000 
+0200
@@ -11,6 +11,7 @@
 import os
 import sys
 import types
+import warnings
 
 __all__ = ["attach", "load", "attach_stub"]
 
@@ -66,7 +67,7 @@
         attr: mod for mod, attrs in submod_attrs.items() for attr in attrs
     }
 
-    __all__ = list(sorted(submodules | attr_to_modules.keys()))
+    __all__ = sorted(submodules | attr_to_modules.keys())
 
     def __getattr__(name):
         if name in submodules:
@@ -121,26 +122,36 @@
     We often see the following pattern::
 
       def myfunc():
-          from numpy import linalg as la
-          la.norm(...)
+          import numpy as np
+          np.norm(...)
           ....
 
-    This is to prevent a module, in this case `numpy`, from being
-    imported at function definition time, since that can be slow.
+    Putting the import inside the function prevents, in this case,
+    `numpy`, from being imported at function definition time.
+    That saves time if `myfunc` ends up not being called.
 
-    This function provides a proxy module that, upon access, imports
+    This `load` function returns a proxy module that, upon access, imports
     the actual module.  So the idiom equivalent to the above example is::
 
-      la = lazy.load("numpy.linalg")
+      np = lazy.load("numpy")
 
       def myfunc():
-          la.norm(...)
+          np.norm(...)
           ....
 
     The initial import time is fast because the actual import is delayed
     until the first attribute is requested. The overall import time may
     decrease as well for users that don't make use of large portions
-    of the library.
+    of your library.
+
+    Warning
+    -------
+    While lazily loading *sub*packages technically works, it causes the
+    package (that contains the subpackage) to be eagerly loaded even
+    if the package is already lazily loaded.
+    So, you probably shouldn't use subpackages with this `load` feature.
+    Instead you should encourage the package maintainers to use the
+    `lazy_loader.attach` to make their subpackages load lazily.
 
     Parameters
     ----------
@@ -148,7 +159,7 @@
         The full name of the module or submodule to import.  For example::
 
           sp = lazy.load('scipy')  # import scipy as sp
-          spla = lazy.load('scipy.linalg')  # import scipy.linalg as spla
+
     error_on_import : bool
         Whether to postpone raising import errors until the module is accessed.
         If set to `True`, import errors are raised as soon as `load` is called.
@@ -165,6 +176,14 @@
     except KeyError:
         pass
 
+    if "." in fullname:
+        msg = (
+            "subpackages can technically be lazily loaded, but it causes the "
+            "package to be eagerly loaded even if it is already lazily loaded."
+            "So, you probably shouldn't use subpackages with this lazy 
feature."
+        )
+        warnings.warn(msg, RuntimeWarning)
+
     spec = importlib.util.find_spec(fullname)
     if spec is None:
         if error_on_import:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lazy_loader-0.2/lazy_loader/tests/test_lazy_loader.py 
new/lazy_loader-0.3/lazy_loader/tests/test_lazy_loader.py
--- old/lazy_loader-0.2/lazy_loader/tests/test_lazy_loader.py   2023-03-12 
07:38:52.685654000 +0100
+++ new/lazy_loader-0.3/lazy_loader/tests/test_lazy_loader.py   2023-06-28 
03:54:21.972546000 +0200
@@ -1,3 +1,4 @@
+import importlib
 import sys
 import types
 
@@ -15,18 +16,28 @@
     # poor-mans pytest.raises for testing errors on attribute access
     try:
         anything_not_real.pi
-        assert False  # Should not get here
+        raise AssertionError()  # Should not get here
     except ModuleNotFoundError:
         pass
     assert isinstance(anything_not_real, lazy.DelayedImportErrorModule)
     # see if it changes for second access
     try:
         anything_not_real.pi
-        assert False  # Should not get here
+        raise AssertionError()  # Should not get here
     except ModuleNotFoundError:
         pass
 
 
+def test_lazy_import_subpackages():
+    with pytest.warns(RuntimeWarning):
+        hp = lazy.load("html.parser")
+    assert "html" in sys.modules
+    assert type(sys.modules["html"]) == type(pytest)
+    assert isinstance(hp, importlib.util._LazyModule)
+    assert "html.parser" in sys.modules
+    assert sys.modules["html.parser"] == hp
+
+
 def test_lazy_import_impact_on_sys_modules():
     math = lazy.load("math")
     anything_not_real = lazy.load("anything_not_real")
@@ -56,7 +67,7 @@
     if isinstance(sp, lazy.DelayedImportErrorModule):
         try:
             sp.pi
-            assert False
+            raise AssertionError()
         except ModuleNotFoundError:
             pass
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lazy_loader-0.2/pyproject.toml 
new/lazy_loader-0.3/pyproject.toml
--- old/lazy_loader-0.2/pyproject.toml  2023-03-21 17:23:32.374067500 +0100
+++ new/lazy_loader-0.3/pyproject.toml  2023-06-30 23:08:43.595186200 +0200
@@ -4,7 +4,7 @@
 
 [project]
 name = "lazy_loader"
-version = "0.2"
+version = "0.3"
 requires-python = ">=3.7"
 authors = [{name = "Scientific Python Developers"}]
 readme = "README.md"
@@ -18,13 +18,14 @@
   "Programming Language :: Python :: 3.9",
   "Programming Language :: Python :: 3.10",
   "Programming Language :: Python :: 3.11",
+  "Programming Language :: Python :: 3.12",
 ]
 dynamic = ["description"]
 
 
 [project.optional-dependencies]
-test = ["pytest >= 7.2", "pytest-cov >= 4.0"]
-lint = ["pre-commit >= 3.1"]
+test = ["pytest >= 7.4", "pytest-cov >= 4.1"]
+lint = ["pre-commit >= 3.3"]
 
 [project.urls]
 Home = "https://scientific-python.org/specs/spec-0001/";
@@ -32,3 +33,20 @@
 
 [tool.flit.sdist]
 exclude = ["tests/*"]
+
+[tool.ruff]
+line-length = 88
+target-version = "py37"
+select = [
+    "C",
+    "E",
+    "F",
+    "W",
+    "B",
+    "I",
+    "UP",
+]
+ignore = ["B018", "B028"]
+exclude = [
+  "lazy_loader/tests/fake_pkg/__init__.pyi",
+]

Reply via email to