-
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
-
arcriley
:-D
-
arcriley
just a few test regressions and debugs to cleanup and I think it'll be ready
-
arcriley
>>> s.send('</bar>') >>> s.root.pop() <bar>text content</bar>
-
bear
cool
-
arcriley
bear, so, lunch friday?
-
bear
sure
-
bear
do you have my number?
-
arcriley
yep its in my phone
-
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
-
bear
I'm flexible so let me know what time range is good friday - I can be in town in 20min
-
arcriley
awesome
-
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)
-
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.
-
bear
icky DOM is icky
-
arcriley
yea but its hard to implement xpath or xslt without it
- bear nods
-
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
-
bear
yea, python and stream processing are a bad mix
-
bear
need a middle ware solution that can be used by any script
-
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
-
bear
yea, but those are bolted onto a GIL that doesn't make for *real* event processing
-
Lance
python xml stream processing?
- Lance is interested
-
arcriley
Lance, yea nodetree.org - its nowhere near ready, but im about to push 0.3 release which adds this via nodetree.Stream class
-
bear
I was waiting for you :)
-
Lance
bear: he mentioned xpath :)
-
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
-
arcriley
one of my goals is to be able to implement stanza routing via xslt
-
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
-
Lance
arcriley if you want any help, let me know. this stuff would be great for sleekxmpp
-
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
-
Lance
ah, yeah
-
Lance
we switched to elementtree
-
bear
yea, elementtree is awesome(ish)
-
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
-
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
-
arcriley
there's several warts on the API like that
-
bear
yea, I'm holding my nose and not "seeing" those issues because it allows me to not use libxml2 ;)
-
arcriley
i'm not saying libxml2's api is any better :-)
-
arcriley
my favorite complaint about etree is how to serialize nodes
-
arcriley
et.tostring(node)
-
arcriley
vs str(node)
-
bear
oh yea
-
arcriley
i've already implemented the latter, plus repr(node) will give a formatted tree.
-
Lance
hah, yeah. we just made our own serializer, that handled namespaces a little more sanely
-
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
-
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
-
arcriley
the current code is in http://hg.nodetree.org/nodetree
-
arcriley
ignore the debug prints, they're kinda annoying, was tracking down memory management
-
Lance
arcriley: what are you trying to do better than elementtree with namespaces?
-
arcriley
i don't have a solid plan for namespaces yet, but etree's namespace handling is atrocious so not hard to improve on
-
arcriley
still brainstorming. until parsing was done it was kinda moot, and that just went in very recently
- bear goes to find dinner
-
Lance
arcriley you'll be at the summit?
-
arcriley
no can't afford to travel to europe right now. ill be at pycon tho
-
Lance
ok. i'll check out what you have so far and start playing with it
- Lance heads home
-
arcriley
0.3 should be going out tomorrow. doing cleanup and getting the docs in order now
-
arcriley
lance, you going to pycon btw?
-
arcriley
i submitted a proposal for a XMPP poster session, if you're going you should do it with me to talk about sleekxmpp
-
Lance
i hadn't planned on it, but I certainly can
-
Lance
when is it?
-
arcriley
the poster session is usually on sunday, so march 17
-
arcriley
santa clara, ca
-
Lance
ok. i'll see if work will pay for travel and i'll let you know
-
arcriley
http://us.pycon.org/
-
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
-
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
-
Lance
right :)
-
Lance
arcriley: I'm approved so I'll write up a profile today
-
arcriley
Lance, awesome ill invite you as a co-speaker for the poster
-
arcriley
also if you stay for the sprints we'll likely do xmpp stuff
-
arcriley
Lance Stout right?
-
Lance
yes
-
arcriley
cool invite sent
-
Lance
poor jabber.org server :(
-
arcriley
btw you in julython?
-
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.
-
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
-
Kev
No, I hadn't heard that. Thankfully I don't speak 'stupid'.
-
arcriley
http://betabeat.com/2013/01/anonymous-wants-ddos-considered-free-speech-hops-on-the-white-house-petition-bandwagon/
-
Kev
Ah. Excellent.
-
Kev
It isn't, incidentally, DDoS attacks on jabber.org as far as I can tell.
-
Kev
Just a bunch of kids who like to join a MUC, send a few hundred/thousand messages and leave.
-
Lance
no, I'm not in julython. didn't even know what it was
-
arcriley
Lance, yea our team is first place. our team being copyleft games - including our google code-in students :-)
-
Zash
arcriley: Haha, what the crap
-
arcriley
Zash, iptables is the new pepper spray
-
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