genialis / resolwe-bio-py

Resolwe Bioinformatics Python API
Apache License 2.0
4 stars 25 forks source link

unable to call RNATables "the old fashion way" #277

Closed romunov closed 2 years ago

romunov commented 2 years ago

Tutorials call the RNATables using

import resdk
app = resdk.Resolwe(url='https://app.genialis.com/')
app.login()
collection = app.collection.get("sum149-fresh-for-rename")
sum149 = resdk.tables.RNATables(collection)

However in my 14.0.0 version of resdk this doesn't appear to work.

In [6]: sum149 = resdk.tables.RNATables(collection)                                                                                                      
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-6-5bec9560155e> in <module>
      1 collection = app.collection.get("sum149-fresh-for-rename")
----> 2 sum149 = resdk.tables.RNATables(collection)

AttributeError: module 'resdk' has no attribute 'tables'

If I import RNATables using the importing mechanism, I am able to use the functionality.

In [8]: from resdk.tables import RNATables                                                                                                              
In [9]: sum149 = resdk.tables.RNATables(collection)                                                                                                      
In [10]:     

Is this intended and we need to fix the documentation or did something sneaky creep into the code?

JureZmrzlikar commented 2 years ago

Adressed here: https://github.com/genialis/resolwe-bio-py/pull/278 The old way worked by coincidence: as a combination of other imports and legacy code (that was deprecated at some point and this stopped working). Instead of chaining the imports IMO it's better to just let the user import the thing more explicitly, e.g. from resdk.tables import RNATables. Thanks for noticing this @romunov !

JureZmrzlikar commented 2 years ago

PR #278 is merged, i consider this closed.