Sublime Forum

Need some help with async

#1

I am currently trying to make a package but I am running into some roadblocks with dependencies.

  1. How am I supposed to publish/test my dependencies?
    I have made a repository for one of my dependencies and while that is fine and all, I don’t know how I can install it locally. I have seen the Package Control: Install Local Dependency but can’t find how it works or how it finds the local dependency i’m trying to install.

  2. Does the dependencies key in package-metadata.json take the format of a dependencies.json file?

0 Likes

#2

Have you already read Dependencies in Package Control 3?

0 Likes

#3

I just figured it out actually. But is there any way to have sublime run the plugin_loaded() def with async? Right now i’m using yield from (since i don’t know how to upgrade py for sublime) and now it won’t load at all.

0 Likes

#4

St doesn’t understand async. If you want to use async in your plugin, you will have to implement the loop running code in a custom thread most likely, and let’s just say that this is largely bothersome.

In order to properly function with an async-based api, the st api would need to be rewritten to provide support for separate async hooks and functions. It would also help if it used python 3.5 or higher.

For now, I consider async plugins to be infeasible and not worth the hassle compared to normal synchronous plugins. You might want to look at sublime.set_timeout and its async variant (which is not actually “async” but will be run on a background thread instead of the main ui one).

0 Likes

#5

Regarding dependencies, if they are huge and have potential to be shared by multiple packages, feel free to submit a new dependency. If it’s mostly a one-off kind of thing, you might be better off just vendoring the dependency within your package. When doing so, please refrain from modifying sys.path and instead use relative imports. If the dependency itself uses absolute imports, this should be corrected either upstream or locally with some simple sed call.

0 Likes

#6

Then I would need to know how to upgrade my py version on sublime since it’s on 3.3
Looking at the directory it seems that it only uses 3.3 since its put in a zip with a dll

0 Likes

#7

You can’t.

It will probably be updated in the future, but currently it is not possible to use a different python version inside st.

0 Likes

#8

Ah, well thanks for the help.
I’ve managed to find an alternative dependency that does not use async.

0 Likes