eWaterCycle / grpc4bmi

gRPC wrapper for model with a Basic modeling interface
https://grpc4bmi.readthedocs.io
Apache License 2.0
5 stars 4 forks source link

BmiJulia easier to subclass. #145

Open sverhoeven opened 11 months ago

sverhoeven commented 11 months ago

To subclass the BmiJulia class you now have to something like

class WflowBmi(BmiJulia):
    def __init__(self):
        m = self.from_name("Wflow.Model", implementation_name="Wflow.BMI")
        super().__init__(m.model, m.implementation)

See https://github.com/eWaterCycle/grpc4bmi/pull/144/files#r1374200483

It would be nicer if you could do

class WflowBmi(BmiJulia):
    def __init__(self):
        super().__init__("Wflow.Model", "Wflow.BMI")

Con: this makes init fat as it needs to call julia code +