Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#83 Improved support for Python

open
None
5
2007-06-26
2007-06-26
Scott
No

With a growing number of Python developers loving Geany it would be great to see improved Python support. For one, it would be nice to have a Python template added to start a new Python program. Another is to add better syntax highlighting for Python. At the moment the syntax Highlighting for Python is extremely basic.

Anything else that would improve a Python' developer experience would also be a good addition.

Thanks for a great program.

Your friend,
Scott

Discussion

  • Enrico Tröger
    Enrico Tröger
    2007-06-26

    Logged In: YES
    user_id=1117045
    Originator: NO

    Adding a new file template for Python is no problem. Could you provide one? How should it look like?

    What means better syntax highlighting?

    "Anything else that would improve a Python' developer experience would also
    be a good addition." -> I'm not a Python developer so I don't know what it could be ;-). Ideas are welcome.

     
  • Enrico Tröger
    Enrico Tröger
    2007-06-26

    • assigned_to: nobody --> eht16
     
  • Nick Treleaven
    Nick Treleaven
    2007-08-06

    Logged In: YES
    user_id=1268692
    Originator: NO

    We recently added decorator styling in the SVN version.

    I'm working on parsing global variables for the symbol list - this will be added soon.

    I'm new to Python so as Enrico said, please be more specific about highlighting and any other suggestions.

     
  • Nick Treleaven
    Nick Treleaven
    2007-08-07

    Logged In: YES
    user_id=1268692
    Originator: NO

    Update:
    Global variables and class variables are now parsed in SVN.

    If I have time I might work on adding calltips support for Python.

     
  • Logged In: YES
    user_id=1687618
    Originator: NO

    Here is an example of what the template could be: http://paste.ubuntu.com/5433/plain/. (Not sure if that URL is permanent but I couldn't find any option to upload files here on SourceForge.net).

     
  • Enrico Tröger
    Enrico Tröger
    2008-03-09

    Logged In: YES
    user_id=1117045
    Originator: NO

    Thanks, but we already have a template which includes a very basic python code.

     
  • Jan Martinek
    Jan Martinek
    2008-03-10

    Logged In: YES
    user_id=632836
    Originator: NO

    Hello,

    I have some proposals how to improve python support in geany. I realize that geany is primarily an editor so I try to focus on features that can be done without necessity of introspection, or running python interpretter and complicated parsing of source code.

    1. Typical project in python contains one or more files *py.

    (geany handles this perfectly already)

    2. Often it is useful to edit one file (module) but executing another file (main application).

    It would be nice if geany had TWO keyboard shortcuts
    - first: save and run the currently edited file
    - second: save all files and run a file, which has been previously specified somehow.

    3. Executed file may end silently (normal case) or it may terminate due to an exception (which usually means error). In such case a "traceback" is written to terminal.
    Example:

    Traceback (most recent call last):
    File "neco2.py", line 9, in <module>
    test(0)
    File "neco2.py", line 7, in test
    neco.funkce(a)
    File "/home/honza/neco.py", line 5, in funkce
    print 1/a
    ZeroDivisionError: integer division or modulo by zero

    The traceback contains information about where the exceptions occured and the programmer may want to edit the parts of the code. It is not only one place but many places, because of function nesting (one function calls another function which calls another function which throws an exception). In default configuration the traceback contains at most three places - and it is usually sufficient.

    If a traceback is written, it would be nice if geany parsed the file names and line numbers and ask the programmer what he wants to edit.

    4. If "SyntaxError" occures, then geany may immediately jump to the place where it is found. In most cases this is what programmer wants.

    5. Pressing Ctrl+c while python program is running throws an exception (named "KeyboardInterrupt") and writes a traceback. In such case I think it can be safely ignored.

    ----------
    If at least some of the proposed features could be done I would be very happy. But I like geany anyway and I thank you for what you have done.

    regards
    Jan Martinek