IRC Logs for #circuits Saturday, 2013-05-11

prologichey Justin00:27
jgiorgihey prologic00:31
*** jgiorgi has quit IRC01:08
*** jgiorgi has joined #circuits01:10
*** koobs` has joined #circuits01:12
*** koobs has quit IRC01:13
*** jgiorgi-home has joined #circuits01:36
*** prologic_ has joined #circuits01:37
*** prologic_ has quit IRC01:37
*** prologic_ has joined #circuits01:37
*** jgiorgi has quit IRC01:37
*** prologic has quit IRC01:37
*** koobs has joined #circuits01:54
*** koobs` has quit IRC01:56
*** jgiorgi-home has quit IRC02:09
*** jgiorgi-home has joined #circuits02:09
*** koobs has quit IRC02:11
*** koobs has joined #circuits02:15
*** irclogger__ has quit IRC02:23
*** irclogger___ has joined #circuits02:23
*** jgiorgi has joined #circuits03:05
*** ronny has joined #circuits06:57
*** ronny has quit IRC07:08
*** amee2husky has joined #circuits10:09
amee2huskymorning everyone :D10:10
prologicgodo mroning10:10
amee2huskyi'm looking at circuits to rewrite and streamline a bunch of scripts for various automation tasks that have grown out of control over the years. to try it i'm starting with the IRC service bot and i found the IRC logger bot (link follows) to use as example. i'm running linux mint 13 and the versions from the repo10:13
amee2husky    <<  the Bot class from this article10:14
prologicso you're using circuits-dev?10:15
prologicThis simple bot *does* work and is currently online now :)10:15
prologicIt's source code is at:10:15
amee2huskybut i'm not really making heads or tails of it, and there seem to be a lot of inconsistencies between that code, the documentation, and the actual API. among other things, classes in the docs don't seem to exist, and capitalization is different for some class names than in the article10:15
prologicThere's also another variant called ircnotifier (which has a builtin web service)10:15
prologicIt's in #circuits-dev and #cmvt10:16
prologicAnd it's source is over at:10:16
prologicWhat docs btw?10:17
amee2huskyat the moment i'm using a combined IRC/jabber/email bot that is a clusterfuck of perl, python, shell and irssi... all that stuff has grown "naturally" over time and is starting to become unmanageable. so i want to combine all the losely coupled scripts into a single thing that runs in a multitasking framework10:17
prologicNo this article is correct10:17
amee2husky  <<  this, for example10:18
prologicnow I know why you're confused10:18
prologicthat article was written for the latest dev version of circuits10:18
prologic2.1.0 is only a minor version behind dev10:19
prologicI'm not sure where the confusion is?10:19
prologicCan you explain some of the confusion?10:19
prologicI may be able to clear things up10:19
prologicPypi has circuits-2.1.010:19
prologicWe're still working on and will be rreleasing 2.2.0 at some point10:20
prologicAPI hasn't changed at all between them though10:20
amee2huskyfor example, circuits.core.components.Component seems to be circuits.Component. the "ready" event in the bot never fires. the User and Nick events are capitalized differently10:20
amee2huskyi get an error that doesn't exist10:21
prologiccan I see your code?10:21
amee2huskyhang on a second10:21
prologicand circuits.core.components.Component10:21
prologicare the same btw10:21
prologicwe just have convenient namespace aliases for many things10:22
prologicso that it's less typing on your part :)10:22
prologicmost things are importable from circuits10:22
amee2huskyi'm not sure how much sense it makes since it is in a half-broken half-fixed state10:22
amee2huskyso either something is hosed with my installation, or what am i doing wrong here?10:23
prologicinitial looks at your code -  it seems ok10:23
prologicI'm going to run it up10:23
prologicone sec10:23
amee2huskyat the moment, i'm getting an import error10:24
prologicgot a sample config file for me?10:24
prologicI'm lazy :)10:24
amee2huskyheh yea. hang on a moment10:25
prologicbare with me10:25
amee2huskyi'm in that channel indicated so i can see when the bot pops in there10:25
prologicok first problem10:27
prologicUser, Nick, Join10:27
prologicshould all be USER, NICK, JOIN10:27
prologicI could have fubared up :)10:28
amee2huskyactually, thats one of the discrepancies. let me pastebin something10:28
prologicyeah I think you misunderstood something10:28
prologicthere are two sets of events with the basic (and I mean it's basic) IRC protocol module in circuits10:29
prologiceverything in UPPERCASE are treated as "commands"10:29
prologiceverything in proper CamelCase are treated as "responses"10:29
*** amee2bot has joined #circuits10:29
prologicthere we go10:29
amee2husky    (list shortened for readability)10:29
prologictotally works10:30
prologicthat was the only change requried10:30
amee2huskyif i leave it upper case, i get name errors10:30
amee2huskyobviously, since it doesn't exist in the package10:31
prologicno it definately does exist!10:31
prologicyou're using 2.1.010:32
prologicno even in 2.1.0 they exist10:32
prologicwhat version of circuits are you actually using?10:32
prologic>>> import circuits10:32
prologic>>> print circuits.__version__10:33
amee2huskyis that as ancient as it sounds like?  o.O10:33
prologichow the hell? :)10:33
amee2huskythats what i got from the mint repo10:33
prologicI can't even begin to tell you how old!10:33
prologicoh good lord10:33
prologicI didn't realize mint was packaging circuits10:34
prologichow familiar are you with Python and it's ecosystem?10:34
prologicbecause I highly highly recommend you get familiar with distribute, pip10:34
amee2huskynot very i suppose10:34
prologicand virtualenvwrapper10:34
prologicgimme a sec then10:34
amee2huskyi started slowly moving from perl to python for longer-term stuff like a month or two ago10:34
prologicI'll give you a helping hand :)10:35
amee2huskyi think i get the basics, but still pretty green behind my ears10:35
amee2huskycool, thanks :D10:35
amee2huskyi take it i can remove the package i installed from the repo then >_>10:38
prologictry this10:38
prologicmake sure you have Mercurial installed first10:38
prologicyes remove that very very old package too :)10:38
amee2huskydo these commands need to run as root?10:40
prologicwell yes probably10:41
prologicif you don't use virtualenv10:41
prologicor hack the python path somehow by hand10:41
prologicat least install distribute/pip as root10:41
prologicthen do yourself a favor10:41
prologicpip install virtualenvwrapper10:41
prologicwhen it's instanned10:41
prologicadd something like this to your .profile or .bashrc10:42
prologicsource /path/to/virtualenvwrapper.sh10:42
prologicyou could isntall virtualenvwrapper as root too10:42
prologicsudo pip install virtualenvwrapper10:42
prologicthen do this:10:42
prologicvirtualenv $HOME10:42
prologicas your user10:42
prologicshould create yourself a nice separate python environment in your home directory10:42
prologicthat should "just work"10:43
prologiccomplete with a local ~/bin/pip ~/bin/python etc10:43
amee2huskyrunning the "pip install virtualenvwrapper" line right now10:43
prologicvirtualenvwrapper provides bash aliases for many convenient things you may find useful in future10:43
prologicworkon <env>10:43
prologicread it's docs10:43
amee2huskycool :D10:43
amee2huskyhmm how long is that supposed to take?10:44
prologica while10:44
prologicit has a few dependencies10:44
prologicvirtualenv for one :)10:44
prologicdistribute/pip/virtualenvwrapper should be installed as root10:44
prologicvirtualenv $HOME (as your user)10:44
prologicthen you're set to go10:44
prologicmkdir -p $HOME/work/ && cd $HOME/work10:45
amee2huskyoh, installed it and run "virtualenv $HOME"10:45
prologichg clone
prologiccd circuits-dev10:45
prologicpython develop10:45
prologicthere's even an example ircbot in examples/10:46
amee2huskythomas@work:~/src$ hg clone
amee2huskygrep: No such file or directory10:46
amee2huskyerr wait10:46
amee2huskywhat is "hg"? i have an alias with that name10:46
prologicdid you install mercurial?10:46
prologicremove or rename that alias10:46
prologichg is mercurial's cli tool10:47
prologiceither isntall from mint packaging10:47
prologicor (as root)10:47
prologicpip install mercurial10:47
prologicit should install fine as long as you have the python-devel package installed10:47
amee2huskythats pretty fail because i <3 <3 <3 that alias10:47
prologicwhat does it do? :)10:47
prologicWe use Bitbucket/Mercurial as our Code Sharing and Tracking tools10:48
amee2huskyalias hg='history | grep'10:48
prologicAs opposed to Github/Git10:48
prologicI use ^R10:48
prologicstart typing/searching for something10:49
prologicpress enter10:49
amee2huskyi've been using that alias since like forever. there is a histignore that prevents it from being added to the history so searching for stuff doesn't clobber the results10:50
amee2huskyok, ran "python develop"10:50
amee2huskyso far everything seems to have worked10:50
prologicall should work now10:50
*** amee2bot has quit IRC10:51
amee2huskyhmm... it says no module circuits. do i need to fix some paths if it is a local install?10:51
prologicyou might want to start a new bash session10:52
prologicto refresh your environment, etc10:53
amee2huskyi opened a new shell window10:53
prologicwhich python10:53
prologicshould ponit to $HOME/bin/python10:53
prologicand when you did: python develop of circuits-dev10:53
prologicit should be installed to $HOME/lib/python2.7/site-packages/10:53
amee2huskyyeah, it does10:53
amee2huskyerr wait10:54
amee2huskythat'll only work interactively10:54
amee2huskythe shebang line still points to the global install10:54
prologicahh yes10:54
prologicyou should replace that with10:54
prologic#!/usr/bin/env python10:54
prologicenv works out the right python interpreter for you10:54
prologicwhich will always be the first int he PATH10:54
amee2huskyoh wow, now it works10:55
amee2huskyi think10:55
amee2huskyyep, the join somehow didn't work but it runs now :D10:58
amee2huskythat was a pretty debian worthy outdated package version fail :310:58
prologicjoin should work10:58
prologicalthough the server you're connecting to10:59
prologicmight not have spat out the same numeric event10:59
prologiccheck the debug logs10:59
amee2huskyi can see an 001 message from the server10:59
prologicdid you use Join or JOIN? :)11:00
prologicbe sure to have fired JOIN11:00
amee2huskyooh, right. missed that one11:00
amee2huskyi only fixed USER and NICK11:00
amee2huskyyay  \o/11:01
amee2huskybot is botting11:01
prologicawesome :)11:02
prologicall confusions sorted out?11:02
amee2huskyyeah i think so11:02
prologicwhat else can I help you with? :)11:02
amee2huskythe outdated package explains why the documentation didn't seem to match with anything11:02
prologic1.2 is so old it sin't even funny11:02
amee2huskyjust that typically the documentation is outdated more than the packages, so i tend to suspect that first11:02
prologic1.6 was the last mostly API compatible version with 2.x11:03
prologicbut even I wouldn't reocmmend using 1.611:03
prologicI always recommend using dev if you're going to use circuits seriously11:03
prologicbecause we test continuously11:03
amee2huskyhehe then i'll keep with that. it looks really cool from what i've seen so far11:03
amee2huskymuch easier to use than twisted, which i was thinking about first11:04
prologicyes you're not the first person to have asaid that :)11:04
prologicabout twisted11:04
amee2huskysomehow i'm not surprised :311:04
prologicso what's next on your agenda?11:05
amee2huskyplaying around with the IRC bot some more11:06
prologicwe're always around btw11:06
prologicwell at least I am :011:06
prologicAlso regarding Jabber11:06
prologicyou have two options:11:06
amee2huskyi have a simple script that polls an XMLRPC server and posts messages on IRC11:06
prologicwrap an existing jabber library in a Component11:06
prologicor (which I'd prefer)11:06
prologicwrite an XML protocol for circuits11:07
amee2huskyprobably gonna use that as guineapig and port it next11:07
prologicand then a Jabber protocol built on top of the XML one11:07
prologicyou know circuits also has a web framework?11:07
amee2huskyyup, seen that while browsing the documentation11:07
prologicHave a look at - it does something similar11:07
prologicIt listens for JSON requests and psots messages11:07
amee2huskyi'm trying to avoid making a clusterfuck of independent scripts... especially if i have an async framework with message passing functionality anyway11:08
amee2huskybecause thats exactly what i have at the moment. so i'd rather try to put everything into components and run it as a single process11:09
amee2huskyfeeding stuff through JSONRPC or XMLRPC links kinda feels like re-implementing the message passing functionality that already exists within the process anyway11:10
prologicthe very essence of circuits encourages and allows you to do this11:10
prologicit's all about components11:10
amee2huskyexactly :311:10
prologicand a loosely coupled architecture11:10
prologicso if you're up to it11:10
prologicwe'd love to have you onboard11:10
prologicat least to develop XML/Jabber components11:10
amee2huskyhehe, probably gonna be a bit before i get to that11:11
prologica while ago my bot kdb ( used to have Jabber support11:11
prologicjust wrapping a jabber library11:11
prologicworked okay-ish11:11
amee2huskyoh, and you can blame Romster for pointing me your way :311:11
prologickdb is horribly broken these days though11:12
prologicused to by the guinea-pig of circuits11:12
prologicuntil we developed a large vast many unit tests11:12
prologicI know Romster quite well :)11:12
prologicI introduced him to CRUX and Linux11:12
amee2huskycool :D11:12
amee2huskywe hang out in a bunch of channels together11:12
prologiche's been saying he'll spin up my wiki engine for a while now11:13
prologicbut hasn't yet :)11:13
prologicYes - also written in circuits11:13
amee2huskycool :D11:13
amee2huskymy favorite wiki is dokuwiki11:14
prologicmy favourite is sahriswiki :)11:16
prologicit uses creolewiki markup11:17
prologicvery easily themeable11:17
prologicpowered by the same engine :)11:17
prologicit's storage backend uses mercurial11:17
prologicso you can actually clone the wiki11:17
prologicand commit to it11:17
prologicpushing changes to it live11:17
amee2huskyi mostly use it for internal stuff so theming isn't that important at large. but i love that it just uses text files as backend... that makes stuf... easy :311:17
prologicfull macro support and a good set of macros11:17
prologicand most important of all11:18
prologictext, csv, html, wiki11:18
prologicand a few other mime types11:18
prologicoh the other nice thing about sahriswiki11:18
prologicno configuration required11:18
amee2huskyi don't get why "no configuration" is considered a feature11:20
amee2huskyno configuration usually means it does weird things that i don't want, from my exp11:20
prologicno configuration necessary by default11:22
prologicbut it also supports a configuration file :)11:22
prologicwhat I mean is it's as easy as:11:22
prologic$ sahriswiki11:22
prologicor maybe a few custom options11:22
prologic$ sahriswiki --config=my_config.ini11:22
amee2huskythen DW does that too >_>11:22
amee2huskyunpack tarball, enter a title and user/password for the admin account that you want, and it runs11:23
amee2huskybut what i hate is when things don't have config anymore at all, or the config options are undocumented and stashed away in weird places11:23
amee2huskylike i have an old laptop that has weird crashes.... i'm suspecting heat issues, but hard to confirm that because the BIOS menu only has the system time and boot order on it11:24
amee2huskythats totally useless11:25
amee2huskyor maybe some voltage regulator has dry caps and the output voltage is drooping11:26
prologicI should have said minimal configuration :)11:26
amee2huskybut hard to say anything if i can't see the sensor values11:26
amee2huskyok, gonna run off for a bit now... its half past 1 in my timezone and i want to get some lunch and go grocery shopping :311:32
amee2huskythanks for getting me started... i don't think i'd have figured that out on my own11:33
prologicyou're very welcome :)11:34
prologicyou're only issue was - old version :)11:34
amee2huskyheh yeah... i think mint 14 is out by now but i assume that version was old as fuck already when i installed the system in january11:35
amee2huskymint is based on debian and ubuntu, which is based on debian too.... thats probably how your package made its way into mint11:36
prologicI might ping the debian maintainer11:38
prologiche probably hasn't updated the package in a while11:38
amee2husky"debian package version syndrome" :311:39
*** irclogger___ has quit IRC14:49
*** irclogger___ has joined #circuits14:49
*** irclogger___ has joined #circuits15:36
*** irclogger___ has quit IRC16:17
*** irclogger___ has joined #circuits16:17
*** jgiorgi has quit IRC16:18
*** jgiorgi has joined #circuits16:20
*** koobs has quit IRC16:28
*** koobs has joined #circuits16:29
*** jgiorgi has quit IRC17:43
*** black_rez_ has joined #circuits18:08
*** spaceone has quit IRC18:14
*** amee2husky has quit IRC18:14
*** ChanServ has quit IRC18:14
*** black_rez has quit IRC18:14
*** ChanServ has joined #circuits18:31
*** amee2husky has joined #circuits18:32
*** spaceone has joined #circuits18:36
*** ChanServ has quit IRC18:44
*** ChanServ has joined #circuits18:49
*** ronny has joined #circuits18:57
*** ronny has quit IRC19:00
*** ronny has joined #circuits19:00
*** ronny has quit IRC19:06
*** ChanServ has quit IRC19:14
*** ChanServ has joined #circuits21:27
*** ChanServ has quit IRC21:27
prologicMorn'n all21:55
amee2huskyoh murr :322:00
amee2huskyour daily netsplit give us for today. amen.22:00
*** bleep has joined #circuits22:03
prologicI gotta go clean the patio and get ready for our gutests (mMother's Day)22:05
prologicGot any q's for me before I get going?22:05
amee2huskymmh actually yes22:06
amee2huskyi got one22:06
amee2huskythere is one pattern that i'm missing... suppose i have a bunch of components running, and i want to provide a centralized logging facility22:06
*** ChanServ has joined #circuits22:07
prologicexplicit logging?22:08
prologicor implicitly log all events?22:08
amee2huskybut i want to avoid opening the same log file individually from each component. do i have to make the logger component a singleton and pass the reference around everywhere?22:08
amee2huskyor is there a better way for that22:08
prologicDebugger logs all events22:08
prologicfrom circuits import Debugger22:08
amee2huskyno, explicit... like log("IRCBOT", "messages goes here")22:08
prologicahh yeap22:09
prologichave a look at my irclogger code22:09
amee2huskysort of like an internal syslog thing that maintains the log file, and all components can post messages to it22:09
prologicI wrote a Logger component that uses the async File component22:09
prologicI just fire Log events at it22:09
amee2huskyalready did, but it hangs the Logger components off the IRC bot one from what i can see22:09
prologicwhat did you want instead?22:10
prologicthe component can live anywhere22:10
amee2huskyi mean having several components at the same level in the hierarchy that can use the same logger22:10
prologicas long as it's part of the system somewhere22:10
prologichierarchy doesn't matter so much22:10
prologiconly for developer convenience and design22:10
amee2huskylike... what i'd normally do by just printing to the terminal22:10
prologicfrom import graph22:11
prologicwill spit out some text representing the graph of the system22:11
amee2huskyyeah, but events travel down the tree, right?22:11
prologicand output a .png visiaul of it as well22:11
prologicif you have pydot installed22:11
prologicpip install pydot22:11
prologicbut hierarchy doesn't matter so much22:11
prologicactually events don't travel down the tree22:11
prologicall event handlers in the component graph/tree are cached22:12
prologicso that lookups are O(1)22:12
prologicstrictly speaking it's not O(1)22:12
prologicit's probably O(log n)22:12
prologicbut we cache everything so it's quite fast22:12
amee2huskyso when i do then all running components can receive the event? not just the subtree below self?22:12
prologicwe only re-walk the tree when new components are registered or deregistered at runtime22:12
amee2huskyhmm interesting22:13
prologicbut only component that are interested in it22:13
prologiccircuits follows some design principles from pub/sub22:13
prologic2 things to keep in mind22:13
prologicevents and channels22:13
prologic2 component scan listen to the same kind of events22:13
prologicbut can do so on separate channels22:13
prologicthis means you can have for example two ircbots running in the same process22:14
prologicbut on separate channels22:14
*** jgiorgi has joined #circuits22:15
*** jgiorgi has quit IRC22:15
*** jgiorgi has joined #circuits22:15
amee2huskyhmm yeah, i think i got the channel abstraction right. but i was assuming that events propagate along the component tree, not globally22:15
prologicyeah no they don't I'm afraid22:15
prologicfor performance reasons22:16
prologicyou can think that they do :)22:16
prologicthe system would be very slow if we had to walk the tree each time to find an appropriate event handler22:16
prologicso we cache them in a mapping/dict22:16
prologicbut otherwise you can think of it like walking the tree22:16
amee2huskywell, in that case it is more of a feature that they don't :)22:16
prologicthere's no advantage to walking the tree to find an event handler22:17
prologicand strictly adhering to the shape of the graph22:17
prologicnone that we've seen22:17
prologicso we cache for performance22:17
amee2huskywell, being able to post a message to a subtree would have advantages in some cases22:17
prologicthere are however Bridge (from circuits import Bridge)22:17
prologicand Node (from circuits.node import Node)22:18
amee2huskybut i think it should always be possible to get the same effect with clever use of channels22:18
prologicso 2 or more systems in separate processes or nodes can be connected together22:18
prologicyou then end up with a larger system that is separated heterogeneously like networks are22:18
prologic<amee2husky> well, being able to post a message to a subtree would have advantages in some cases <-- you can still do this if you really want22:19
prologicbut you'd run the subtree in another thread22:19
prologicand disconnected it from the other system (directly)22:19
prologicand connect it via a Bridge or Node22:19
amee2huskyhmm i see22:19
amee2huskythen i'd have to make up my mind which subtrees i need beforehand, no?22:20
prologicbut yeah otherwise channels achieve this22:20
prologicand solve many use cases22:20
amee2huskyand then i can just use a channel name prefix to get the same effect22:20
prologicI honestly wouldn't worry about subtress right now22:20
prologicI'd just develop your components22:20
amee2huskywell, i don't anymore :)22:20
prologicmaking each component do one thing really well22:20
prologicloose coupled components22:20
amee2huskyhehe, the good old unix philosophy :322:20
prologicanyway gotta go :)22:21
amee2huskybut that means i have a bug somewhere... for some reason i didn't get messages to my logger component. thats why i started to question how they propagate in the first place22:21
amee2huskybut i'll do that tomorrow... its past midnight here and i'm waiting for my favorite TV show to start :)22:21
amee2huskythanks, and have fun :D22:22
*** prologic_ has joined #circuits23:22
*** prologic_ has quit IRC23:22
*** prologic_ has joined #circuits23:22
*** koobs has quit IRC23:38
*** koobs has joined #circuits23:50

Generated by 2.11.0 by Marius Gedminas - find it at!