Giter Site home page Giter Site logo

pyhtml's Introduction

pyhtml

Simple functional python HTML templating DSL

performance

Running benchmarks 100 times each... pyhtml template 45.13 ms

Django template 269.48 ms

Django template autoescaped 271.02 ms

Jinja2 template 11.14 ms

Jinja2 template autoescaped 31.68 ms

Mako template 8.00 ms

Mako template autoescaped 23.65 ms

Python string template 50.64 ms

Python list concatenation 5.94 ms

6x faster than django!!

The codebase is very rough at the moment, but I have a simple working proof of concept.

The entire page is a function that consists of a series of nested functions or lists of functions.

Calling the function will render the page, (or just calling render(tree_of_functions))

It's trivial to write blocks or sections, which can then be incorporated into the main render. (i.e. sub_block_demo)

Since everything is a function, it's easy to write (iter(dict) --> table), so good scope for code reuse.

I think there's a lot of room for improvement, i wonder if i may have gone overboard with the lambdas, or if there's some more terse ways of representing what i want.

Very keen to hear any feedback anyone might have.

For usage, see main.py...

Should be trivial to incorporate into various python frameworks.

colaborators welcome

pyhtml's People

Contributors

bradder555 avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.