- 1. SOFA Paton-Simpson & Associates Ltd Auckland, New
Zealand SOFA Statistics Developing, packaging, & promoting a
Python open source project Grant Paton-Simpson
sofastatistics.com
2. SOFA Paton-Simpson & Associates Ltd Auckland, New Zealand
Overview
- Introducing the SOFA project 3. wxPython 4. Launchpad,
Freshmeat and Sourceforge 5. Making debian packages 6. Making a
Windows installer
7. SOFA Paton-Simpson & Associates Ltd Auckland, New Zealand
The SOFA Project
- Statistics Open For All
- Statistics, analysis & reporting 8. Open source (AGPL3)
norestrictions on commercial use etc 9. Cross-platform
- Video (please interrupt with questions) 10. Website
- Appearances matter 11. Quick taste of what SOFA is andwhy they
might want it 12. Easy to download
13. SOFA Architecture SQLite MySQL MS Access ... SOFA Linkingnot
importing Scripts ready to glue together etc HTML(spreadsheet-
friendly) 14. HTML Output
- Tree-based for each dimension 15. Created an artificial limit
of 5000 cells 16. Scales linearly and Python not the
bottleneck
17.
- Import from Excel and SPSS etc 18. Looking at Statlib for basic
statistical tests 19. Want to choose a library for charting 20.
Want to add own interactive visualisations for explainingt-tests
etc 21. Not trying to compete with R (or RK Ward) 22. Focus on
making the most common needs easy to satisfy 23. Plugin extensions
for rest
SOFA Paton-Simpson & Associates Ltd Auckland, New Zealand
Next Steps 24.
- 50% coding script-based solutions 25. 50% adding GUI 26.
Another 50% enabling installation 27. Yet another 50% setting up
website, bazaar, Launchpad, Sourceforge, Freshmeat, making
screencast for ShowMeDo, writing articles, giving presentations etc
28. Why?
- Complete control over the tools I rely on as an analyst 29.
Open source is a positive contribution 30. Nice to have a large,
long-term projectto keep refining
SOFA Paton-Simpson & Associates Ltd Auckland, New Zealand
Running a Project 31.
- Python-focused 32. I benefited from the screencast on debian
packaging 33. Great way of coping with bandwidth if your project
takes off 34. Video is like screenshots on steroids gives people a
real taste 35. Used gtk-recordmydesktopwhich is very easy
SOFA Paton-Simpson & Associates Ltd Auckland, New Zealand
ShowMeDo Videos 36. wxPython GUI Toolkit
- Cross-platform and native widgets
Ubuntu(Dust theme) Windows XP 37.
- wxPython in Action Great book 38. Mailing list (with Robin Dunn
a very regularcontributor) 39. Lots of online documentation (but
can be a little bit terse) 40. There is a GUI for making GUIs but I
prefer handcoding
- Clean 41. Can make GUI plugins e.g. SOFA database
configuration
- Lots of sophisticated, configurable widgets
- Was able to make a data entry table work like I thought it
should e.g. new row has column label of , behaviour when
tabbing
- Focus on grid control
SOFA Paton-Simpson & Associates Ltd Auckland, New Zealand
Documentation & Community 42.
- When linking to data need to subclass wx.grid.PyGridTableBase
43. Need to implement methods such as GetNumberCols() 44. With
flexibility and power comes some complexity to handle 45. The
internal documentation is sometimes longer than the code itself 46.
700 lines to make the data grid you saw in the video (including
validation, ability to add new rows and edit values etc) 47. 1/6
were comments
SOFA Paton-Simpson & Associates Ltd Auckland, New Zealand
wx.Grid 48. Example grid code 49. SOFA Paton-Simpson &
Associates Ltd Auckland, New Zealand Custom Controls 50.
- When creating a custom control e.g. a composite control, need
to subclass wx.PyControl 51. Getting good documentation takes some
resourcefulness having a good working example the key 52. The
custom control is utilised as part of a custom cell editor 53. To
make a custom cell editor need to subclass wx.grid.PyGridCellEditor
54. Adequately documented
SOFA Paton-Simpson & Associates Ltd Auckland, New Zealand
wx.PyControl 55.
- Need to be able to cope with enormous tables as large as MySQL
etc can throw at us 56. GetValue() best with unique key (using
ORDER BY and LIMIT does not scale) 57. Also need caching 58. Can
now scroll large tables with lots of columns e.g. 200,000 records
and 20 columns
SOFA Paton-Simpson & Associates Ltd Auckland, New Zealand
Grid Performance 59.
- Option of label display e.g. Male not 1 60. Conditional
formatting e.g. all values > 1000 red etc 61. Choice of toolkit
very important - can it support what you want to do or will you hit
a wall? 62. If I wanted to display sparklines or pie charts as
cells in a table could I?
SOFA Paton-Simpson & Associates Ltd Auckland, New Zealand
Grid Plans 63.
- Not either/or can still have project releases in Sourceforge as
well plus a Freshmeat project 64. Why Launchpad?
- Ubuntu and Canonical good fit for me (my main platform) 65.
Uses modern distributed version control software (Bazaar) 66. Lots
of developer resources and ongoing development 67. Corporate
backing a safe bet
SOFA Paton-Simpson & Associates Ltd Auckland, New Zealand
Launchpad 68.
- Modern distributed version control 69. Built in Python 70.
Documentation seemed pitched at my level 71. Very simple commands
- bzr add importer.py 72. bzr commit -m Added ability to import
from Excel 73. bzr push
- Can grow with the project 74. Uses modern Ubuntu
notifications
SOFA Paton-Simpson & Associates Ltd Auckland, New Zealand
Bazaar 75.
- Putting the open into open source 76. Also written in Python
77. A web viewer for bazaar projects
Loggerhead 78.
- Initially very daunted could I even do this? 79. Found ShowMeDo
video by Austrian Horst Jens
- His example was a Python project so very similar requirements
80. Ended up with very detailed step-by-step guidelines for
packaging SOFA Statistics
- Have small handful of files with content I reuse for each
package e.g. rules 81. Using AGPL so needed to editcopyright file
by hand
SOFA Paton-Simpson & Associates Ltd Auckland, New Zealand
Making Debian Package (for Ubuntu) 82.
- rules is mainly for shifting files into destination 83. NB
installing application for all users, not a given user
- Files are put into /usr/share/pyshared/sofa/... 84. Any files
needed by an individual user are transferred during first use of
application /home/username/sofa/...
- control is for versioning, developer details, and dependencies
e.g. Depends: python (>=2.6.2-0ubuntu1), wx-common
(>=2.8.9.2-2), 85. distro-specific so may not be a simplematter
of using alien to make rpms
SOFA Paton-Simpson & Associates Ltd Auckland, New Zealand
Making Debian Package cont ... 86.
- Nullsoft Scriptable Install System.Free. Used by Firefox,
OpenOffice etc 87. Weird language cross between PHP and assembler
88. Macros can take parameters but functions cannot 89. No
functions inside sections 90. Plenty of documentation etc but best
to start and then extend 91. One glitch was including all files in
installer, whether or not used by version (solution different info
has to be in different files which are then included) 92. Issue
file size.Including mysqldb, numpy, wxpython, sqlite, python 93.
Put program in Program Files and user files inDocuments and
Settingsusernamesofa...
SOFA Paton-Simpson & Associates Ltd Auckland, New Zealand
NSIS Windows Installer 94.
- Running a new project can be exciting 95. Lots of new learning
96. Someone has to take out the trash (hint it's you ;-)) 97.
Phenomenal resources available in open source world 98. Python
packaging still a work-in-progress but should shake down
SOFA Paton-Simpson & Associates Ltd Auckland, New Zealand
Final Thoughts