Re: [web2py] ipython is your friend!
I like IPython On Sunday, February 10, 2013 6:20:30 AM UTC-5, Ramos wrote: +1 for a VIDEO of this... 2013/2/9 JimK jke...@gmail.com javascript: One of the nice things about python modules that are not c-compiled is the fact that you can read the source code. The bad part is that the source code is not always easy to find. This is where ipython comes in. IPython is an alternative to the regular python interpreter which offers a bunch of niceties. This interpreter is supported by web2py out of the box; just install ipython (pip install ipython) and start web2py at the command prompt (python web2py.py -S appname -M). This will load the web2py environment for your application and it's models using the ipython interpreter. I won't go through them all, but rather just a couple that really come in handy for me during web2py development. Let's say you want to see the doc string for SQLFORM: In [2]: form = SQLFORM?return ipython display a scrollable doc string (type 'q' to exit the doc string viewer) Now you want to see the source code of the SQLFORM class: In [3]: form = SQLFORM??return ipython now shows the entire SQLFORM class Let's say you want to just see all of the methods that SQLFORM has to offer: In [5]: SQLFORM.tab SQLFORM.AUTOTYPES SQLFORM.assert_status SQLFORM.grid SQLFORM.search_menu SQLFORM.FIELDKEY_DELETE_RECORDSQLFORM.build_query SQLFORM.hidden_fields SQLFORM.sibling SQLFORM.FIELDNAME_REQUEST_DELETE SQLFORM.confirm SQLFORM.insertSQLFORM.siblings SQLFORM.ID_LABEL_SUFFIX SQLFORM.createform SQLFORM.mro SQLFORM.smartdictform SQLFORM.ID_ROW_SUFFIX SQLFORM.dictform SQLFORM.process SQLFORM.smartgrid SQLFORM.REDIRECT_JS SQLFORM.element SQLFORM.regex_attrSQLFORM.tag SQLFORM.accepts SQLFORM.elements SQLFORM.regex_class SQLFORM.update SQLFORM.add_buttonSQLFORM.factory SQLFORM.regex_id SQLFORM.validate SQLFORM.add_class SQLFORM.flatten SQLFORM.regex_tag SQLFORM.widgets SQLFORM.appendSQLFORM.formstyles SQLFORM.remove_class SQLFORM.xml Finally, if you want to dig into any of those methods, like smartgrid: In [6]: SQLFORM.smartgrid?return or In [7]: SQLFORM.smartgrid??return and since the SQLFORM code is well documented and the argument names are descriptive, you should be able to figure out more problems on your own. This is just a taste of what you can do with ipython. It can also display more detailed traceback messages, run os-level commands without exiting the interpreter, debug code, etc. I hope this helps a bit! Jim -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] ipython is your friend!
+1 for a VIDEO of this... 2013/2/9 JimK jkel...@gmail.com One of the nice things about python modules that are not c-compiled is the fact that you can read the source code. The bad part is that the source code is not always easy to find. This is where ipython comes in. IPython is an alternative to the regular python interpreter which offers a bunch of niceties. This interpreter is supported by web2py out of the box; just install ipython (pip install ipython) and start web2py at the command prompt (python web2py.py -S appname -M). This will load the web2py environment for your application and it's models using the ipython interpreter. I won't go through them all, but rather just a couple that really come in handy for me during web2py development. Let's say you want to see the doc string for SQLFORM: In [2]: form = SQLFORM?return ipython display a scrollable doc string (type 'q' to exit the doc string viewer) Now you want to see the source code of the SQLFORM class: In [3]: form = SQLFORM??return ipython now shows the entire SQLFORM class Let's say you want to just see all of the methods that SQLFORM has to offer: In [5]: SQLFORM.tab SQLFORM.AUTOTYPES SQLFORM.assert_status SQLFORM.grid SQLFORM.search_menu SQLFORM.FIELDKEY_DELETE_RECORDSQLFORM.build_query SQLFORM.hidden_fields SQLFORM.sibling SQLFORM.FIELDNAME_REQUEST_DELETE SQLFORM.confirm SQLFORM.insertSQLFORM.siblings SQLFORM.ID_LABEL_SUFFIX SQLFORM.createform SQLFORM.mro SQLFORM.smartdictform SQLFORM.ID_ROW_SUFFIX SQLFORM.dictform SQLFORM.process SQLFORM.smartgrid SQLFORM.REDIRECT_JS SQLFORM.element SQLFORM.regex_attrSQLFORM.tag SQLFORM.accepts SQLFORM.elements SQLFORM.regex_class SQLFORM.update SQLFORM.add_buttonSQLFORM.factory SQLFORM.regex_id SQLFORM.validate SQLFORM.add_class SQLFORM.flatten SQLFORM.regex_tag SQLFORM.widgets SQLFORM.appendSQLFORM.formstyles SQLFORM.remove_class SQLFORM.xml Finally, if you want to dig into any of those methods, like smartgrid: In [6]: SQLFORM.smartgrid?return or In [7]: SQLFORM.smartgrid??return and since the SQLFORM code is well documented and the argument names are descriptive, you should be able to figure out more problems on your own. This is just a taste of what you can do with ipython. It can also display more detailed traceback messages, run os-level commands without exiting the interpreter, debug code, etc. I hope this helps a bit! Jim -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] ipython is your friend!
One of the nice things about python modules that are not c-compiled is the fact that you can read the source code. The bad part is that the source code is not always easy to find. This is where ipython comes in. IPython is an alternative to the regular python interpreter which offers a bunch of niceties. This interpreter is supported by web2py out of the box; just install ipython (pip install ipython) and start web2py at the command prompt (python web2py.py -S appname -M). This will load the web2py environment for your application and it's models using the ipython interpreter. I won't go through them all, but rather just a couple that really come in handy for me during web2py development. Let's say you want to see the doc string for SQLFORM: In [2]: form = SQLFORM?return ipython display a scrollable doc string (type 'q' to exit the doc string viewer) Now you want to see the source code of the SQLFORM class: In [3]: form = SQLFORM??return ipython now shows the entire SQLFORM class Let's say you want to just see all of the methods that SQLFORM has to offer: In [5]: SQLFORM.tab SQLFORM.AUTOTYPES SQLFORM.assert_status SQLFORM.grid SQLFORM.search_menu SQLFORM.FIELDKEY_DELETE_RECORDSQLFORM.build_query SQLFORM.hidden_fields SQLFORM.sibling SQLFORM.FIELDNAME_REQUEST_DELETE SQLFORM.confirm SQLFORM.insertSQLFORM.siblings SQLFORM.ID_LABEL_SUFFIX SQLFORM.createform SQLFORM.mro SQLFORM.smartdictform SQLFORM.ID_ROW_SUFFIX SQLFORM.dictform SQLFORM.process SQLFORM.smartgrid SQLFORM.REDIRECT_JS SQLFORM.element SQLFORM.regex_attrSQLFORM.tag SQLFORM.accepts SQLFORM.elements SQLFORM.regex_class SQLFORM.update SQLFORM.add_buttonSQLFORM.factory SQLFORM.regex_id SQLFORM.validate SQLFORM.add_class SQLFORM.flatten SQLFORM.regex_tag SQLFORM.widgets SQLFORM.appendSQLFORM.formstyles SQLFORM.remove_class SQLFORM.xml Finally, if you want to dig into any of those methods, like smartgrid: In [6]: SQLFORM.smartgrid?return or In [7]: SQLFORM.smartgrid??return and since the SQLFORM code is well documented and the argument names are descriptive, you should be able to figure out more problems on your own. This is just a taste of what you can do with ipython. It can also display more detailed traceback messages, run os-level commands without exiting the interpreter, debug code, etc. I hope this helps a bit! Jim -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.