diff --git a/api-openbis-python3-pybis/src/python/CHANGELOG.md b/api-openbis-python3-pybis/src/python/CHANGELOG.md index ba02912c3e9069f4e75808e2631a384fdf92a53b..3e9f63a035a14f8cca43c9d181bf33e7bda31a0f 100644 --- a/api-openbis-python3-pybis/src/python/CHANGELOG.md +++ b/api-openbis-python3-pybis/src/python/CHANGELOG.md @@ -1,6 +1,7 @@ ## Changes with pybis-1.36.0 -- Added dependency to requests-toolbelt +- Reverted breaking changes to dataset upload functionality +- Performance improvements to get_sample and get_samples methods ## Changes with pybis-1.35.11 diff --git a/api-openbis-python3-pybis/src/python/pybis/__init__.py b/api-openbis-python3-pybis/src/python/pybis/__init__.py index 82c03f6cb419e3f37f856b66906925a140c99610..8a25c785035679ee38ca0e9d7803ac6971e2af90 100644 --- a/api-openbis-python3-pybis/src/python/pybis/__init__.py +++ b/api-openbis-python3-pybis/src/python/pybis/__init__.py @@ -15,7 +15,7 @@ name = "pybis" __author__ = "ID SIS • ETH Zürich" __email__ = "openbis-support@id.ethz.ch" -__version__ = "1.36.0rc1" +__version__ = "1.36.0" from . import pybis from .pybis import DataSet diff --git a/api-openbis-python3-pybis/src/python/pybis/dataset.py b/api-openbis-python3-pybis/src/python/pybis/dataset.py index e845406e9af0e4e262174313a8b29179def0dcb2..9ba2f319b59b4f2e3776b74d40d077571bd6157f 100644 --- a/api-openbis-python3-pybis/src/python/pybis/dataset.py +++ b/api-openbis-python3-pybis/src/python/pybis/dataset.py @@ -29,7 +29,6 @@ from urllib.parse import urljoin, quote import requests from pandas import DataFrame from requests import Session -from requests_toolbelt.multipart.encoder import MultipartEncoder from tabulate import tabulate from .definitions import ( @@ -1246,13 +1245,9 @@ class DataSetUploadQueue: file_size = os.path.getsize(filename) if self.multipart is True: - with open(filename, "rb") as f: - m = MultipartEncoder( - fields={filename: (filename, f, 'application/octet-stream')}) - headers = {'Content-Type': m.content_type} - r = requests.post(upload_url, data=m, headers=headers, - verify=verify_certificates) - r.raise_for_status() + file = {filename: open(filename, "rb")} + resp = requests.post(upload_url, files=file, verify=verify_certificates) + resp.raise_for_status() else: # upload the file to our DSS session workspace with open(filename, "rb") as f: diff --git a/api-openbis-python3-pybis/src/python/pybis/pybis.py b/api-openbis-python3-pybis/src/python/pybis/pybis.py index a0b8674fe5814c616a81e54e7df497f10d1eb107..12e50318f8104cb40fa126f44931065fedcd5919 100644 --- a/api-openbis-python3-pybis/src/python/pybis/pybis.py +++ b/api-openbis-python3-pybis/src/python/pybis/pybis.py @@ -2380,6 +2380,7 @@ class Openbis: attrs=None, props=None, where=None, + raw_response=False, **properties, ): """Returns a DataFrame of all samples for a given space/project/experiment (or any combination). @@ -2512,6 +2513,8 @@ class Openbis: resp = self._post_request(self.as_v3, request) parse_jackson(resp) + if raw_response: + return resp response = resp["objects"] @@ -4663,7 +4666,8 @@ class Openbis: ) def get_sample( - self, sample_ident, only_data=False, withAttachments=False, props=None, withDataSetIds=False, **kvals + self, sample_ident, only_data=False, withAttachments=False, props=None, + withDataSetIds=False, raw_response=False, **kvals ): """Retrieve metadata for the sample. Get metadata for the sample and any directly connected parents of the sample to allow access @@ -4729,6 +4733,9 @@ class Openbis: data=resp[sample_ident], ) else: + if raw_response: + parse_jackson(resp) + return resp return self._sample_list_for_response( response=list(resp.values()), props=props, parsed=False ) diff --git a/api-openbis-python3-pybis/src/python/setup.cfg b/api-openbis-python3-pybis/src/python/setup.cfg index 4b809868084896cb39aaf8bedf10ef79be7d0ac1..ae2a809cf65da2ecd34e1c0ed7f7865c04536297 100644 --- a/api-openbis-python3-pybis/src/python/setup.cfg +++ b/api-openbis-python3-pybis/src/python/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = PyBIS -version = 1.36.0rc1 +version = 1.36.0 author = ID SIS • ETH Zürich author_email = openbis-support@id.ethz.ch license = Apache Software License Version 2.0 diff --git a/api-openbis-python3-pybis/src/python/setup.py b/api-openbis-python3-pybis/src/python/setup.py index dbd0fada902052615f609591df2794aed95f8b1c..0efb031a3d7b0748014abb8fdf203c667cadeef5 100644 --- a/api-openbis-python3-pybis/src/python/setup.py +++ b/api-openbis-python3-pybis/src/python/setup.py @@ -26,7 +26,7 @@ with open("README.md", "r", encoding="utf-8") as fh: setup( name="PyBIS", - version="1.36.0rc1", + version="1.36.0", author="ID SIS • ETH Zürich", author_email="openbis-support@id.ethz.ch", description="openBIS connection and interaction, optimized for using with Jupyter", @@ -38,7 +38,6 @@ setup( install_requires=[ "pytest", "requests", - "requests_toolbelt", "urllib3", "pandas", "texttable",