NSLS-II / pyCHX

chx_analysis_codes
BSD 3-Clause "New" or "Revised" License
5 stars 6 forks source link

separate package imports from scripts? #13

Open jrmlhermitte opened 6 years ago

jrmlhermitte commented 6 years ago

This is in response to discussion in #8 (thanks for reminder @mrakitin ).

It seems there are two different types of .py files:

  1. Meant to be imported as a package. For ex: from pyCHX.chx_generic_functions import shrink_image
  2. Meant to be edited frequently and run as a script. For example : %run XPCS_SAXS.py The latter is more commonly run as a script because some flags are turned on or off. I think one example could be here.

Should we make a separation between the two? I suggest we move script files in a new folder called /scripts.

As the library is built as a lightsource2 package and we'd like to see a lot of this useful code be used by others (if @yugangzhang is okay with it :-) ) it would be nice to spend some time to think about this.

I would like to hear @yugangzhang 's opinion on this. Also, @danielballan may have better suggestions on how to do this.

jrmlhermitte commented 6 years ago

interestingly, i randomly came across this piece by @danielballan : https://github.com/NSLS-II-CHX/chxtools/pull/12/files#diff-ea1e2c4c3d7aa9e134677059f594f44bR1

this may be part of the same discussion

ambarb commented 4 years ago

@danielballan @afluerasu Is this still relevant to v2?

ambarb commented 4 years ago

Suggestion to make a scripts folder seems make good sense to me. then it becomes easier "know" how to use the library by just looking at the directory structure; and also suggestive that if somehting doesn't work for some special case, editing the script locally would be "ok"

ambarb commented 4 years ago

Good to formalize the preferred method to get away fro % run ......

@danielballan says reload is a better practice.

So this doesn't really affect the analysis so much, generic_functions has a mixture of purposes.

ambarb commented 4 years ago

It sounds like for the generic functions, we need to agree on how to work together for common library functions. Not really a concern right now.

ambarb commented 4 years ago