User:Mstone/Tricks: Difference between revisions

From OLPC
Jump to navigation Jump to search
mNo edit summary
Line 1: Line 1:
; verbose python tracebacks
==== Verbose Python Tracebacks ====
: Just import [http://teach.laptop.org/~mstone/nice_traces.py nice_traces]; if you're feeling fancy, then consider <tt>trace(sys.exc_info())</tt>


; handy report() function
Just import [http://teach.laptop.org/~mstone/nice_traces.py nice_traces]; if you're feeling fancy, then consider <tt>trace(sys.exc_info())</tt>
: See [http://dev.laptop.org/git?p=projects/mocktools;a=blob;f=trac_helper.py;hb=HEAD trac_helper.py]


; pythonic relations
==== Handy report() function ====
: See my [http://dev.laptop.org/git/users/mstone/relation relation] module and [http://alloy.mit.edu Alloy] (which was my inspiration, though I've made nothing more than a poor knockoff).


; relational error logging
See [http://dev.laptop.org/git?p=projects/mocktools;a=blob;f=trac_helper.py;hb=HEAD trac_helper.py]
: See [http://dev.laptop.org/git?p=projects/mocktools;a=blob;f=trac_helper.py;hb=HEAD trac_helper.py] and [http://dev.laptop.org/git?p=projects/buildtools;a=blob;f=collect-pkgs.py;hb=HEAD collect-pkgs.py].


; email-based error reporting
==== Pythonic relations ====
: See [http://dev.laptop.org/git?p=projects/buildtools;a=blob;f=email_warnings.py;hb=HEAD email_warnings.py].


; rpm makefiles
See my [http://dev.laptop.org/git/users/mstone/relation relation] module and [http://alloy.mit.edu Alloy] (which was my inspiration, though I've made nothing more than a poor knockoff).
: See [http://dev.laptop.org/git?p=users/mstone/rpm-packaging;a=tree rpm-packaging] as well as individual projects like [http://dev.laptop.org/git/projects/olpc-netutils] along with my [[Developer/Fedora#Outside Reading|Fedora packaging bibliography]].


; pymeta parser-based controllers
==== Relational error logging ====
: [http://dev.laptop.org/git?p=users/mstone/triagebot;a=blob;f=grammar.py;hb=grammar triagebot] is based on a model-view-controller architecture where the controller object is assembled at runtime based on data collected with a metaclass.
: [https://launchpad.net/pymeta pymeta] makes it easy to pick the right response to complicated input.


; python gdb macros
See [http://dev.laptop.org/git?p=projects/mocktools;a=blob;f=trac_helper.py;hb=HEAD trac_helper.py] and [http://dev.laptop.org/git?p=projects/buildtools;a=blob;f=collect-pkgs.py;hb=HEAD collect-pkgs.py].
: http://wiki.python.org/moin/DebuggingWithGdb


; python memory profiling
==== Email-based error reporting ====
: [http://dev.laptop.org/git/users/mstone/guppy guppy] + Tomeu's [[memory leak testing]] writeup.


; tree-based python context management
See [http://dev.laptop.org/git?p=projects/buildtools;a=blob;f=email_warnings.py;hb=HEAD email_warnings.py].
: [http://dev.laptop.org/git?p=users/mstone/puritan;a=blob;f=main.py;hb=f9#l16 puritan's main.py]


; code to make pylint happy
==== RPM Makefiles ====
: rainbow's [http://dev.laptop.org/git?p=users/mstone/security;a=blob;f=rainbow/rainbow/inject.py;hb=cli inject.py] can be automatically checked for many errors by [http://www.logilab.org/project/pylint pylint] because it passes all data explicitly through function calls.


; C error handling
See [http://dev.laptop.org/git?p=users/mstone/rpm-packaging;a=tree rpm-packaging] as well as individual projects like [http://dev.laptop.org/git/projects/olpc-netutils] along with my [[Developer/Fedora#Outside Reading|Fedora packaging bibliography]].
: [http://dev.laptop.org/git?p=users/mstone/nss-rainbow;a=tree nss-rainbow] uses a dash of code-generation to be very consistent about error detection and handling.

==== pymeta parser-based controllers ====

[http://dev.laptop.org/git?p=users/mstone/triagebot;a=blob;f=grammar.py;hb=grammar triagebot] is based on a model-view-controller architecture where the controller object is assembled at runtime based on data collected with a metaclass. [https://launchpad.net/pymeta pymeta] makes it easy to pick the right response to complicated input.

==== Python GDB Macros ====

http://wiki.python.org/moin/DebuggingWithGdb

==== Tree-based python context management ====

[http://dev.laptop.org/git?p=users/mstone/puritan;a=blob;f=main.py;hb=f9#l16 puritan's main.py]

==== Eschew object-orientation ====

rainbow's [http://dev.laptop.org/git?p=users/mstone/security;a=blob;f=rainbow/rainbow/inject.py;hb=cli inject.py] can be automatically checked for many errors by [http://www.logilab.org/project/pylint pylint] because it passes all data explicitly through function calls.

==== C error handling ====

[http://dev.laptop.org/git?p=users/mstone/nss-rainbow;a=tree nss-rainbow] uses a dash of code-generation to be very consistent about error detection and handling.

Revision as of 00:53, 24 September 2008

verbose python tracebacks
Just import nice_traces; if you're feeling fancy, then consider trace(sys.exc_info())
handy report() function
See trac_helper.py
pythonic relations
See my relation module and Alloy (which was my inspiration, though I've made nothing more than a poor knockoff).
relational error logging
See trac_helper.py and collect-pkgs.py.
email-based error reporting
See email_warnings.py.
rpm makefiles
See rpm-packaging as well as individual projects like [1] along with my Fedora packaging bibliography.
pymeta parser-based controllers
triagebot is based on a model-view-controller architecture where the controller object is assembled at runtime based on data collected with a metaclass.
pymeta makes it easy to pick the right response to complicated input.
python gdb macros
http://wiki.python.org/moin/DebuggingWithGdb
python memory profiling
guppy + Tomeu's memory leak testing writeup.
tree-based python context management
puritan's main.py
code to make pylint happy
rainbow's inject.py can be automatically checked for many errors by pylint because it passes all data explicitly through function calls.
C error handling
nss-rainbow uses a dash of code-generation to be very consistent about error detection and handling.