Re: [Builder] Function and class fuzzy search for Python source code?



Hi Christian,


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, May 25, 2019 1:42 AM, Christian Hergert <christian hergert me> wrote:

The complicating factor is that we almost certainly want to run the
python script to extract symbols from the build container which may look
very different from the host, or Builder's mount namespace, and has all
of the application dependencies.

Having a self-contained python script (that can do py2 and py3 if
possible) would allow us to copy it into the build environment and
execute there. The in-process plugin for Builder could consume that
and implement the appropriate indexer interface.

Implementing the IdeCodeIndexer interface from Python isn't as friendly
as I'd like because doing async tasks in Python is rather cumbersome
and the API is designed for performance, not flexibility. But the NPM
plugin does implement it in Python and can serve as an example.

I've implemented a small script available here:

https://framagit.org/snippets/3594

It's compatible with both Python 2 and Python3 and it's using Python's ast module which should make it very 
robust in terms of how it finds Python classes and functions, but there is a caveat: it needs to be called 
using the same version of Python than the project it has to parse the code of.

Please let me know if this kind of script would be enough.

Cheers!


--
Pierre


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]