line_profiler is a module for doing line-by-line profiling of functions.
kernprof is a convenient script for running either line_profiler or the standard
library's cProfile module.
HG Repo: http://www.enthought.com/~rkern/cgi-bin/hgwebdir.cgi/line_profiler/
Just kernprof: http://packages.python.org/line_profiler/kernprof.py
line_profiler will time individual statements in specified functions. For example,
here are the results of profiling a single function from a decorated version of
the pystone.py benchmark (the first two lines are output from pystone.py)::
Pystone(1.1) time for 50000 passes = 2.48
This machine benchmarks at 20161.3 pystones/second
Wrote profile results to pystone.py.lprof
Timer unit: 1e-06 s
Function: Proc2 at line 149
Total time: 0.606656 s
Line # Hits Time Per Hit % Time Line Contents
150 def Proc2(IntParIO):
151 50000 82003 1.6 13.5 IntLoc = IntParIO + 10
152 50000 63162 1.3 10.4 while 1:
153 50000 69065 1.4 11.4 if Char1Glob == 'A':
154 50000 66354 1.3 10.9 IntLoc = IntLoc - 1
155 50000 67263 1.3 11.1 IntParIO = IntLoc - IntGlob
156 50000 65494 1.3 10.8 EnumLoc = Ident1
157 50000 68001 1.4 11.2 if EnumLoc == Ident1:
158 50000 63739 1.3 10.5 break
159 50000 61575 1.2 10.1 return IntParIO
kernprof will run your scripts under one of cProfiler or line_profiler in a
variety of convenient ways. It has a few main features:
* Encapsulation of profiling concerns. You do not have to modify your script
in order to initiate profiling and save the results.
* Robust script execution. Many scripts require things like __name__,
__file__, and sys.path to be set relative to it. A naive approach at
encapsulation would just use execfile(), but many scripts which rely on
that information will fail. kernprof will set those variables correctly
before executing the script.
* Easy executable location. If you are profiling an application installed on
your PATH, you can just give the name of the executable. If kernprof does
not find the given script in the current directory, it will search your
PATH for it.
* Inserting the profiler into __builtins__. Sometimes, you just want to
profile a small part of your code. With the [-b/--builtin] argument, the
Profiler will be instantiated and inserted into your __builtins__ with the
name "profile". It may be used as a decorator on the targeted functions.
* Pre-profiling setup. With the [-s/--setup] option, you can provide
a script which will be executed without profiling before executing the
main script. This is typically useful for cases where imports of large
libraries like wxPython or VTK are interfering with your results.
The results of profile script_to_profile.py will be written to
script_to_profile.py.prof by default. It will be a typical marshalled file that
can be read with pstats.Stats(). They may be interactively viewed with the
$ python -m pstats script_to_profile.py.prof
Such files may also be viewed with graphical tools like kcachegrind_ through the
converter program pyprof2calltree_ or RunSnakeRun_.
.. _kcachegrind: http://kcachegrind.sourceforge.net/html/Home.html
.. _pyprof2calltree: http://pypi.python.org/pypi/pyprof2calltree/
.. _RunSnakeRun: http://www.vrplumber.com/programming/runsnakerun/
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
swiss.py is the Python User Group for Switzerland, meeting in Zurich.
We'll have our first meeting on February 24, 2009.
Uche Mennel will talk about GUI development with Python using the
Enthought Tool Suite.
When: Tuesday, February 24, 2009 at 7:30pm
Where: Offices of LIIP, Feldstrasse 133, Zürich
The intention is to meet the last Tuesday of every month. A basic web
site with this information is up and running on <http://swisspy.ch/>.
The early-bird registration deadline for PyCon 2009 is February 21,
only a few days from now: <http://us.pycon.org/2009/registration/>.
After that, the price for registration will be going up.
Hotel reservations at the conference rates are still available, but
not for long: <http://us.pycon.org/2009/registration/hotel/>. Act now,
because the regular rate is considerably higher!
**A reminder to tutorial and talk speakers:** you are responsible for
your own registration and hotel reservations. So don't delay!
-- David Goodger, PyCon 2009 Chair
What is cx_Oracle?
cx_Oracle is a Python extension module that allows access to Oracle and
conforms to the Python database API 2.0 specifications with a few
Where do I get it?
1) Added support for database change notification available in Oracle
10g Release 2 and higher.
2) Fixed bug where NCLOB data would be corrupted upon retrieval (non
Unicode mode) or would generate exception ORA-24806 (LOB form
mismatch). Oracle insists upon differentiating between CLOB and NCLOB
no matter which character set is being used for retrieval.
3) Added new attributes size, bufferSize and numElements to variable
objects, deprecating allocelems (replaced by numElements) and
maxlength (replaced by bufferSize)
4) Avoided increasing memory allocation for strings when using
variable width character sets and increasing the number of elements in
a variable during executemany().
5) Tweaked code in order to ensure that cx_Oracle can compile with Python 3.0.1.
Dear Python hackers and lovers,
The Elisa team is happy to announce the release of Elisa Media Center
0.5.28, code-named "Wooden Nickels".
Elisa is an open source cross-platform media center connecting the
Internet to an all-in-one media player. It is written in python using
twisted, gstreamer and pigment among others, and runs on GNU/Linux and
Microsft Windows (XP and above). More information can be found at
This release is a "light weight" release, which means it is supposed to
be pushed to the users through our automatic plugin update system. That
is why there is no new Elisa installer nor any new packages from our side: use
the existing ones for 0.5.27; with the default configuration, they should upgrade
automatically to 0.5.28, asking you to restart Elisa when everything is
Tarballs are provided for packagers who want to disable the automatic plugin
update system on their distribution, so that they can make new packages for
their users to be able to update (I strongly advise that, the new video section
is worth it).
For Spanish users, a new version of the yesfm plugin is released at the same time
through the plugin repository. Another update to that plugin should follow later
this week (yes.fm no longer works without a user account).
A complete list of the issues fixed can be found at:
This is also summarised in the (attached) release notes.
Installers and sources can be downloaded from
Bug reports and feature requests are welcome at
Have a media-centered evening,
Guillaume, for the Elisa team
I have released an updated version of Assembly Line,
my entry in PyWeek 6 and later the Pyggy Awards.
About Assembly Line
Become a FADE!
That's Factory Automation Design Engineer for Pixall Manufacturing, the world
leader in pixellated products.
We give you product designs from our R&D department, and you design and build
factories to manufacture them as efficiently possible. Make a good profit and
you'll earn big bonuses and a huge salary!
SuPy 1.4 Available
Changes in this version:
- Python tuples are converted to Ruby arrays, so you can pass them
directly to Sketchup methods that require an array.
- 'Array' function for converting other Python sequences to arrays.
- X_AXIS, Y_AXIS, Z_AXIS constants.
- Unit conversion constants (feet, yard, etc.) e.g. 5 * feet
What is SuPy?
SuPy is a plugin for the Sketchup 3D modelling application
that lets you script it in Python.
pythonOCC aims to provide a full Python wrapper for the OpenCascade's
3D CAD modeling/visualization library classes.
The first step is to focus on modeling and import/export classes
(IGES, STEP, VRML) in order to provide a complete, powerful, and easy-
to-use 3D modeler using
The pythonOCC build is now modular. New OpenCascade smart pointers
management. Many additional modules. Improvements in the visualization
part. Interactive console fixes and enhancements. Availability for
Windows, Linux, and Mac OS X.
www.pythonocc.org / https://gna.org/projects/pythonocc/
Dear all, It's my pleasure to inform you that pythonOCC 0.1 has been
This is a huge step in the development of pythonOCC, where we went
from a monolithic build, to a modular approach. That makes it far
easier to distribute pythonOCC based apps and speeds up the
development process by a great deal. Nearly the whole OCC API is
currently wrapped in pythonOCC. The 0.1 release sets the foundation of
what's to come the following years. pythonOCC is no longer a proof-of-
concept it represents the start of Agile CAD development.
My appreciation goes out to Thomas Paviot, who has made a massive
effort in getting pythonOCC to where it is today.
* Like Thomas mentions on the front page of the pythonOCC site, the
work has only just begun. The aim of pythonOCC is not to merely wrap
OCC, but to provide a high-level, pythonic API. An example is the
Topology.py in the utils directory. An idea is to make a high level
declarative api. Such that vertex.x = 12.0 would deal with all the
intrinsics involved in updating the coordinate of a given vertex. The
api would follow OCC's topology: Vertex, Edge, Face, Solid. The traits
module developed by Enthought makes event based programming a
pleasure, and provides hooks for a gui based on introspection.
This is just one example of what the high level api could look like.
We'd appreciate having your ideas / input on this topic very much,
you're invited to share these at the project site.
* Given the solid state of the .1 release, its time to formalize the
development process. Let's start using the bugtracker, task manager
and the other neat features the project site offers. See https://gna.org/projects/pythonocc/
* OCC SVN. Currently OCC is distributed as a .tar archive, rather than
on version control. We need to fix that. We're thinking of putting OCC
under version control, such that bug fixes, patches, etc. can all be
merged on one single repository. The OCC community as a whole would
profit from that, and hopefully become more cohesive.
* Move the GUI from Wx to QT. Wx is problematic to support on OSX,
also we expect QT momentum to spike given that the upcoming 4.5
release will be lgpl'd.
* PR. pythonOCC needs reach out and get in the open. We're thinking of
giving a presentation at EuroPython. Did you know that an early
ancestor of OCC was used to construct the Concorde? That OCC is a
close relative of Unisurf, the software by Bézier that sparked the
development of CAD? We need the Bézier's of our time developing on top
* Agile CAD. Planning on writing a paper on Agile CAD development /
Open Source CAD development. pythonOCC is the underpins being able to
develop CAD apps in a short timeframe, with an OS license. pythonOCC
should become the premier OS CAD platform.
Thanks so much for all the received feedback and we're looking forward
to your continued involvement in pythonOCC. The future of Agile CAD
development is looking bright!
- Thomas Paviot - Jelle Feringa -
ftputil 2.4 is now available from
Changes since version 2.3
The ``FTPHost`` class got a new method ``chmod``, similar to
``os.chmod``, to act on remote files. Thanks go to Tom Parker for
There's a new exception ``CommandNotImplementedError``, derived from
``PermanentError``, to denote commands not implemented by the FTP
server or disabled by its administrator.
Using the ``xreadlines`` method of FTP file objects causes a warning
through Python's warnings framework.
Upgrading is recommended.
The ``xreadlines`` method will be removed in ftputil *2.5* as well as
the direct access of exception classes via the ftputil module (e. g.
``ftputil.PermanentError``). However, the deprecated access causes no
warning because that would be rather difficult to implement.
The distribution contains a small tool find_deprecated_code.py to scan
a directory tree for the deprecated uses. Invoke the program with the
``--help`` option to see a description.
What is ftputil?
ftputil is a high-level FTP client library for the Python programming
language. ftputil implements a virtual file system for accessing FTP
servers, that is, it can generate file-like objects for remote files.
The library supports many functions similar to those in the os,
os.path and shutil modules. ftputil has convenience functions for
conditional uploads and downloads, and handles FTP clients and servers
in different timezones.
Read the documentation at
ftputil is Open Source software, released under the revised BSD
license (see http://www.opensource.org/licenses/bsd-license.php ).
SuPy 1.3 Available
Changes in this version:
- Added the rest of the promised functionality to the menus module
(submenus and separators) and provided an example of its usage
- The scheme for preserving variables using a __keep__ attribute
turned out to be fatally flawed. It has been replaced by a new
mechanism using a keep() function instead. See the section on
"Preserving Data" for details.
What is SuPy?
SuPy is a plugin for the Sketchup 3D modelling application
that lets you script it in Python.