python-irodsclient icon indicating copy to clipboard operation
python-irodsclient copied to clipboard

create a utility module for miscellaneous functions

Open d-w-moore opened this issue 3 years ago • 7 comments

There may be value in providing a namespace (irods.utility?) for free functions of high general utility in the Python client library or in applications using it. One example is make_session (which now, somewhat awkwardly, resides in irods.test.helpers).

This namespace could easily be expanded to include others in the future, like is_collection / is_data_object, etc.

d-w-moore avatar Nov 19 '22 03:11 d-w-moore

Perhaps this be or become a library of free functions called irods.lib.* or similar .... See https://github.com/irods/python-irodsclient/pull/506#discussion_r1458231160

d-w-moore avatar Jan 19 '24 03:01 d-w-moore

I'm a little wary of introducing a "utilities" module because those sorts of things always make me itchy, but it would definitely be useful in the short term for exposing the useful functionality. Eventually, I personally would like to see more targeted libraries which logically group together the related functions. Just my two cents.

alanking avatar Jan 19 '24 17:01 alanking

I'm a little wary of introducing a "utilities" module because those sorts of things always make me itchy, but it would definitely be useful in the short term for exposing the useful functionality. Eventually, I personally would like to see more targeted libraries which logically group together the related functions. Just my two cents.

That's fine by me, I'm going to defer due to having no strong opinion. Are we, as a group, more comfortable with the make_session function in a README example being imported from irods.test.helpers than from a potential irods.lib? (Referencing this comment from a currently active PR)

d-w-moore avatar Jan 21 '24 07:01 d-w-moore

Or... how about this: We introduce an irods.demo module from which README examples can import conveniently?

d-w-moore avatar Jan 21 '24 17:01 d-w-moore

I don't think demo is the best name for this functionality. It can be viewed as toy-code (i.e. not for production use) just like demoResc.

We can move make_session into the session module. Fits the purpose of the module perfectly IMO.

Same thing for the path utility functions. They can become part of path/init.py.

Thoughts?

korydraughn avatar Jan 22 '24 13:01 korydraughn

Wait, you're saying irods.demo would be for example code. That could work, but the functions we're discussing are very convenient and would be helpful to users.

I think moving the existing functionality into an existing/appropriate module makes sense.

korydraughn avatar Jan 22 '24 13:01 korydraughn

irods.demo feels... weird to me too.

trel avatar Jan 22 '24 15:01 trel