Git Product home page Git Product logo

Comments (5)

psilo909 avatar psilo909 commented on May 23, 2024

i rewrote my plugin to use the information from run method only.
anyway, i still think its not perfect that the information is only available outside the init method.

from smarthome.

cstrassburg avatar cstrassburg commented on May 23, 2024

i changed the plugin creation mechanism to set the instance name before call the __init__ method. please test it.

smartpugin uses now multiple inheritance to get the methods from Utils.py
now you can call self.is_float(...)

from smarthome.

cstrassburg avatar cstrassburg commented on May 23, 2024

an other issue: I can create for every plugin config attribute implicit a member inside the plugin object.

[plugin1]
   class_name = foo
   class_path = plugins.bla
   test = test1
   foo = bar 
   bar = foo

and inside the plugin you can get the values with self.foo or self.test
so we can change in future the __init__ signature to __init__() without params.
could it be useful?

from smarthome.

psilo909 avatar psilo909 commented on May 23, 2024

my issue can be closed, keeping this open due to last question of cstrassburg.

from my point of view, this could be useful yes. but init with params should be kept alive due to backward compatibility

from smarthome.

ohinckel avatar ohinckel commented on May 23, 2024

from my point of view, this could be useful yes. but init with params should be kept alive due to
backward compatibility

Just a few notes no plugin parameters: I was thinking about to change the signature completely for the init method: having just one args argument containing a dict with all configured parameters (see also #27).

Putting all parameters directly into member fields may be a bad idea since it could overwrite fields without notice (one could accidentally overwrite a field which is not a configuration parameter but an internal variable which should not be change from outside). And the plugin should take care explicitly which parameter it is using and which not.

@cstrassburg, since the first problem about the instance name is solved already we could close this issue and talk about the plugin parameter handling in #27.

What do you think?

from smarthome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.