summary of the progress on the integration of CubicWeb with pyramid debugtoolbar

Laurent Peuch cortex at worlddomination.be
Thu Sep 26 08:48:43 CEST 2019


Hello everyone,

During the previous weeks/months I've been working on improving debug
capacities and easiness of development within CubicWeb. I've already
shown a good part of my work/exploration during a Friday talk, you can
find the slides here https://psycojoker.github.io/logilab-pyramid-debugtool-2019/
(the recording of the talk sadly failed :/)

In the mean time I've made a lot of progress on integrating with the
pyramid debugtoolbar.

By default the toolbar isn't very interesting appart from an
integrated stacktrace debug page activated on a exception: there
integrated pdb like debug shell (like "you can use a python/pdb shell at
every frame of the stack to debug things") than can save you **a lot**
of time. Illustration: https://psycojoker.github.io/logilab-pyramid-debugtool-2019/img/pdt-7.png

So, here is the list of panels I've came up with, in order of
appearance:

Not the most interesting one: a general information panel with not
that much information
https://raw.githubusercontent.com/Psycojoker/logilab-pyramid-debugtool-2019/master/other_images/cw.png
(it wasn't a priority as there is already /siteinfo)

Much more interesting but still a bit experimental: a hierarchy of
class used for rendering the current page with their key in the
registry https://raw.githubusercontent.com/Psycojoker/logilab-pyramid-debugtool-2019/master/other_images/rendering.png
For now the mechanism to get the parent class is still experimental
(and a bit hackish) so it doesn't succeed all the time.

A list of all decisions taken by the registries for rendering a page
with the weight of all candidates and the arguments used to take this
decision https://raw.githubusercontent.com/Psycojoker/logilab-pyramid-debugtool-2019/master/other_images/registry_decisions.png

A bit like in /siteinfo but with more information, the content of the
registries https://raw.githubusercontent.com/Psycojoker/logilab-pyramid-debugtool-2019/master/other_images/registry.png

Like show in the talk but enhanced with syntax highlight and the SQL
queries generated by the RQL query, the RQL panel
https://raw.githubusercontent.com/Psycojoker/logilab-pyramid-debugtool-2019/master/other_images/rql.png
witch also include a traceback for every query
https://raw.githubusercontent.com/Psycojoker/logilab-pyramid-debugtool-2019/master/other_images/rql_stack.png

In the same fashion, the SQL panel (with parent RQL queries) and also
a traceback https://raw.githubusercontent.com/Psycojoker/logilab-pyramid-debugtool-2019/master/other_images/sql.png

And last one, a panel for the called hooks
https://raw.githubusercontent.com/Psycojoker/logilab-pyramid-debugtool-2019/master/other_images/hooks.png
This one is a bit special because hooks only happen on POST requests
(and during startup/shutdown of the server) and CW only show pages on
a GET request (which never triggers hooks), so the called hooks in
this panel are ALL the hooks called during your current session.

And the additional feature for *all* panel: whenever you click on the
"<>" next to an object/class on a panel and one every file path in a
call stack you'll be able to see the source file containing the class
definition of the line of the call stack :
https://raw.githubusercontent.com/Psycojoker/logilab-pyramid-debugtool-2019/master/other_images/source.png
https://raw.githubusercontent.com/Psycojoker/logilab-pyramid-debugtool-2019/master/other_images/source2.png
(for security reason only white listed files are accessible)

Of course, all of this only activate itself on the pyramid dev server
when the debug mode ("-D") is activated and the pyramid debugtoolbar
is installed.

All this work is available on my repository (well except the last
"link to files in the traceback" stuff that I need to clean)
https://hg.logilab.org/users/lpeuch/cubicweb (there are also various
other debugging improvement that you can find here that I haven't
listed in the email nor during the talk.)

With some luck we'll see those or another form of those in the next
release,

Have a nice day :)

-- 

Laurent Peuch -- Bram



More information about the cubicweb-devel mailing list