Sublime Forum

Needing a little help with dependencies

#1

I am devleoping a plugin that makes use of tinyDB. I have successfully manually added tinyDB to my package thanks to this extremely helpful post by @OdatNurd. With tinyDB successfully added and attempting to import it to a py file in my package, sublime console tells me it cannot import some of the tinyDB dependency modules. The first module I was alerted to install was typing, and I have successfully added that using a dependencies.json file and Package Control: Satisfy Dependencies - again as excellently described by @OdatNurd. I am now alerted to install abc

from abc import ABC, abstractmethod
ImportError: cannot import name abstractmethod

This module is not listed here, so I am not sure that Package Control: Satisfy Dependencies will work for this module. So, it seems I will have to follow instructoins at the end of @OdatNurd’s post under the heading “Use Package Control’s Dependency system (but the dependency does not exist)”. My question is, where would I obtain the abc module? It seems to be part of standard library, so how would I get a copy of it? Part of me also wonders why I would have to install this if it is already in fact part of the standard library and not listed as a sublime exception here.

Any guidance is appreciated. Thanks.

0 Likes

#2

A bit more on this. I am trying to use version 4.4.0 of tinyDB in my package and have been informed by its developer that this version does not support python 3.3. So, I have placed a .python-version file with “3.8” in my root package folder per instructions here. When I do this, the sublime console shows me the following error:

reloading plugin Report.Referring
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python38/sublime_plugin.py", line 314, in reload_plugin
    load_module(m)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python38/sublime_plugin.py", line 347, in load_module
    if issubclass(t, ApplicationCommand) and t is not ApplicationCommand:
TypeError: issubclass() arg 1 must be a class

Any idea what the problem is here? Hopefully someone can help.

0 Likes

#3

I’m not sure what that error means off the top of my head and without checking the code, but something to be aware of is that right now dependencies aren’t possible in the 3.8 plug-in host due to the way that package control sets them up currently. There’s work on going to change how it works so that dependencies will work in all plug in hosts, but it’s not there yet.

As such, if you need to target 3.8 you’re probably going to have to vendor all of your dependencies yourself, do some back porting, or wait until that work is done.

Regarding your initial question, I noticed yesterday that those imports fail in the plug-in host because it seems like that module, while it exists, it does not contain those symbols. I’m not familiar enough with it to know what it’s supposed to be for though.

0 Likes

#4

Thank you. Very helpful to hear about the current 3.8 dependency limitations. I’ll have to reconsider my approach.

0 Likes