-
Notifications
You must be signed in to change notification settings - Fork 57
Importer callbacks #110
Importer callbacks #110
Conversation
|
@amcgregor apologies about the back-and-forth about iterators. After flipping back and forth between the two I ended up sticking with the for-loop since it was way simpler (and with tuples it's not actually any worse performance-wise / memory-wise) |
|
@asottile Hmm. The use case I was imaging was: @Cache # Pretend this is heavily cached.
@cast # typecast using Py3 annotations
def custom_importer(url: URL):
if not url.startswith('asset://'): return
for style in Asset.objects.get(path=url.path).scalar('styles'):
yield URL(url, fragment=style.reference).render(), style.content
|
|
Yeah that makes sense. They still need to be concretely serialized before we pass them to libsass anyway so it's kinda not worth it so much. I think if we find it being a problem we can revisit it but without library support it's still going to be an issue (and at some eventual point they all need to be serialized to build the whole css document :)) |
|
Certainly! I was just hoping to avoid excessive string duplication. (I use Pypy, so I don't have an expectation that the memory will be freed immediately upon the last reference decrement for an object; cleanup is deferred to "some point in the future", so early tends to be best. ;) |
|
@amcgregor can you try this out and see if works for your usecases? |
|
LLVM Clang spits out a lot of warnings from the As well as some weirder ones: And finally, during final linking: None of these should particularly impact usage. After installation I can confirm that my generator use is correctly packed down into a tuple for delivery to the C side. Looks good! 💃 |
|
Good enough for me :) I'll release a version later today |
|
Thanks again for all your work on this :D |
|
@asottile It never hurts to help, though I only really got the ball rolling on it. :P Still looking forward to that version bump, though! |
|
Oh derp, I will definitely do it today. I got super busy last time heh. |
|
This is available in 0.10.0 \o/ |
|
👍
|
No description provided.