introspection for C modules

Bug #322159 reported by Jelmer Vernooij
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pydoctor
Confirmed
Low
Unassigned

Bug Description

 affects pydoctor

It would be really nice if pydoctor could support introspection next to
parsing of Python code. I work with a lot of projects that have Python
code that is partially in C and partially in Python itself, and this is
the only thing blocking us from adopting pydoctor atm.
--
Jelmer Vernooij <email address hidden> - http://samba.org/~jelmer/
Jabber: <email address hidden>

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I can't really ever imagine working on this myself, sad to say.

Changed in pydoctor:
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

I'd be interested in having a look at this - subvertpy and samba both need it -, would you be able to discuss this some time ?

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

discuss as-in a pre-implementation call of some sort, I'm a bit clueless as to where to start and what the best way is to add this kind of support into pydoctor.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote : Re: [Bug 322159] Re: introspection for C modules

On Mon, 29 Nov 2010 10:13:17 -0000, Jelmer Vernooij <email address hidden> wrote:
> discuss as-in a pre-implementation call of some sort, I'm a bit clueless
> as to where to start and what the best way is to add this kind of
> support into pydoctor.

Well, basically, for a C module I guess you want to insert a
pydoctor.model.Module object that describes the module you're
introspecting... here's a start, perhaps?

    lp:~mwhudson/pydoctor/introspect-c-modules

See if that makes any sense :-) You need to run like this:

 .../introspect-c-modules/bin/pydoctor \
 ~/canonical/repos/subvertpy/trunk/subvertpy --introspect \
 subvertpy.client --introspect subvertpy.repos --introspect subvertpy.wc \
 --html-output subvertpy-doc

from somewhere you can import subvertpy.client etc from. The output
looks like this:

    http://people.canonical.com/~mwh/subvertpy-doc/subvertpy.repos.Repository.html

Hope this helps! I think it's quite good for a 20 minute hack :-)

Cheers,
mwh

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

On Wed, 2010-12-01 at 03:07 +0000, Michael Hudson-Doyle wrote:
> On Mon, 29 Nov 2010 10:13:17 -0000, Jelmer Vernooij <email address hidden> wrote:
> > discuss as-in a pre-implementation call of some sort, I'm a bit clueless
> > as to where to start and what the best way is to add this kind of
> > support into pydoctor.
> Well, basically, for a C module I guess you want to insert a
> pydoctor.model.Module object that describes the module you're
> introspecting... here's a start, perhaps?
>
> lp:~mwhudson/pydoctor/introspect-c-modules
>
> See if that makes any sense :-) You need to run like this:
>
> .../introspect-c-modules/bin/pydoctor \
> ~/canonical/repos/subvertpy/trunk/subvertpy --introspect \
> subvertpy.client --introspect subvertpy.repos --introspect subvertpy.wc \
> --html-output subvertpy-doc
>
> from somewhere you can import subvertpy.client etc from. The output
> looks like this:
>
> http://people.canonical.com/~mwh/subvertpy-
> doc/subvertpy.repos.Repository.html
>
> Hope this helps! I think it's quite good for a 20 minute hack :-)
Uhm, wow! :-) This is much more than I was hoping for, thanks!

It does indeed work well on subvertpy. I'll try it on Samba tonight.

Cheers,

Jelmer

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Attached a branch; pydoctor now automatically introspects .so or dll files (using imp.get_suffixes()). I also fixed a minor bug since linenumber isn't known for introspected modules.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

This now works well with Samba and its almost 3 dozen C extensions:

http://samba.org/~jelmer/samba4/pydoctor/

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Hi, I grabbed your branch, made a few more changes and merged it to trunk :-)

Thanks for the prod and the code!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.