Spitfire¶
Hello people!! Spitfire is currently the fastest python templating engine. It is used in YouTube’s servers to serve about 5 billion pages everyday.
It is just as simple as any other templating engine but faster(a lot).
“Any sufficiently advanced technology is indistinguishable from magic” ~ Arthur C. Clarke
To break it down to you, Spitfire has a compiler that optimizes and reduces the time taken by various operations. This makes Spitfire magically fast. No trade-offs, oure performance.
Some wonderful people initially created Spitfire for Python2, which wasn’t usable with the Python we know today (Python3). Since such a magical work fannot be left behind, this was ported to Python3.
Using it is as simple as:
1import spitfire
2env = spitfire.Environment()
3env.load_dir('templates')
4print(env.render('ample', {"name": "John", "age": 10}))
1$name is $age years old
2#set $gap = 18- $age
3#if ($age >= 18)
4 $name can drive a car or a bike.
5#else
6 $name can only ride a bicycle for now. Please wait for $gap years.
7#end if
Which returns:
John can only ride a bicycle for now. He needs to wait 8 years.
Pretty simple, right? Because it really is simple.
Check out the quickstart tutorial.