About Pyke

# About Pyke ## What Does Pyke Do for Me? Pyke was primarily designed to allow you to "cook" your Python code. You write Python code, and then you write Pyke code to cook that Python code -- i.e. to assemble the Python functions that you've written and customize them for a specific situation or use-case. Pyke can also be used for difficult decision making applications where each part of the problem has multiple possible solutions and the selection of a solution to one part of the problem affects whether another part of the problem can be solved or not. ## Cooking Your Python Code Cooking your Python code is a form of meta-programming, or writing programs that manipulate other programs. I.e., it's a means of programming in the large. Thus, Pyke provides a way to directly "program in the large", which dovetails with using Python to "program in the small". Pyke supplements but does not replace Python! Pyke helps programmers to achieve order of magnitude improvements in: Adaptability/Customization Using Pyke allows your Python code to be combined into thousands of different configurations. Thus, your application or library takes on the characteristics of a Domain Specific Language to achieve an order of magnitude increase in adaptability without a corresponding increase in your program's "surface area" to your users. Performance Thinking of your application or library as a Domain Specific Language (DSL), you're using Pyke to "compile" rather than "interpret" your DSL to achieve an order of magnitude improvement in performance. Code Reuse Making your code an order of magnitude more adaptable and an order of magnitude faster allows it to be (re)used in a correspondingly broader range of situations. ## Examples of Cooking Python Code ### Database Access Library You're writing a library package to make it easier for Python programmers to access relational databases. You write Python code that deals with the mechanics of accessing relational databases, and then you write Pyke code to make a cooked version of this code for each database access with your user's application. You might also use Pyke to provide help installing and configuring the database and help creating the schema. By taking this approach, your library will be an order of magnitude faster than competing database access libraries because you've used Pyke to essentially compile custom code for each database access. The sqlgen example demonstrates this approach. ### HTML Templating Library Or you're writing an HTML templating package to make it easier for Python programmers to generate HTML. You write Python code that deals with the mechanics of HTML, and then you write Pyke code to make a cooked version of this code for each HTML template. By taking this approach, your library will be an order of magnitude faster than competing HTML templating libraries because you've used Pyke to essentially compile custom code for each HTML template. The web_framework example demonstrates this approach. It uses the sqlgen example to make a little web framework. The 2 HTML templates in this example were also done in TurboGears 2 and then a siege benchmark test done on both: TurboGears 2 ran 75.83 transactions/sec The Pyke example ran 791.01 transactions/sec ### Linux Configuration Program Or you're writing a new Linux configuration program. You write the Python code to query and set the various system configuration options, and then you write Pyke code to ask the user what he wants and build a cooked version of your code to make the necessary changes. In this case, you're not looking for performance. You use Pyke to handle the complicated decision making and use its plan facility to postpone making any configuration changes until your program is sure that it's "dotted all of the i's and crossed all the t's".
Copyright © 2007-2009 Bruce Frederiksen

Page last modified Mon, Nov 02 2009.