h5pyd icon indicating copy to clipboard operation
h5pyd copied to clipboard

modification of the apps functions

Open untereiner opened this issue 4 years ago • 3 comments

Hi, I am using h5pyd in a higher-level program. The logic implemented in the so called apps is interesting. I think they would be useful as functions that take parameters to be reused in other programms. What do you think ? Here a listed the two main modifications I think must be done:

  • [ ] stateless: init cfg structure in the main function and put it as a parameter to the functions (PR #91)
  • [ ] arguments: use the argparse package to handle arguments
  • [ ] transform the logic implented in the main functions of the apps in functions that take parameters (the same as those from the argv) from a new main function.

I can contribute via a PR if you are interested.

untereiner avatar Jun 15 '20 07:06 untereiner

@untereiner I started to convert the hsload app to OOP which might be similar to what you are suggesting. My efforts are attached if you want to use it in your PR (I'd also be happy to help/contribute). hsload.py.zip

MRossol avatar Jun 15 '20 19:06 MRossol

@untereiner - this sounds like a great idea for refactoring the code in _apps. Looking forward to a PR.

One challenge we've had with the apps is that there are no test codes, so it's easy for regressions to slip in. If the refactor made it easier to write test cases, so much the better.

jreadey avatar Jun 15 '20 22:06 jreadey

Thank you both ! @MRossol I will look into your work! @jreadey I will try to refactor in a way to simplify the test suite writing

untereiner avatar Jun 16 '20 07:06 untereiner