For eggs, like plugins, you need pure python modules unfortunately. You don't even need add them manually to sys.path I found, as is done for you if just droping the src dirs into the plugin's main dir, as is added to sys.path, e.g. I made a small plugin once like this:
Code: Select all
martin@arch ~ % la testing/webhook
total 24K
drwx------ 3 martin users 4.0K Aug 23 2023 certifi
drwxr-xr-x 3 martin users 4.0K Oct 16 2023 deluge_webhook
drwx------ 3 martin users 4.0K Oct 10 2023 requests
drwx------ 6 martin users 4.0K Aug 23 2023 urllib3
-rwxr-xr-x 1 martin users 529 Oct 16 2023 create_dev_link.sh
-rw-r--r-- 1 martin users 1.2K Oct 16 2023 setup.py
martin@arch ~ % la testing/webhook/requests
total 212K
drwx------ 2 martin users 4.0K Oct 8 2023 __pycache__
-rw-r--r-- 1 martin users 3.9K Oct 10 2023 __init__.py
-rw-r--r-- 1 martin users 436 Feb 9 2020 __version__.py
-rw-r--r-- 1 martin users 1.1K Feb 9 2020 _internal_utils.py
-rw-r--r-- 1 martin users 20K Feb 9 2020 adapters.py
-rw-r--r-- 1 martin users 6.4K Feb 9 2020 api.py
-rw-r--r-- 1 martin users 10K Feb 9 2020 auth.py
-rw-r--r-- 1 martin users 453 Feb 9 2020 certs.py
-rw-r--r-- 1 martin users 1.8K Feb 9 2020 compat.py
-rw-r--r-- 1 martin users 18K Feb 9 2020 cookies.py
-rw-r--r-- 1 martin users 3.2K Feb 9 2020 exceptions.py
-rw-r--r-- 1 martin users 3.5K Feb 9 2020 help.py
-rw-r--r-- 1 martin users 757 Feb 9 2020 hooks.py
-rw-r--r-- 1 martin users 35K Feb 9 2020 models.py
-rw-r--r-- 1 martin users 542 Feb 9 2020 packages.py
-rw-r--r-- 1 martin users 29K Feb 9 2020 sessions.py
-rw-r--r-- 1 martin users 4.1K Feb 9 2020 status_codes.py
-rw-r--r-- 1 martin users 3.0K Feb 9 2020 structures.py
-rw-r--r-- 1 martin users 30K Feb 9 2020 utils.py
martin@arch ~ %
Where requests and it's two deps auto-added to sys.path, and can be used through merely importing requests in core.py or whatever.
Again, the issue is with c modules and otherwise non-pure python stuff - I found if using/distributing the egg/plugin extracted i.e. as a dir just ending it's name in *.egg, then would work, as the issue is that an egg is zipped, and the OS's api calls for loading native module code, doesn't support loading such from a zipped dir path like python generates. I once had to code generating temp folder in /tmp / %temp%, then extracting the c-module dep dir from plugin and into there, and adding said temp dir to sys.path, to use in plugin, but pretty lame honestly, and abandoned for better idea later, with other pure python dep found instead.