Re: Python dependencies in add-ons


Sean
 

Hi  Subham,

I think your work will be a revolutionary thing.
Because screen readers have been working with the same logic for 20 years.
Good luck.

There is no separate tool to manage the dependencies of NVDA addons.

In addon's __init__.py file, the path of the modules is added with sys.path.append.
Addon  writers often use this.

One thing I want to add is;
All required modules should be in the same folder.

You can write C ++ codes to Python with a tool like Cython.
Or the code section written in C ++ can be compiled as a DLL.
In this way, we can use the functions of the DLL with Ctypes.
Ctypes is more commonly used in NVDA source.

On 08/06/2020 14:19, Shubham Jain wrote:
Hello!

As part of my GSoC project, I am writing an add-on that allows users to get descriptions of images. To work, the ML models depend on some python libraries like Numpy, Pillow, onnxruntime and OpenCv. My questions are:
  • Is it possible to package these libraries in an add-on?
  • Since I only require a few specific functions from these libraries, is it possible to only package those parts into the add-on?

Alternatively, the models could be converted to run using native C++ by depending on the LibTorch library. Is it possible to write add-ons in native C++?

regards,
Shubham Jain
--

Sean

👨‍🦯 I’m student and programmer. I write often Python, sometimes Go and rarely C++.

Join nvda-addons@nvda-addons.groups.io to automatically receive all group messages.