AllSpiceIO / py-allspice

An AllSpice-API wrapper in Python
MIT License
0 stars 0 forks source link

Utils modules should be scoped by tool #103

Open shrik450 opened 5 months ago

shrik450 commented 5 months ago

Currently, the modules inside the utils module are scoped by function, e.g. "bom_generation" and "netlist_generation". This was fine when all the utils were for Altium projects, but with the upcoming OrCAD utils, and expected utils for other tools, this becomes counterintuitive.

For example, if I'm generating a BOM, I would prefer using

from allspice.utils.orcad import generate_bom

rather than

from allspice.utils.bom_generation import generate_bom_orcad

This would be breaking change.

shrik450 commented 5 months ago

@kdumontnu / @jtran What do you think? I've marked this as a proposal so we can decide if we want to do this or not. If there's a better name for that label please feel free to change it.

I'm a little wary of making another big breaking release so soon, but I think if we prefer it this way we're better of changing this early.

kdumontnu commented 5 months ago

I think it depends on how different the implementations will be for different CAD tools for this and other utilities. There will likely also be a utils.common for shared functions. If there's a world where the different ECAD tools can use the same utility functions, then there is no reason to split them up by ECAD tool.

However, if the implementations for different ECAD tools and supported functionality differ greatly, then it might make sense to split by ECAD tool. In the example you provide above, the new structure certainly looks better. I just wonder how it will evolve as we scale up to more implementations.

jtran commented 5 months ago

@shrik450, I basically agree with everything you said, except that even better than both would be a single interface that worked with them all:

from allspice.utils import generate_bom

Maybe under the hood, all it does is delegate to the right module. But that's the dream.