diff --git a/pybis/src/python/HOWTO_UPLOAD_TO_PYPI b/pybis/src/python/HOWTO_UPLOAD_TO_PYPI new file mode 100644 index 0000000000000000000000000000000000000000..ce852ad73ea5793e70c0a3c0331cefff0d373ed1 --- /dev/null +++ b/pybis/src/python/HOWTO_UPLOAD_TO_PYPI @@ -0,0 +1,15 @@ +# create a python2 / python 3 universal distribution +python setup.py bdist_wheel --universal + +# create a pure python distribution, which only works for a specific python version +python setup.py bdist_wheel + +# create a source-distribution +python setup.py sdist + +# see distributions +ls -la dist/ + +# upload distribution(s) to pypi +twine upload dist/* + diff --git a/pybis/src/python/dist/PyBIS-1.6.7.tar.gz b/pybis/src/python/dist/PyBIS-1.6.7.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..87450e47cc59ec49207dbd9aeb369c9ddb3c16b5 Binary files /dev/null and b/pybis/src/python/dist/PyBIS-1.6.7.tar.gz differ diff --git a/pybis/src/python/pybis/__init__.py b/pybis/src/python/pybis/__init__.py index 6ff689482a5d6c51cdc7a8550c2e4d39d9c2491e..80b8b723b85e0929352d6dde571590a859c97c69 100644 --- a/pybis/src/python/pybis/__init__.py +++ b/pybis/src/python/pybis/__init__.py @@ -1,6 +1,6 @@ __author__ = 'Swen Vermeul' __email__ = 'swen@ethz.ch' -__version__ = '1.6.5' +__version__ = '1.6.7' from . import pybis from .pybis import Openbis diff --git a/pybis/src/python/pybis/property.py b/pybis/src/python/pybis/property.py index 51c814f7bc9766667a7f3acb6185eb65b49149da..f9633f28bd8ef47aed353b7341a7c328ddf982b5 100644 --- a/pybis/src/python/pybis/property.py +++ b/pybis/src/python/pybis/property.py @@ -59,8 +59,9 @@ class PropertyHolder(): data_type = property_type['dataType'] if data_type == 'CONTROLLEDVOCABULARY': voc = self._openbis.get_terms(name) - if value not in voc.terms: - raise ValueError("Value must be one of these terms: " + ", ".join(voc.terms)) + value = value.upper() + if value not in voc.df['code'].values: + raise ValueError("Value must be one of these terms: " + ", ".join(voc.df['code'].values)) elif data_type in ('INTEGER', 'BOOLEAN', 'VARCHAR'): if not check_datatype(data_type, value): raise ValueError("Value must be of type {}".format(data_type)) diff --git a/pybis/src/python/pybis/pybis.py b/pybis/src/python/pybis/pybis.py index 360276b069afea2761628e04e303055f72a4a205..fb57c602b38fc4b126e135fa9433123ec4d91667 100644 --- a/pybis/src/python/pybis/pybis.py +++ b/pybis/src/python/pybis/pybis.py @@ -460,6 +460,7 @@ def _subcriteria_for_code(code, object_type): return get_search_type_for_entity(object_type.lower()) + class Openbis: """Interface for communicating with openBIS. A recent version of openBIS is required (minimum 16.05.2). @@ -581,6 +582,31 @@ class Openbis: 'update_object(sampleId, space, project, experiment, parents, children, components, properties, tagIds, attachments)', # 'update_sample(sampleId, space, project, experiment, parents, children, components, properties, tagIds, attachments)' alias ] + def _repr_html_(self): + html = """ + <table border="1" class="dataframe"> + <thead> + <tr style="text-align: right;"> + <th>attribute</th> + <th>value</th> + </tr> + </thead> + <tbody> + """ + + attrs = ['url', 'port', 'hostname', 'verify_certificates', 'as_v3', 'as_v1', 'reg_v1', 'token'] + for attr in attrs: + html += "<tr> <td>{}</td> <td>{}</td> </tr>".format( + attr, getattr(self, attr, '') + ) + + html += """ + </tbody> + </table> + """ + return html + + @property def spaces(self): return self.get_spaces() diff --git a/pybis/src/python/pybis/semantic_annotation.py b/pybis/src/python/pybis/semantic_annotation.py index 657ca773f80bfe2fbd42c3377c62a82dd41fb30e..73d5152c9e1c85173a5f4ad37a29687983994043 100644 --- a/pybis/src/python/pybis/semantic_annotation.py +++ b/pybis/src/python/pybis/semantic_annotation.py @@ -116,6 +116,33 @@ class SemanticAnnotation(): self._openbis.delete_entity(entity='SemanticAnnotation', id=self.permId, reason=reason) if VERBOSE: print("Semantic annotation successfully deleted.") + def _repr_html_(self): + attrs = [ 'permId', 'entityType', 'propertyType', 'predicateOntologyId', 'predicateOntologyVersion', 'predicateAccessionId', 'descriptorOntologyId', 'descriptorOntologyVersion', 'descriptorAccessionId', 'creationDate', + ] + + html = """ + <table border="1" class="dataframe"> + <thead> + <tr style="text-align: right;"> + <th>attribute</th> + <th>value</th> + </tr> + </thead> + <tbody> + """ + + for attr in attrs: + html += "<tr> <td>{}</td> <td>{}</td> </tr>".format( + attr, getattr(self, attr, '') + ) + + html += """ + </tbody> + </table> + """ + return html + + def __repr__(self): headers = ['attribute', 'value'] lines = [] diff --git a/pybis/src/python/setup.py b/pybis/src/python/setup.py index 3c4803574588c1c7d397833dcb1f201bbecc7ec4..99dce1042463091561987bf5b0cb895d2d1d616d 100644 --- a/pybis/src/python/setup.py +++ b/pybis/src/python/setup.py @@ -9,7 +9,7 @@ from setuptools import setup setup( name='PyBIS', - version= '1.6.5', + version= '1.6.7', description='openBIS connection and interaction, optimized for using with Jupyter', url='https://sissource.ethz.ch/sispub/pybis/', author='Swen Vermeul | ID SIS | ETH Zürich',