IRC Logs for #circuits Thursday, 2014-06-12

*** my_chiguai has joined #circuits04:29
kdb_Howdy my_chiguai04:29
*** my_chiguai has quit IRC05:13
*** koobs has quit IRC06:46
*** koobs has joined #circuits07:03
kdb_Welcome back koobs :)07:03
prologicheya koobs07:06
koobsprologic: gday mate :)07:06
*** koobs has quit IRC07:13
*** koobs has joined #circuits07:43
*** koobs has quit IRC07:52
prologichey :)07:58
prologichow's thing?07:58
prologicYou know I'm up for a new job right? :)07:58
prologic1st July my contract ends07:58
*** koobs has joined #circuits08:26
*** spaceone has quit IRC09:38
*** plg has joined #circuits12:28
kdb_Yo plg12:28
plgHey. Is there any difference between `A.registerChild(B)` and `B.register(A)`? From the source code it seems that the second one actively refreshes the root.12:35
prologichi plg12:36
prologicthere's no difference other than what you said really12:36
prologicit basically boils down to where the event handlers get added to12:36
prologicA().register(b) != B().register(A)12:36
prologicyour question is not really something that's come up :)12:37
prologicin general you start (usually) with some top-level component12:37
prologicand not really worry about who's registering what when and where :)12:37
prologicbut you do end up with something like:
prologica component graph12:38
plgI see. I have A, B and C. A fires e, that causes B to fire f that causes C to fire g that causes A to print something to show this worked.12:40
plgThis only works for me when I do B().register(A) and not using registerChild. Any idea why?12:41
prologicdon't use .registerChild()? :)12:42
prologicthat was never meant to be exposed as a public API :)12:42
prologicIIRC you would have to do: a.registerChidl(B())12:42
prologicwhere a is an instance of A12:42
prologicbut I could be wrong :)12:42
prologicno-one (including me) that uses circuits uses any of the internal API(s) :P12:43
plgOk, I just used it because it's in the docs and felt more explicit :)12:43
prologicregister, unregister, fire, call, wait, start, run, stop12:43
prologicuse those :)12:43
plgAnd yeah, I missed typed those were supposed to all be instances.12:43
prologicperhaps we should prefix it with _? :)12:43
prologic.register() is explicit too12:43
prologicbut there is a bit of machinery that goes on behind the scnes12:44
prologicso in case it isn't obvious too12:44
prologicremember that whilst you can create a component graph12:44
prologicand you can use to visually view it as .dot or .png12:44
prologiccircuits doesn't actually work like that :)12:45
prologicit's purely (at this time) for design and visual representation of your app/system12:45
prologicin actual fact, event handlers are cahced for O(1) lookups12:45
prologici.e: for performance12:45
prologicso in reality it doesn't matter how you register your components together - except for design and clarity :)12:46
prologicoh and welcome to circuits :)12:46
prologicand I'm presenting circuits to PyConAU this year in Australia/Brisbane12:46
plgThat clears things up, thanks!12:47
plgI'll definitely watch the video afterwards :)12:47
prologicgreat :)12:48
prologicanyway, what's your planned usage for circuits?12:48
plgSomething similar to this:
prologicahh lovely :)12:52
plgCan you tell me if there's anything to improve here:
prologicseems fine to me :)13:00
prologiconly thing I'd say is rather than sleep()13:00
prologicuse Timer()13:00
prologicfrom circuits import Timer13:00
prologicsleep()ing will block the event loop unnecessarily13:00
prologicunless you don't mind :)13:01
plgI thought timers always repeated the action. How do I tell it to repeat or not? It only has the interval arg13:03
prologicby default it will not repeat the event you ask it to fire13:05
prologicyou'd have to pass persist=True for that13:05
prologic |      If the optional keyword argument *persist* is set to ``True``,13:06
prologic |      the event will be fired repeatedly. Else the timer fires the13:06
prologic |      event once and then unregisters itself.13:06
plgWere's that from?13:07
plgI don't see it on
prologicfrom the docs :)13:07
plgOh wait...13:07
prologicit's right there :)13:07
prologicjust not obvious13:07
prologicperhaps I'll fix that13:08
plgYep ;)13:08
prologicdocstrings weren't always written using the proper SPhinx Python domain13:08
plgMy editor (ST3 using Anaconda) can show docstrings, but it only showed the class docstring without the __init__.13:10
plgIs Manager.wait also internal?13:14
prologicthat's public API13:15
prologicare your event'ing primitives13:15
*** circuits_github has joined #circuits13:16
circuits_github[circuits] therealprologic pushed 1 new commit to master:
circuits_githubcircuits/master 1f1397e James Mills: Improved docstring of Timer13:16
*** circuits_github has left #circuits ()13:16
kdb_Yo circuits_github13:16
prologicstart/stop/run your state control (start as thread, run as main, or stop)13:16
prologicand register/unregister your component registration and composition13:16
prologiccall/wait are synchronoization primitives that give you coroutine like flow control alongside circuits asynchronous event-driven architecture13:17
prologicusual form inside an event handler is:13:17
prologicdef foo(self, ...):13:17
prologic   x = yield
prologic   yield x.value13:17
prologicas a contrived example13:17
prologicsee examples/primitives/ tests and docs :)13:18
plgOk :)13:18
prologicAs a more practical example:
prologica project I built at work13:18
plgYeah I played with it a bit and downloaded the other stuff from
*** Osso has joined #circuits13:20
kdb_Heya osso13:20
plgIs the dev currently on Github or Bitbucket? If I want to pull some changes13:21
prologicbut we mirror to Github for your convenience13:31
prologicI do however prefer (personally) both Mercurial and Bitbucket :)13:31
prologicgit is sadly one of those tools wher eyou have to lookup man pages for anything more elaborate than a simple commit/push/pull/clone set of operations :)13:32
plgThat's true, you can either get the hang of it or use shell aliases ;)13:33
prologicpretty much13:35
prologicI do very rarely use git but it's not my preferred choice when I have control over what DVCD I use :)13:35
prologicI actually use hg to access and contribute to git repos13:36
prologicvia the hg-git bridge13:36
*** Osso has quit IRC13:36
*** Osso has joined #circuits13:44
plgThanks for the help, bye! :)13:59
*** plg has quit IRC13:59
robert_prologic: so how do I use the module loader?16:15
*** ninkotech has joined #circuits16:46
kdb_Welcome back ninkotech :)16:46
*** prologic has joined #circuits19:03
kdb_Yo prologic19:03
*** Osso has quit IRC20:18
*** Osso has joined #circuits20:18
kdb_Welcome back osso :)20:18
prologicrobert_, the on in circuits?22:12
prologicyeah so it's pretty simple really22:27
prologicthe implemtnation that is22:27
prologicit only supports basic sys.path manipulation and loading of modules22:28
prologicso something like:22:28
prologicfrom circuits import Loader22:29
prologicLoader(paths=["/some/path"]).register(app)22:29"load", "foo"), "loader")22:29
prologicfor the moment looks like the code will load the first component found22:30
prologicso each module should only contain one component22:30
prologicyou might wanna compare it with kdb's plugin management code though22:30
prologickdb's might be better :)22:30
kdbUnknown Command: 's22:30
prologickdb's plugin manager assumes hwoever22:31
kdbUnknown Command: 's22:31
prologickdb.plugins.* for example22:31
kdbUnknown Command: .plugins.*22:31
prologici.e: the top-level package22:31
prologicand assumes BasePlugin subclasses22:31
prologicfrom kdb.plugin import BasePlugin22:31
prologicbut supports any no. of BasePlugin subclasses in a single module22:32

Generated by 2.11.0 by Marius Gedminas - find it at!