472,993 Members | 2,564 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,993 software developers and data experts.

idutils and Python

Dear All,

Has anybody tried to use ID Utils
(http://www.gnu.org/software/idutils/46) with Python? I've googled, searched
the mailing list, and have found nothing.

A silly, simple use of IDUtils with Python code does work, using a language
map that says *.py files are text files. But I am wondering if someone has
done something more sophisticated. (For instance, I get matches to
commented out functions, which I'd rather not, lots of extra stuff is
indexed which probably shouldn't, etc).

Thanks,

R.

P.D. ID utils is somewhat like [ce]tags, and has support under Emacs
(see section 5.2 of the ID utils manual:
http://www.gnu.org/software/idutils/...id-interface47
). One nice feature is that, when searching for matches, it shows the
results in a compilation buffer, so you can see where, in each file,
the identifier is used, and visit that if you want. I like this a lot
better than "tags-search".

--
Ramon Diaz-Uriarte
Bioinformatics Unit
Spanish National Cancer Centre (CNIO)
http://ligarto.org/rdiaz
Aug 22 '06 #1
5 2469
Ramon Diaz-Uriarte wrote:
Dear All,

Has anybody tried to use ID Utils
(http://www.gnu.org/software/idutils/46) with Python?
What exactly are you trying to accomplish? If you want to index
function/class names, variables, etc then you should take a look at
"exuberant ctags" http://ctags.sourceforge.net --although it started
off as a C indexer, it has excellent Python support, it's free, and as
a bonus its indices are well supported from inside major editors (vim,
emacs, etc) so you can easily follow code flow, find function/class
definitions, etc.

Aug 22 '06 #2
On 21 Aug 2006 22:56:13 -0700, sj*******@yahoo.com <sj*******@yahoo.comwrote:
What exactly are you trying to accomplish? If you want to index
function/class names, variables, etc then you should take a look at
"exuberant ctags" http://ctags.sourceforge.net53 --although it started
off as a C indexer, it has excellent Python support, it's free, and as
a bonus its indices are well supported from inside major editors (vim,
emacs, etc) so you can easily follow code flow, find function/class
definitions, etc.

Sorry for not being clear enough. I want the following:

a) have my editor go to the point where a function/whatever is defined

b) see all places where a function/whatever is used.

I've tried exuberant ctags and I do like it a lot. a) is done
wonderfully (within emacs, the editor I use, but also in other
editros, from what I've read). However, b) does not work exactly as
I'd like:

1. With Emacs and tags: using "tags-search" I can visit, one by one,
all places where a function is called, but I'd like to see where it is
called before visting that file and know, before visiting each file in
turn, whether I'll visit 1 or 20 files (or, to put it in another way,
I'd like to see like a poor-mans static callgraph).

2. From what I understand, there is a deeper difference than just how
results are shown: the tags file contains the places where, say, a
function is defined, but finding where it is used requires running
grep on every file looking for the tag. (I believe that is what
"tags-search" does in emacs). In contrast, ID utils does not do any
grep, but directly goes to the ID file, where all that is already
pre-stored, which also means that it will be a lot faster than
grepping for the tags.

A tool similar to IDutils is Global
http://www.gnu.no/software/global/, but it also does not incorporate
Python support. (Though defining other parsers might be simple; I
haven't looked at it closely).

I think the wish "do not use grep, just look at the index file, and
immediately display all matches" is reasonable and probably other
Python coders had thought about it before. But I am wondering if I am
missing something obvious, as most people seem to be very happy with
exuberant ctags.
Thanks,

R.

On 21 Aug 2006 22:56:13 -0700, sj*******@yahoo.com <sj*******@yahoo.comwrote:
Ramon Diaz-Uriarte wrote:
Dear All,

Has anybody tried to use ID Utils
(http://www.gnu.org/software/idutils/4652) with Python?

What exactly are you trying to accomplish? If you want to index
function/class names, variables, etc then you should take a look at
"exuberant ctags" http://ctags.sourceforge.net53 --although it started
off as a C indexer, it has excellent Python support, it's free, and as
a bonus its indices are well supported from inside major editors (vim,
emacs, etc) so you can easily follow code flow, find function/class
definitions, etc.

--
http://mail.python.org/mailman/listinfo/python-list54

--
Ramon Diaz-Uriarte
Bioinformatics Unit
Spanish National Cancer Centre (CNIO)
http://ligarto.org/rdiaz
Aug 22 '06 #3
Ramon Diaz-Uriarte wrote:
On 21 Aug 2006 22:56:13 -0700, sj*******@yahoo.com <sj*******@yahoo.comwrote:
What exactly are you trying to accomplish? If you want to index
function/class names, variables, etc then you should take a look at
"exuberant ctags" http://ctags.sourceforge.net53 --although it started
off as a C indexer, it has excellent Python support, it's free, and as
a bonus its indices are well supported from inside major editors (vim,
emacs, etc) so you can easily follow code flow, find function/class
definitions, etc.


Sorry for not being clear enough. I want the following:

a) have my editor go to the point where a function/whatever is defined
That's usually ctags/etags
b) see all places where a function/whatever is used.
That's usually cscope http://cscope.sourceforge.net/ but I've not
tried to use it with Python before; from the web page it looks like it
may be worth a spin:
"The fuzzy parser supports C, but is flexible enough to be useful for
C++ and Java, and for use as a generalized 'grep database' (use it to
browse large text documents!"

The vim integration is very nice. It has emacs integration too, but I
haven't used it and can't comment on how good it is.
I think the wish "do not use grep, just look at the index file, and
immediately display all matches" is reasonable and probably other
Python coders had thought about it before. But I am wondering if I am
missing something obvious, as most people seem to be very happy with
exuberant ctags.
I am usually happy with grep, but we only have a medium-large size
project (320,000 lines of Python code); I can imagine on very large
codebases that would be too slow to be practical.

Aug 22 '06 #4
On 22 Aug 2006 10:04:12 -0700, sj*******@yahoo.com <sj*******@yahoo.comwrote:
That's usually cscope http://cscope.sourceforge.net/ but I've not
tried to use it with Python before; from the web page it looks like it
may be worth a spin:
"The fuzzy parser supports C, but is flexible enough to be useful for
C++ and Java, and for use as a generalized 'grep database' (use it to
browse large text documents!"
Thanks for your answer. I'll take a new look at cscope (I think I
looked at it, but discarded because it seemed to focus on C/C++; never
noticed it is possible use as a general browser for large text
collections).
I am usually happy with grep, but we only have a medium-large size
project (320,000 lines of Python code); I can imagine on very large
codebases that would be too slow to be practical.
I am generally happy with grep (and your code is much larger than
ours) but idutils' output offers both that and, by showing all
together, a kind of poor-man's static call graph, and can be of use
when refactoring.

Thanks again,

R.

On 22 Aug 2006 10:04:12 -0700, sj*******@yahoo.com <sj*******@yahoo.comwrote:
Ramon Diaz-Uriarte wrote:
On 21 Aug 2006 22:56:13 -0700, sj*******@yahoo.com <sj*******@yahoo.comwrote:
What exactly are you trying to accomplish? If you want to index
function/class names, variables, etc then you should take a look at
"exuberant ctags" http://ctags.sourceforge.net53 --although it started
off as a C indexer, it has excellent Python support, it's free, and as
a bonus its indices are well supported from inside major editors (vim,
emacs, etc) so you can easily follow code flow, find function/class
definitions, etc.

Sorry for not being clear enough. I want the following:

a) have my editor go to the point where a function/whatever is defined

That's usually ctags/etags
b) see all places where a function/whatever is used.

That's usually cscope http://cscope.sourceforge.net/ but I've not
tried to use it with Python before; from the web page it looks like it
may be worth a spin:
"The fuzzy parser supports C, but is flexible enough to be useful for
C++ and Java, and for use as a generalized 'grep database' (use it to
browse large text documents!"

The vim integration is very nice. It has emacs integration too, but I
haven't used it and can't comment on how good it is.
I think the wish "do not use grep, just look at the index file, and
immediately display all matches" is reasonable and probably other
Python coders had thought about it before. But I am wondering if I am
missing something obvious, as most people seem to be very happy with
exuberant ctags.

I am usually happy with grep, but we only have a medium-large size
project (320,000 lines of Python code); I can imagine on very large
codebases that would be too slow to be practical.

--
http://mail.python.org/mailman/listinfo/python-list

--
Ramon Diaz-Uriarte
Bioinformatics Unit
Spanish National Cancer Centre (CNIO)
http://ligarto.org/rdiaz
Aug 23 '06 #5
Thanks for the answer. I had read about PyDev and its extenssions but,
if at all possible, I'd like to keep working with Emacs (or Vim)
instead of Eclipse, and I'd rather use free/open source software.

Best,

R.

On 8/23/06, Fabio Zadrozny <fa*****@gmail.comwrote:
>
What exactly are you trying to accomplish? If you want to index
function/class names, variables, etc then you should take a look at
"exuberant ctags" http://ctags.sourceforge.net53 --although it started
off as a C indexer, it has excellent Python support, it's free, and as
a bonus its indices are well supported from inside major editors (vim,
emacs, etc) so you can easily follow code flow, find function/class
definitions, etc.

Sorry for not being clear enough. I want the following:

a) have my editor go to the point where a function/whatever is defined


Pydev Extensions (http://www.fabioz.com/pydev) should do that without any
problems with F3 (it first tries a 'context-sensitive' match, trying to find
it in locals, globals, current class, etc and if not found like that, it
goes and looks for the signature in a context-insensitive way, as if it was
a simple text-search)

b) see all places where a function/whatever is used.


This can be handed pretty well with the search that is builtin into Eclipse
(ctrl+h).

Cheers,

Fabio

--
Ramon Diaz-Uriarte
Bioinformatics Unit
Spanish National Cancer Centre (CNIO)
http://ligarto.org/rdiaz
Aug 23 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.