-
Notifications
You must be signed in to change notification settings - Fork 6
Unified Conda JavaScript API? #5
Comments
As an example of such an API: https://github.com/lidavidm/conda-js This library is usable in both Node and in a browser. In the former it asynchronously calls // if in Node
// var conda = require('./conda');
conda.Env.getEnvs().then(function(envs) {
envs[0].linked().then(function(linked) { console.log(linked) });
envs[0].remove('markupsafe').done(function(info) {
console.log('Removed package');
});
}); |
The current conda-api was created for launcher originally. It should be -Travis On Mon, Jul 7, 2014 at 2:48 PM, David Li [email protected] wrote:
Travis Oliphant |
@lidavidm, so what's the reason for using nodejs? I presume this has something to do with atom (whatever this is). I would highly recommend reducing our toolchain, rather than bloating it more. But maybe you can point me to relevant discussions/design docs. Make sure to remember about long term maintenance of this software. Btw. the name is confusing, this should be conda-node or something. |
@mattpap Atom Shell is Webkit packaged so that a web app can be run in its own window as a desktop app, like what we use QtWebkit for, and with additional desktop and Node.js APIs. The reasoning behind this library is that we (will) have three projects, Anaconda Launcher, Conda UI, and Wakari Express, structured as webapps that control conda by making requests to a server. Instead of duplicating this effort, we can use a single JavaScript interface. It supports running under node because of Atom Shell, but is also designed for the browser (thus conda-js, not conda-node). The reasoning behind Atom Shell is that it is more up-to-date/(hopefully) less buggy than what Qt provides, and because it (for Anaconda Launcher) allows us to skip the webserver entirely; conda-js will transparently control conda by running it as a subprocess instead. |
Additionally @joelhullcio and @tswicegood have discussed using Atom Shell for what will eventually be Wakari Express, perhaps they could offer you more insight on that? |
@mattpap, @lidavidm has been doing some exploratory work with atom-shell to see if it might work as a good alternative to using QtWeb. One of the bonuses we get in atom-shell is the ability to launch sub-processes directly via an embedded Node.js setup, thus the need for a Conda JavaScript API that can execute against a remote server and one that can execute in Node. That's where conda-js comes in. It's meant to be that shim that provides access to conda's API either via a RESTful web service or a sub-process. |
Is conda-js the node-js equivalent to conda-api? -Travis On Tue, Jul 8, 2014 at 5:46 PM, Travis Swicegood [email protected]
Travis Oliphant |
conda-js is the browser & node equivalent of conda-api. The browser version needs a RESTful server on the machine where the conda environment is installed; the node version simply needs the FYI, @teoliphant, you're emails are coming from an address associated with |
I just wonder if we can make it really RESTful, i.e. stateless. For example, right now I ask for a plan and then ask to install (which recomputes the plan). I could send the entire plan back to server, assuming nothing changed in between. I also need progress bar support which implies websockets, unless we want to do long polling/comet. In general I'm in favor of unification and simplification of our stack, so if this helps, lets proceed. |
@lidavidm, speaking about the API itself, you shouldn't limit your work to what conda's CLI provides. It's limited and disorganized. It looks like you thought about the later issue. Regarding the former, look e.g. at https://github.com/ContinuumIO/conda-ui/blob/master/conda_ui/api.py#L61. This wraps conda's |
@mattpap I noticed the same and was wondering how best to handle that. Perhaps that class should be merged into |
@mattpap regarding @ilanschnell thoughts? |
I presume yes. I actually started from modifying conda, but I wasn't sure how much time it will take to review and merge those changes, and people are more likely to try out new code if setup is limited to minimum (e.g. it doesn't depend on modified versions of other packages). I actually have an obsolete branch with those changes and addition of |
It all depends if we can proved required functionality this way. If so, I have no issue with moving this code elsewhere, leaving |
It's better to not use the Python API to conda. It will force whatever uses it to be installed in the root environment. |
So @tswicegood and I have been talking about this. The Anaconda Launcher/Wakari Express/this project all (will eventually) control Conda by making requests to a webserver that interacts with Conda; it would be beneficial if all could use the same API - what should this API look like?
Also there is the issue of the API the webserver uses to control Conda. anaconda-launcher and conda-ui call
conda
directly; neither useconda-api
andconda.api
is missing functionality for both. I think it would be better if both used a unified API (such asconda-api
), as then the behavior and returned data would be the same for all users.conda-api
doesn't cover all the functionality, and the command line JSON API it depends on is also incomplete (conda/conda#795, conda-archive/conda-api#4 improve this). The questions here are whether the same API should be used and what that API would look like.Using the command line
conda --json
API would be nice in that it would let Anaconda Launcher, when/if eventually ported to Atom Shell, skip the webserver entirely - it could interact with the conda process directly (and the JS library could transparently handle this, if the JSON from the server and fromconda --json
match/are very similar).The text was updated successfully, but these errors were encountered: