[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: SoC proposal: "pythonificating the python bindings"

From: David James <djames_at_collab.net>
Date: 2006-05-02 19:21:43 CEST

On 5/2/06, Walter Mundt <emage@spamcop.net> wrote:
> Are there any issues with the Python bindings that will need fixing
> other than the one linked on the ideas page? (I would consider any
> other instance of the can't-assign-to-a-function-pointer problem part of
> that issue, so what I'm asking for is any known problems _not_ stemming
> from that.)

For sure! The link on the issues page is just an example. I don't
think that 'single example' is representative at all of what needs to
be done.

What I'd really like to see is a general clean up of the Python
bindings to have a more usable class structure, similar to the Ruby
bindings. It'd be great if you could just type:

import svn.client
  repo = svn.client.Client('http://svn.collab.net/svn/trunk')
  print repo.ls()
  repo.mkdir("some-directory", "some commit message")

 .. or ...
  repo = svn.client.Client('/some/path')
  repo.add('file.txt')
  repo.commit('commit message')

> Any specific conditions or guidelines by which I should set up the
> Python class structure? I understand the general idea of Python-ifying
> C interfaces, and have looked at the beginnings of the work done in
> trunk for libsvn_core.

If you're looking for examples of nice interfaces to Subversion, take
a look at the Ruby bindings. Last summer, Kouhei Sutou implemented
this fantastic, easy to use interface in Ruby. If you could help write
a similar interface for the Python bindings, you'd be a star. Even if
you only have time to finish the 'client' library (and don't have time
for the 'wc', 'repos', 'fs', or other libraries), that'd be a killer
Summer of Code project.

Writing a complete, object-oriented interface for just the client
library would be a great Summer of Code project. To see an example of
what we're looking for, take a look at Subversion's Ruby bindings for
the client library:
   http://svn.collab.net/repos/svn/trunk/subversion/bindings/swig/ruby/svn/client.rb

If there's more than one student out there who wants to work on the
Python bindings, we could split up the work by assigning each student
a different library. To see a list of the libraries supported by Ruby,
check out http://svn.collab.net/repos/svn/trunk/subversion/bindings/swig/ruby/svn

> One specific Python/APR divide I'm looking at is the APR "pool"
> mechanism. Passing pools about is very tedious and verbose. I
> understand the logic behind it, though! One possible API simplification
> that might help would be to have all pool parameters passed by keyword
> in Python, and then make a Python function decorator that adds a pool=
> keyword argument to a function, and automatically pulls its value from
> the caller's namespace if it isn't provided explicitly. Then, you could
> have the desired semantics for regular usage "by default", and
> explicitly create and manage loop subpools where necessary. Thoughts?

Last summer, I upgraded the Python bindings to support automatic
memory management -- so there's no need to supply pools anymore. If
you're looking for a performance boost, or want to have more
fine-grained control, you can still supply pools, but Subversion will
manage memory automatically by default.

Cheers,

David

--
David James -- http://www.cs.toronto.edu/~james
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue May 2 19:22:11 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.