Hi i don’t know if this is the best question title, I'm restructuring my python application to be more easy to extend without chaining the core modules. maybe the solution is implementing plug-in interface or something like this, but I'm looking for application design advices or some clues to the bests options to do it, or modules, design patterns whatever can solve my problem. my actual application looks something like (a simplification):
main.py
class A(object):
def bunch_of_methods():
...
def topology_1():
...
def topology_2():
...
def topology_3():
...
def topology_n():
...
run.py
something.topology_1()
or
something.topology_2()
or
something.topology_n()
But I want to separate all the topologies in different .py files, and put them all into a folder to look like
class Topology_1(Object):
self.name = "topology 1"
self.version = "0.0"
self.do_the_thing():
...
And what I want is change the main.py in a way that allows me to implement new topology class, copy then into its folder and without changing anything in the main.py I can use in the same way from the run.py
Aucun commentaire:
Enregistrer un commentaire