Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-smart-open for 
openSUSE:Factory checked in at 2024-05-03 19:45:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-smart-open (Old)
 and      /work/SRC/openSUSE:Factory/.python-smart-open.new.1880 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-smart-open"

Fri May  3 19:45:38 2024 rev:7 rq:1171471 version:7.0.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-smart-open/python-smart-open.changes      
2024-03-22 15:32:27.447051511 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-smart-open.new.1880/python-smart-open.changes
    2024-05-03 19:46:00.308025975 +0200
@@ -1,0 +2,11 @@
+Thu May  2 22:17:52 UTC 2024 - Dirk Müller <dmuel...@suse.com>
+
+- update to 7.0.4:
+  * Fix wb mode with zstd compression (PR #815, @djudd)
+  * Remove GCS bucket.exists call to avoid storage.buckets.get
+    permission (PR #813, @ddelange)
+  * add support for zst writing (PR #812, @mpenkov)
+  * roll back PR #812, restore compatibility with built-in open
+    function (@mpenkov)
+
+-------------------------------------------------------------------

Old:
----
  smart_open-7.0.2.tar.gz

New:
----
  smart_open-7.0.4.tar.gz

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

Other differences:
------------------
++++++ python-smart-open.spec ++++++
--- /var/tmp/diff_new_pack.n8MSCX/_old  2024-05-03 19:46:01.724077458 +0200
+++ /var/tmp/diff_new_pack.n8MSCX/_new  2024-05-03 19:46:01.724077458 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           python-smart-open
-Version:        7.0.2
+Version:        7.0.4
 Release:        0
 Summary:        Python utils for streaming large files
 License:        MIT

++++++ smart_open-7.0.2.tar.gz -> smart_open-7.0.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smart_open-7.0.2/CHANGELOG.md 
new/smart_open-7.0.4/CHANGELOG.md
--- old/smart_open-7.0.2/CHANGELOG.md   2024-03-21 05:17:40.000000000 +0100
+++ new/smart_open-7.0.4/CHANGELOG.md   2024-03-26 09:42:19.000000000 +0100
@@ -1,3 +1,13 @@
+# 7.0.4, 2024-03-26
+
+* Fix wb mode with zstd compression (PR 
[#815](https://github.com/piskvorky/smart_open/pull/815), 
[@djudd](https://github.com/djudd))
+* Remove GCS bucket.exists call to avoid storage.buckets.get permission (PR 
[#813](https://github.com/piskvorky/smart_open/pull/813), 
[@ddelange](https://github.com/ddelange))
+
+# 7.0.3, 2024-03-21
+
+* add support for zst writing (PR 
[#812](https://github.com/piskvorky/smart_open/pull/812), 
[@mpenkov](https://github.com/mpenkov))
+* roll back PR [#812](https://github.com/piskvorky/smart_open/pull/788), 
restore compatibility with built-in open function 
([@mpenkov](https://github.com/mpenkov))
+
 # 7.0.2, 2024-03-21
 
 * Add `__next__` method to FileLikeProxy (PR 
[#811](https://github.com/piskvorky/smart_open/pull/811), 
[@ddelange](https://github.com/ddelange))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smart_open-7.0.2/integration-tests/test_gcs.py 
new/smart_open-7.0.4/integration-tests/test_gcs.py
--- old/smart_open-7.0.2/integration-tests/test_gcs.py  2024-03-21 
05:17:40.000000000 +0100
+++ new/smart_open-7.0.4/integration-tests/test_gcs.py  2024-03-26 
09:42:19.000000000 +0100
@@ -28,9 +28,6 @@
     with smart_open.open(key, read_mode, **kwargs) as fin:
         return fin.read()
 
-def open_only(key, read_mode, **kwargs) -> None:
-    with smart_open.open(key, read_mode, **kwargs):
-        pass
 
 def read_length_prefixed_messages(key, read_mode, **kwargs):
     result = io.BytesIO()
@@ -124,10 +121,3 @@
 
     actual = benchmark(read_length_prefixed_messages, key, 'rb', 
buffering=ONE_MIB)
     assert actual == one_megabyte_of_msgs
-
-def test_gcs_performance_open(benchmark):
-    # we don't need to use a uri that actually exists in order to call GCS's 
open()
-    key = "gs://some-bucket/some_blob.txt"
-    transport_params = {'client': google.cloud.storage.Client()}
-    benchmark(open_only, key, 'rb', transport_params=transport_params)
-    assert True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smart_open-7.0.2/setup.py 
new/smart_open-7.0.4/setup.py
--- old/smart_open-7.0.2/setup.py       2024-03-21 05:17:40.000000000 +0100
+++ new/smart_open-7.0.4/setup.py       2024-03-26 09:42:19.000000000 +0100
@@ -50,7 +50,6 @@
     'boto3',
     'pytest',
     'pytest-rerunfailures',
-    'pytest-benchmark',
 ]
 
 setup(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smart_open-7.0.2/smart_open/compression.py 
new/smart_open-7.0.4/smart_open/compression.py
--- old/smart_open-7.0.2/smart_open/compression.py      2024-03-21 
05:17:40.000000000 +0100
+++ new/smart_open-7.0.4/smart_open/compression.py      2024-03-26 
09:42:19.000000000 +0100
@@ -6,6 +6,7 @@
 # from the MIT License (MIT).
 #
 """Implements the compression layer of the ``smart_open`` library."""
+import io
 import logging
 import os.path
 
@@ -106,8 +107,19 @@
 
 
 def _handle_zstd(file_obj, mode):
-    import zstandard as zstd
-    result = zstd.ZstdDecompressor().stream_reader(file_obj, closefd=True)
+    import zstandard  # type: ignore
+    result = zstandard.open(filename=file_obj, mode=mode)
+    # zstandard.open returns an io.TextIOWrapper in text mode, but otherwise
+    # returns a raw stream reader/writer, and we need the `io` wrapper
+    # to make FileLikeProxy work correctly.
+    #
+    # See:
+    #
+    # 
https://github.com/indygreg/python-zstandard/blob/d7d81e79dbe74feb22fb73405ebfb3e20f4c4653/zstandard/__init__.py#L169-L174
+    if "b" in mode and "w" in mode:
+        result = io.BufferedWriter(result)
+    elif "b" in mode and "r" in mode:
+        result = io.BufferedReader(result)
     return result
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smart_open-7.0.2/smart_open/gcs.py 
new/smart_open-7.0.4/smart_open/gcs.py
--- old/smart_open-7.0.2/smart_open/gcs.py      2024-03-21 05:17:40.000000000 
+0100
+++ new/smart_open-7.0.4/smart_open/gcs.py      2024-03-26 09:42:19.000000000 
+0100
@@ -128,7 +128,10 @@
         warn_deprecated('line_terminator')
 
     bkt = client.bucket(bucket)
-    blob = bkt.blob(key)
+    blob = bkt.get_blob(key)
+
+    if blob is None:
+        raise google.cloud.exceptions.NotFound(f'blob {key} not found in 
{bucket}')
 
     return blob.open('rb', **blob_open_kwargs)
 
@@ -149,11 +152,7 @@
 
     blob_open_kwargs = {**_DEFAULT_WRITE_OPEN_KWARGS, **blob_open_kwargs}
 
-    g_bucket = client.bucket(bucket)
-    if not g_bucket.exists():
-        raise google.cloud.exceptions.NotFound(f'bucket {bucket} not found')
-
-    g_blob = g_bucket.blob(
+    g_blob = client.bucket(bucket).blob(
         blob,
         chunk_size=min_part_size,
     )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smart_open-7.0.2/smart_open/tests/test_smart_open.py 
new/smart_open-7.0.4/smart_open/tests/test_smart_open.py
--- old/smart_open-7.0.2/smart_open/tests/test_smart_open.py    2024-03-21 
05:17:40.000000000 +0100
+++ new/smart_open-7.0.4/smart_open/tests/test_smart_open.py    2024-03-26 
09:42:19.000000000 +0100
@@ -77,6 +77,30 @@
             logger.error(e)
 
 
+def test_zst_write():
+    with named_temporary_file(suffix=".zst") as tmp:
+        with smart_open.open(tmp.name, "wt") as fout:
+            print("hello world", file=fout)
+            print("this is a test", file=fout)
+
+        with smart_open.open(tmp.name, "rt") as fin:
+            got = list(fin)
+
+    assert got == ["hello world\n", "this is a test\n"]
+
+
+def test_zst_write_binary():
+    with named_temporary_file(suffix=".zst") as tmp:
+        with smart_open.open(tmp.name, "wb") as fout:
+            fout.write(b"hello world\n")
+            fout.write(b"this is a test\n")
+
+        with smart_open.open(tmp.name, "rb") as fin:
+            got = list(fin)
+
+    assert got == [b"hello world\n", b"this is a test\n"]
+
+
 class ParseUriTest(unittest.TestCase):
     """
     Test ParseUri class.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/smart_open-7.0.2/smart_open/version.py 
new/smart_open-7.0.4/smart_open/version.py
--- old/smart_open-7.0.2/smart_open/version.py  2024-03-21 05:17:40.000000000 
+0100
+++ new/smart_open-7.0.4/smart_open/version.py  2024-03-26 09:42:19.000000000 
+0100
@@ -1,4 +1,4 @@
-__version__ = '7.0.2'
+__version__ = '7.0.4'
 
 
 if __name__ == '__main__':

Reply via email to