XSF Discussion - 2013-01-17

  1. arcriley

    >>> s = nodetree.Stream('<foo><bar>text content') >>> s.root.pop() Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: incomplete branch

  2. arcriley


  3. arcriley

    just a few test regressions and debugs to cleanup and I think it'll be ready

  4. arcriley

    >>> s.send('</bar>') >>> s.root.pop() <bar>text content</bar>

  5. bear


  6. arcriley

    bear, so, lunch friday?

  7. bear


  8. bear

    do you have my number?

  9. arcriley

    yep its in my phone

  10. arcriley

    the plan is (still need to buy bus tix) head up friday morning and back sat night, tho the event im going to has a wishy-washy schedule

  11. bear

    I'm flexible so let me know what time range is good friday - I can be in town in 20min

  12. arcriley


  13. arcriley

    btw i could use some ideas on how to represent namespaces in this api. i have a few, but its complicated by this not being a purely DOM model; a node can belong to nodes in multiple documents (tho not in the same document twice)

  14. arcriley

    the backend is libxml2 DOM but with a crazy complex linked list allowing a python object to hold multiple xml nodes while keeping the potential branches under them in sync.

  15. bear

    icky DOM is icky

  16. arcriley

    yea but its hard to implement xpath or xslt without it

  17. bear nods

  18. arcriley

    this project came from a convo i had with fritzy 2 years ago about the sad state of python xml packages and how much headache it was to implement xmpp, or any stream parsing, with them

  19. bear

    yea, python and stream processing are a bad mix

  20. bear

    need a middle ware solution that can be used by any script

  21. arcriley

    well python has had generators where yield can return a value (s.send() is an example) and coroutines for awhile, and has async now which uses that

  22. bear

    yea, but those are bolted onto a GIL that doesn't make for *real* event processing

  23. Lance

    python xml stream processing?

  24. Lance is interested

  25. arcriley

    Lance, yea nodetree.org - its nowhere near ready, but im about to push 0.3 release which adds this via nodetree.Stream class

  26. bear

    I was waiting for you :)

  27. Lance

    bear: he mentioned xpath :)

  28. arcriley

    no namespace support yet, no xpath/xslt support yet, but its going in as fast as i can. these early releases im mostly pushing to get feedback

  29. arcriley

    one of my goals is to be able to implement stanza routing via xslt

  30. arcriley

    i find a critical bug in the code for every hour or two i spend in it, too, though its becoming increasingly difficult to find the edge cases that produce them

  31. Lance

    arcriley if you want any help, let me know. this stuff would be great for sleekxmpp

  32. arcriley

    Lance, yea this came from a convo i had with fritzy regarding how much of a PITA it was to use lxml in sleekxmpp

  33. Lance

    ah, yeah

  34. Lance

    we switched to elementtree

  35. bear

    yea, elementtree is awesome(ish)

  36. arcriley

    plus, nodetree is already several times faster than either celementtree or lxml since we let libxml2 do the parsing, and lazy create the Python objects representing nodes on demand

  37. arcriley

    bear, elementtree is an awesome idea until you start to use it, and then it becomes a nightmare really fast. treating text nodes as a property of their parent element rather than as a node in the children list was a really bad design decision

  38. arcriley

    there's several warts on the API like that

  39. bear

    yea, I'm holding my nose and not "seeing" those issues because it allows me to not use libxml2 ;)

  40. arcriley

    i'm not saying libxml2's api is any better :-)

  41. arcriley

    my favorite complaint about etree is how to serialize nodes

  42. arcriley


  43. arcriley

    vs str(node)

  44. bear

    oh yea

  45. arcriley

    i've already implemented the latter, plus repr(node) will give a formatted tree.

  46. Lance

    hah, yeah. we just made our own serializer, that handled namespaces a little more sanely

  47. arcriley

    so in interactive python, if you type a node name by itself, you'll get it formatted with indentation/etc as above, and with repr() you can output that to a file should you choose

  48. arcriley

    Lance, would love your ideas on how to implement namespaces. obviously preserving both prefix and uri is important, and obviously namespace state needs to be carried with nodes when they're copied moved or disconnected from their parent, and obviously they should be able to be sanely managed from python programmatically

  49. arcriley

    the current code is in http://hg.nodetree.org/nodetree

  50. arcriley

    ignore the debug prints, they're kinda annoying, was tracking down memory management

  51. Lance

    arcriley: what are you trying to do better than elementtree with namespaces?

  52. arcriley

    i don't have a solid plan for namespaces yet, but etree's namespace handling is atrocious so not hard to improve on

  53. arcriley

    still brainstorming. until parsing was done it was kinda moot, and that just went in very recently

  54. bear goes to find dinner

  55. Lance

    arcriley you'll be at the summit?

  56. arcriley

    no can't afford to travel to europe right now. ill be at pycon tho

  57. Lance

    ok. i'll check out what you have so far and start playing with it

  58. Lance heads home

  59. arcriley

    0.3 should be going out tomorrow. doing cleanup and getting the docs in order now

  60. arcriley

    lance, you going to pycon btw?

  61. arcriley

    i submitted a proposal for a XMPP poster session, if you're going you should do it with me to talk about sleekxmpp

  62. Lance

    i hadn't planned on it, but I certainly can

  63. Lance

    when is it?

  64. arcriley

    the poster session is usually on sunday, so march 17

  65. arcriley

    santa clara, ca

  66. Lance

    ok. i'll see if work will pay for travel and i'll let you know

  67. arcriley


  68. arcriley

    cool. if you can, then draft up a quick speaker profile on the site (just login and go to account, you don't have to register first) and i can add you as a speaker for the session

  69. arcriley

    my experience with pycon poster sessions is you get a lot of people who're looking for a hammer for their pet screw, but its good to spread more general knowledge into the community. at the very least, have people know there's more to XMPP on Python than pyxmpp

  70. Lance

    right :)

  71. Lance

    arcriley: I'm approved so I'll write up a profile today

  72. arcriley

    Lance, awesome ill invite you as a co-speaker for the poster

  73. arcriley

    also if you stay for the sprints we'll likely do xmpp stuff

  74. arcriley

    Lance Stout right?

  75. Lance


  76. arcriley

    cool invite sent

  77. Lance

    poor jabber.org server :(

  78. arcriley

    btw you in julython?

  79. Kev

    Yes. I wonder if the extra load is related to a bunch of really cool 'flooders', who seem to be kids who want to be hackers but lack the inclination to do anything more complicated than sending lots of messages.

  80. arcriley

    Kev, but havent you heard, flooding internet services with traffic is the modern equivalent to a protest! and so any anti-flooding strategy you put in place, including filtering source addresses, is the same as having riot police break up a protest and squash their first amendment rights

  81. Kev

    No, I hadn't heard that. Thankfully I don't speak 'stupid'.

  82. arcriley


  83. Kev

    Ah. Excellent.

  84. Kev

    It isn't, incidentally, DDoS attacks on jabber.org as far as I can tell.

  85. Kev

    Just a bunch of kids who like to join a MUC, send a few hundred/thousand messages and leave.

  86. Lance

    no, I'm not in julython. didn't even know what it was

  87. arcriley

    Lance, yea our team is first place. our team being copyleft games - including our google code-in students :-)

  88. Zash

    arcriley: Haha, what the crap

  89. arcriley

    Zash, iptables is the new pepper spray

  90. arcriley

    i think the next logical response of course is to physically tear gas ddos kiddies homes, then beat and arrest them when they flee the building