473,938 Members | 34,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2540
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*******@yaho o.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*******@yaho o.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*******@yaho o.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*******@yaho o.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*******@yaho o.comwrote:
Ramon Diaz-Uriarte wrote:
On 21 Aug 2006 22:56:13 -0700, sj*******@yahoo .com <sj*******@yaho o.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
10131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11516
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11284
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10652
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9854
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7377
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6290
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4443
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.