-
-
Notifications
You must be signed in to change notification settings - Fork 813
Make a basic, public API #1696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
TBH, I don't want to open up this door. |
PC 4 already added various commands to support all relevant actions in a plugin_host / python version agnostic way and that's enough. |
But it is the same feature set as the commands, just that these are functions. Commands are ideally bound to keys, the command palette or menus. These functions would drive the 8000 commands. Basically entangling the two concerns: the feature from the way we register features within ST. These don't have to be blocking. Maybe PC should control the execution/executors. I.e. practically only one executor thread/queue is allowed here as I can't think of doing these commands or functions parallelized in the current shape. And if parts of it could run in parallel, PC had to orchestrate this probably. So there is the option (a) to provide a callback as an arg or (b) to return a Future. |
It was already challanging to get a working transition for "events" api while transitioning from py33 to 38 as various packages kept running or keep running on 3.3 while PC is on 3.8. All direct imports wouldn't work then. See how all those packages using direct python functions failed. I just don't want to maintain those or struggle with them, nor is it the goal of PC to be a library or platform for other packages. |
I don't see why closed software is better than open software. I also don't see how that makes PC a library, it is esp. about using this software. However, I don't mind calling "install_packages" as a command. That would be fine, it is just that this falls through, and I don't know when PC is done with it. Can you think of some other ways to support that usage? Didn't we yesterday talked about that ST should provide an API to disable a plugin? We also didn't want to use that in a library-way, we just want a direct way and esp. want to know when it's done. |
The design goal is to provide a GUI and functions to install/upgrade/remove packages. It is a nongoal to be used by other packages beyond using All those APIs start immediatelly causing issues or fail as soon as PC decides to switch to asyncio. Use packagecontrol functionality if you want, but without it being supported I don't need to care about breaking changes, which I don't want to. |
Let's think about this differently. For all commands/actions, we typically
Likely this can lead two unwanted concurrent execution. For example: you probably Let's create a custom executor that, based on a The spinner would be actually a view and listener of this executor state. We had The executor holds another state, namely what it is doing right now. These are All users of the executor could decide if they even want to schedule something |
Dang, again you posted while I was writing. 🍭 |
Without running those commands in threads UI would block. The custom executor will most likely be an asyncio loop. And again we are about fundamental design changes. Primary use case (besides automatic updater and cleanup tasks at startup) is to open a command palette select a package and do something with that action. It's unlikely someone opens dozens of panels at the same time starting dozens of single install packages at the same time. All of which changes when opening up things to plugins. |
That is true. In the OP I already fell over the progress arg. So I completely changed the approach in the last p 5AFF ost. I could offer to implement the executor. It doesn't matter if all of this runs later on async/await. The usage here is actually that these tasks should run ordered. Other bits can run in parallel but here at the high level, the order matters. E.g. you can't shuffle remove and install. The interesting bit is that e.g. ActivityIndicator then becomes a function of the executor. So you don't have the |
For the basic functionality, installing, removing, and disabling and enabling
packages, provide an API. (IMO, we generally should provide an API
to open things up).
E.g.
(Maybe, scratch that
progress
arg as it would be nicer if we could solve this differently.)For
install_or_upgrade
consider this implementation or something among this:Note that type signature matches the high-level ones of e.g.
InstallPackagesCommand
.The difference is the layering --
InstallPackagesCommand
et.al. would use in factinstall_or_upgrade
under hood -- and that the functions are the blocking implementations. T.i.: the API
functions don't fall through and do some or all of their work after returning.
That is their main advantage and the driving motivator.
The text was updated successfully, but these errors were encountered: