I’d be interested to know why you’d want something like this…
I prefer to have all my Hops functions in a single file and all the utility functions in another (or few others), but I may be missing something
I want something like this to have a better configuration management of GH definitions.
I have GH definitions that grows to >500 components. This is a proving difficult to manage. Last week, I made a modification in a very big .gh file and the output fell apart with no apparent reason.
This is the main reason I am very exited by Hops and I want to switch to GH/Hops ASAP. I will be able to break down a GH definition into as many files I want and each configuration change will be human readable as a python code change. I will loose the fun of drawing the components / links but I have to find the sweet spot between fun and configuration management.
In order to do that, I need to spread my python/hops code into as many files I want, hence this topic.
Apologize if my question wasn’t clear…
I wanted to ask: why would you want to have one Hops function per python files?
It’s a true question, I’m not saying it’s wrong, just wondering why it could be better
I guess it’s easier to maintain your code, at the cost of duplicating the import of libraries on every files?
Here’s an example where I have all my Hops functions in one file, and I can still call any of them in any Gh definitions…
you’are right, my point is to avoid too large python files. I translated this into one hops component per python file (an intellectual shortcut for sure).
I had a look at your scripts in your hops repo (nice project BTW). Your biggest script is hops_plots.py which 582 SLOCs (Source Line of Code) which is still manageable.
Best practices suggest that the max SLOCs per file should be between 300 & 2000. It is a matter of taste probably. In my case, I tend to stay below 500 SLOCs per file. My idea for the port of my very complex GH file to hops is to break it down into python file of no more than 500 SLOCs. I surmise I will one hops component per file but I might be wrong on that.