Re: Python module (Was: [textadept] Textadept 3.7 beta 2)

From: Robert <ro....at.web.de>
Date: Sat, 12 Mar 2011 09:32:09 +0100

On Mon, Mar 7, 2011 at 10:22 PM, mitchell <c....at.caladbolg.net> wrote:
> Robert,
>
> On Fri, 4 Mar 2011, Robert wrote:
>
>> On Wed, Mar 2, 2011 at 7:23 PM, mitchell <c....at.caladbolg.net> wrote:
>> (...)
>>>
>>> I wanted to include a python module, but so far I haven't found a way to
>>> generate a set of tags for the default API. pydoc is woefully
>>> ill-equipped
>>> and parsing its HTML output looked like a nightmare. Once a way is found,
>>> I
>>> would like to incorporate some things from Brian's module.
>>>
>>> mitchell
>>>
>>
>> The "working prototype" I mentioned is using Pysmell, there is also
>> rope (with ropeide, ropemacs, ropevim, etc.).
>> I have also some other stuff in various stages of releasability, like
>> pep8-checking, pylint etc.
>> I'll let you know when I got something working.
>
> I wonder if there's a way to do autocomplete without those external tools. I
> wouldn't want an included module to depend on anything foreign.
>
> mitchell
>

So, here is a first version:
https://github.com/rgieseke/textadept-python

Tags and apidoc can be generated with a script:
python adeptsensedoc.py stdlib
creates them for the python standard library. I just created a list,
based on the docs (1). For python 3 this might need to be adapted.
Platform or version specific modules should be ignored.
For other modules you can run it as
python adeptsensedoc.py numpy scipy
There are separate files for each module created. My first attempts
with Pysmell were just going through the python path, but I have way
too many libraries installed, many of them dependencies of other
software, for example gui toolkits.
Having separate files makes it possible to add them as needed,
possibly even from within
Textadept once a new import is detected.

What works:
import numpy as np

np.arr -> autocompletes to array...

t = "test"

t.rep -> autocompletes to replace...

There are a things to be improved of course, for example better
docstrings for class constructors, always have function arguments

Feedback, bug reports, ideas much appreciated.
Mitchell, what do you think about the circumventing of the ctags format?

Robert

(1) http://docs.python.org/modindex.html
Received on Sat 12 Mar 2011 - 03:32:09 EST

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 12:02:03 EST