Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-minio for openSUSE:Factory checked in at 2023-03-27 18:16:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-minio (Old) and /work/SRC/openSUSE:Factory/.python-minio.new.31432 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-minio" Mon Mar 27 18:16:11 2023 rev:18 rq:1074502 version:7.1.14 Changes: -------- --- /work/SRC/openSUSE:Factory/python-minio/python-minio.changes 2023-01-07 17:23:17.003433480 +0100 +++ /work/SRC/openSUSE:Factory/.python-minio.new.31432/python-minio.changes 2023-03-27 18:16:13.823090814 +0200 @@ -1,0 +2,9 @@ +Sun Mar 26 19:18:41 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 7.1.14: + * Have single GitHub workflow YAML + * fget_object(): create tmp_file_path string generically + * Add upload_snowball_objects() API + * checks: ignore broad-exception-raised pylint error + +------------------------------------------------------------------- Old: ---- minio-7.1.13.tar.gz New: ---- minio-7.1.14.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-minio.spec ++++++ --- /var/tmp/diff_new_pack.7exAh1/_old 2023-03-27 18:16:14.323093452 +0200 +++ /var/tmp/diff_new_pack.7exAh1/_new 2023-03-27 18:16:14.327093473 +0200 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-minio -Version: 7.1.13 +Version: 7.1.14 Release: 0 Summary: Minio library for Amazon S3 compatible cloud storage License: Apache-2.0 ++++++ minio-7.1.13.tar.gz -> minio-7.1.14.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-7.1.13/PKG-INFO new/minio-7.1.14/PKG-INFO --- old/minio-7.1.13/PKG-INFO 2023-01-07 09:25:24.317450800 +0100 +++ new/minio-7.1.14/PKG-INFO 2023-03-24 06:43:31.524150600 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: minio -Version: 7.1.13 +Version: 7.1.14 Summary: MinIO Python SDK for Amazon S3 Compatible Cloud Storage Home-page: https://github.com/minio/minio-py Download-URL: https://github.com/minio/minio-py/releases diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-7.1.13/docs/API.md new/minio-7.1.14/docs/API.md --- old/minio-7.1.13/docs/API.md 2023-01-07 09:22:52.000000000 +0100 +++ new/minio-7.1.14/docs/API.md 2023-03-24 06:41:57.000000000 +0100 @@ -84,7 +84,7 @@ | [`delete_bucket_notification`](#delete_bucket_notification) | [`presigned_put_object`](#presigned_put_object) | | [`get_bucket_notification`](#get_bucket_notification) | [`presigned_post_policy`](#presigned_post_policy) | | [`set_bucket_notification`](#set_bucket_notification) | [`get_presigned_url`](#get_presigned_url) | -| [`listen_bucket_notification`](#listen_bucket_notification) | | +| [`listen_bucket_notification`](#listen_bucket_notification) | [`upload_snowball_objects`](#upload_snowball_objects) | | [`delete_bucket_encryption`](#delete_bucket_encryption) | | | [`get_bucket_encryption`](#get_bucket_encryption) | | | [`set_bucket_encryption`](#set_bucket_encryption) | | @@ -1847,6 +1847,51 @@ print(url) ``` +<a name="upload_snowball_objects"></a> + +### upload_snowball_objects(bucket_name, object_list, metadata=None, sse=None, tags=None, retention=None, legal_hold=False, staging_filename=None, compression=False) + +Uploads multiple objects in a single put call. It is done by creating intermediate TAR file optionally compressed which is uploaded to S3 service. + +__Parameters__ + +| Param | Type | Description | +|:-------------------|:------------|:------------------------------------------------------------------------| +| `bucket_name` | _str_ | Name of the bucket. | +| `object_list` | _iterable_ | An iterable containing :class:`SnowballObject <SnowballObject>` object. | +| `metadata` | _dict_ | Any additional metadata to be uploaded along with your PUT request. | +| `sse` | _Sse_ | Server-side encryption. | +| `tags` | _Tags_ | Tags for the object. | +| `retention` | _Retention_ | Retention configuration. | +| `legal_hold` | _bool_ | Flag to set legal hold for the object. | +| `staging_filename` | _str_ | A staging filename to create intermediate tarball. | +| `compression` | _bool_ | Flag to compress tarball. | + +__Return Value__ + +| Return | +|:----------------------------| +| _ObjectWriteResult_ object. | + +__Example__ + +```py +# Upload snowball object. +client.upload_snowball_objects( + "my-bucket", + [ + SnowballObject("my-object1", filename="/etc/hostname"), + SnowballObject( + "my-object2", data=io.BytesIO("hello"), length=5, + ), + SnowballObject( + "my-object3", data=io.BytesIO("world"), length=5, + mod_time=datetime.now(), + ), + ], +) +``` + ## 5. Explore Further - [MinIO Golang Client SDK Quickstart Guide](https://min.io/docs/minio/linux/developers/go/minio-go.html) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-7.1.13/examples/upload_snowball_objects.py new/minio-7.1.14/examples/upload_snowball_objects.py --- old/minio-7.1.13/examples/upload_snowball_objects.py 1970-01-01 01:00:00.000000000 +0100 +++ new/minio-7.1.14/examples/upload_snowball_objects.py 2023-03-24 06:41:57.000000000 +0100 @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# MinIO Python Library for Amazon S3 Compatible Cloud Storage, +# (C) 2023 MinIO, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import io +from datetime import datetime + +from minio import Minio +from minio.commonconfig import SnowballObject + +client = Minio( + "play.min.io", + access_key="Q3AM3UQ867SPQQA43P2F", + secret_key="zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG", +) + +client.upload_snowball_objects( + "my-bucket", + [ + SnowballObject("my-object1", filename="/etc/hostname"), + SnowballObject( + "my-object2", data=io.BytesIO("hello"), length=5, + ), + SnowballObject( + "my-object3", data=io.BytesIO("world"), length=5, + mod_time=datetime.now(), + ), + ], +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-7.1.13/minio/__init__.py new/minio-7.1.14/minio/__init__.py --- old/minio-7.1.13/minio/__init__.py 2023-01-07 09:22:52.000000000 +0100 +++ new/minio-7.1.14/minio/__init__.py 2023-03-24 06:41:57.000000000 +0100 @@ -33,7 +33,7 @@ __title__ = "minio-py" __author__ = "MinIO, Inc." -__version__ = "7.1.13" +__version__ = "7.1.14" __license__ = "Apache 2.0" __copyright__ = "Copyright 2015, 2016, 2017, 2018, 2019, 2020 MinIO, Inc." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-7.1.13/minio/api.py new/minio-7.1.14/minio/api.py --- old/minio-7.1.13/minio/api.py 2023-01-07 09:22:52.000000000 +0100 +++ new/minio-7.1.14/minio/api.py 2023-03-24 06:41:57.000000000 +0100 @@ -26,7 +26,10 @@ import itertools import os import platform +import tarfile from datetime import timedelta +from io import BytesIO +from random import random from threading import Thread from urllib.parse import urlunsplit from xml.etree import ElementTree as ET @@ -1047,9 +1050,7 @@ ) # Write to a temporary file "file_path.part.minio" before saving. - tmp_file_path = ( - tmp_file_path or file_path + "." + stat.etag + ".part.minio" - ) + tmp_file_path = tmp_file_path or f"{file_path}.{stat.etag}.part.minio" response = None try: @@ -2676,6 +2677,79 @@ query_params=query_params, ) + def upload_snowball_objects(self, bucket_name, object_list, metadata=None, + sse=None, tags=None, retention=None, + legal_hold=False, staging_filename=None, + compression=False): + """ + Uploads multiple objects in a single put call. It is done by creating + intermediate TAR file optionally compressed which is uploaded to S3 + service. + + :param bucket_name: Name of the bucket. + :param object_list: An iterable containing + :class:`SnowballObject <SnowballObject>` object. + :param metadata: Any additional metadata to be uploaded along + with your PUT request. + :param sse: Server-side encryption. + :param tags: :class:`Tags` for the object. + :param retention: :class:`Retention` configuration object. + :param legal_hold: Flag to set legal hold for the object. + :param staging_filename: A staging filename to create intermediate + tarball. + :param compression: Flag to compress TAR ball. + :return: :class:`ObjectWriteResult` object. + + Example:: + # Upload snowball object. + result = client.upload_snowball_objects( + "my-bucket", + [ + SnowballObject("my-object1", filename="/etc/hostname"), + SnowballObject( + "my-object2", data=io.BytesIO("hello"), length=5, + ), + SnowballObject( + "my-object3", data=io.BytesIO("world"), length=5, + mod_time=datetime.now(), + ), + ], + ) + """ + check_bucket_name(bucket_name) + + object_name = f"snowball.{random()}.tar" + + # turn list like objects into an iterator. + object_list = itertools.chain(object_list) + + metadata = metadata or {} + metadata["X-Amz-Meta-Snowball-Auto-Extract"] = "true" + + name = staging_filename + mode = "w:gz" if compression else "w" + fileobj = None if name else BytesIO() + with tarfile.open(name=name, mode=mode, fileobj=fileobj) as tar: + for obj in object_list: + if obj.filename: + tar.add(obj.filename, obj.object_name) + else: + info = tarfile.TarInfo(obj.object_name) + info.size = obj.length + if obj.mod_time: + info.mtime = time.to_float(obj.mod_time) + tar.addfile(info, obj.data) + + if name: + return self.fput_object(bucket_name, object_name, staging_filename, + metadata=metadata, sse=sse, + tags=tags, retention=retention, + legal_hold=legal_hold) + return self.put_object(bucket_name, object_name, fileobj, + fileobj.tell(), metadata=metadata, sse=sse, + tags=tags, retention=retention, + legal_hold=legal_hold) + def _list_objects( # pylint: disable=too-many-arguments,too-many-branches self, bucket_name, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-7.1.13/minio/commonconfig.py new/minio-7.1.14/minio/commonconfig.py --- old/minio-7.1.13/minio/commonconfig.py 2023-01-07 09:22:52.000000000 +0100 +++ new/minio-7.1.14/minio/commonconfig.py 2023-03-24 06:41:57.000000000 +0100 @@ -466,3 +466,48 @@ src.ssec, src.offset, src.length, src.match_etag, src.not_match_etag, src.modified_since, src.unmodified_since, ) + + +class SnowballObject: + """A source object definition for upload_snowball_objects method.""" + + def __init__(self, object_name, filename=None, data=None, length=None, + mod_time=None): + self._object_name = object_name + if (filename is not None) ^ (data is not None): + self._filename = filename + self._data = data + self._length = length + else: + raise ValueError("only one of filename or data must be provided") + if ( + mod_time is not None and + not isinstance(mod_time, datetime.datetime) + ): + raise ValueError("mod_time must be datetime.datetime type") + self._mod_time = mod_time + + @property + def object_name(self): + """Get object name.""" + return self._object_name + + @property + def filename(self): + """Get filename.""" + return self._filename + + @property + def data(self): + """Get data.""" + return self._data + + @property + def length(self): + """Get length.""" + return self._length + + @property + def mod_time(self): + """Get modification time.""" + return self._mod_time diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-7.1.13/minio/time.py new/minio-7.1.14/minio/time.py --- old/minio-7.1.13/minio/time.py 2023-01-07 09:22:52.000000000 +0100 +++ new/minio-7.1.14/minio/time.py 2023-03-24 06:41:57.000000000 +0100 @@ -19,6 +19,7 @@ from __future__ import absolute_import import locale +import time as ctime from contextlib import contextmanager from datetime import datetime, timezone @@ -96,3 +97,8 @@ def to_signer_date(value): """Format datetime into SignatureV4 date formatted string.""" return _to_utc(value).strftime("%Y%m%d") + + +def to_float(value): + """Convert datetime into float value.""" + return ctime.mktime(value.timetuple()) + value.microsecond * 1e-6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-7.1.13/minio.egg-info/PKG-INFO new/minio-7.1.14/minio.egg-info/PKG-INFO --- old/minio-7.1.13/minio.egg-info/PKG-INFO 2023-01-07 09:25:21.000000000 +0100 +++ new/minio-7.1.14/minio.egg-info/PKG-INFO 2023-03-24 06:43:28.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: minio -Version: 7.1.13 +Version: 7.1.14 Summary: MinIO Python SDK for Amazon S3 Compatible Cloud Storage Home-page: https://github.com/minio/minio-py Download-URL: https://github.com/minio/minio-py/releases diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-7.1.13/minio.egg-info/SOURCES.txt new/minio-7.1.14/minio.egg-info/SOURCES.txt --- old/minio-7.1.13/minio.egg-info/SOURCES.txt 2023-01-07 09:25:24.000000000 +0100 +++ new/minio-7.1.14/minio.egg-info/SOURCES.txt 2023-03-24 06:43:31.000000000 +0100 @@ -69,6 +69,7 @@ examples/set_object_retention.py examples/set_object_tags.py examples/stat_object.py +examples/upload_snowball_objects.py minio/__init__.py minio/api.py minio/commonconfig.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-7.1.13/tests/functional/tests.py new/minio-7.1.14/tests/functional/tests.py --- old/minio-7.1.13/tests/functional/tests.py 2023-01-07 09:22:52.000000000 +0100 +++ new/minio-7.1.14/tests/functional/tests.py 2023-03-24 06:41:57.000000000 +0100 @@ -15,7 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,broad-exception-raised """Functional tests of minio-py.""" from __future__ import absolute_import, division