Sublime Forum

Is there a way to pypi install into packages folder?

#1

I’m trying to develop some packages. I test out packages with my system wide python 3 on macOS but then struggle to get the module and dependencies into my sublime package. Is there a way to just pypi install these packages and their dependencies directly into the Packages folder? This is a package solely for my own use, not distributed in Package Control. Thanks.

0 Likes

#2

Another thought: add pypi’s install dir into ST’s python lib path in your own plugin.
That’s super simple but untested: https://stackoverflow.com/a/135273

0 Likes

#3

See also:

0 Likes

#4

Thank you @OdatNurd for the reply. I’ve learned a ton from your videos and this post you’ve linked in particular. After giving it more analysis, I had to grab a version of the 3rd party dependency that supports python 3.3. Installing that in Lib/python33 did the trick.

By the way, what is the difference between Lib/python3.3 and Lib/python33?

0 Likes

#5

Related to first question and in response to @OdatNurd’s excellent answer on dependencies in the stackoverflow link, is it possible to install 3rd party dependenies to the Sublime Lib folder using pipenv? I tried it once, but Sublime still was not able to see these as installed. Hoping for any word on if that’s is accepted method of install or if is not compatible.

0 Likes

#6

If you can get something to install a library into $DATA/Lib/python33 or $Data/Lib/python38 (in ST3 there is only a lib for 3.3 and it’s name is different but still in $DATA/Lib), the plugin host will see it.

That not new though; in the run up to version 3.0 releases, Will added those folders so that they would be in place for Package Control to use (though work for that is currently underway and not complete yet).

Those paths are in the sys.path automatically at startup (in ST4, each plugin host sees only the one for their specific version).

How you tell pipenv or anything else to put a library there is open to interpretation though. Nothing in Sublime’s ecosystem is going to do it for you, so you need to know how to set it up yourself and do it. If you want to distribute a package, you’d need to tell people how to do it in the installation instructions.

1 Like

#7

Thank you for the reply. This is helpful.

0 Likes