Skip to content

ximenesyuri/comp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  /0000000  /000000  /000000/0000   /000000 
 /00_____/ /00__  00| 00_  00_  00 /00__  00
| 00      | 00  \ 00| 00 \ 00 \ 00| 00  \ 00
| 00      | 00  | 00| 00 | 00 | 00| 00  | 00
|  0000000|  000000/| 00 | 00 | 00| 0000000/
 \_______/ \______/ |__/ |__/ |__/| 00____/ 
                                  | 00      
                                  | 00      
                                  |__/   

About

comp is a functional style component system for Python, presenting strong type safety through an extensive use of ximenesyuri/typed.

Overview

With comp you can construct components, which are typed functions (in the sense of ximenesyuri/typed) returning jinja strings (i.e, strings presenting a valid jinja syntax), constituting a type COMPONENT.

Components (i.e, instances of COMPONENT) have the structure determined by models (in the sense of ximenesyuri/typed). Furthermore, they can be composed through four component operations (join, concat, eval and copy), which corresponds, respectively, to certain magic methods in COMPONENT. This allow us to create derived components from primitive components by making use of component equations.

After constructed, components can be rendered into raw HTML strings by making use of the render service function. To render a component we need to pass a context, which is the minimum information needed to provide a sense to the component. This could include, for example, markdown content (which is rendered through python-markdown), rst content (rendered via docutils), other components, and so on. This flexibility allows the use of comp in both dynamic and static environments.

Components can also be previewed by putting them into a preview stack.

Install

With pip:

pip install git+https://github.com/ximenesyuri/comp 

With py:

py i ximenesyuri/comp

Documentation

See ximenesyuri/libs/comp.

About

A functional style component system for Python, based in Jinja2 and focused on typed safety.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages