Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Add Package Sets - #385

Closed
joefitzgerald wants to merge 10 commits into
atom:masterfrom
joefitzgerald:jf-add-packagesets
Closed

joefitzgerald wants to merge 10 commits into
atom:masterfrom
joefitzgerald:jf-add-packagesets

Conversation

@joefitzgerald

Copy link
Copy Markdown
Contributor

After discussions with @nathansobo, @maxbrunsfeld, @bolinfest, this PR will also add a third category of packages, the package set:

  1. package
  2. themes
    • ui theme
    • syntax theme
  3. package set

Prior Work:

Goals

  • Allow "bundling" of packages which complement each other, perhaps for a specific grammar, or grammars (e.g. objective-c, hack, golang, etc.)

Non-Goals

  • This PR will not address the UI required to visualize package sets

/cc @kevinsawicki @thedaniel @benogle @jlord

This formerly included #387, but #387 was split out.

@joefitzgerald joefitzgerald changed the title [WIP] Proposal: Add Package Sets [WIP] Proposal: Add Package Sets, Allow Packages To Hint Packages For Service Dependencies Jun 26, 2015
@park9140

Copy link
Copy Markdown

Could this be achieved via the following
A configuration parameter on the services configuration that defines a service's dependency level.
An api to for an individual package so that ui can be constructed around a given package at time of installation or configuration.

  • A listing of services dependencies for a given package.
  • A listing of installed services that provide the given dependency

An api to get the full de-duped list of service dependencies for as a general purpose global UI so that we can have something like the deprecations marker in bottom bar, that clicks to a full list of things that would resolve the missing parts.

Also out of curiosity, have we opened a similar pull request for the package server to create an endpoint for finding packages that resolve service dependencies?

@joefitzgerald

Copy link
Copy Markdown
Contributor Author

I was a little shocked to see this:

Why has nobody ever used the packageDependencies section of package.json? Perhaps someone has and it's not widely known. @kevinsawicki, looks like your code from an eon ago.

src_install_coffee_at_1e02245adc81438d1c941297967ec87ec428d4e4

@joefitzgerald

Copy link
Copy Markdown
Contributor Author

Also notable: #120 (comment).

@nathansobo

Copy link
Copy Markdown
Contributor

@joefitzgerald What do you think about separating package sets and required services into two separate threads? They seem orthogonal to me and the less we have to agree on, the easier it is to achieve consensus.

@kevinsawicki

Copy link
Copy Markdown
Contributor

Why has nobody ever used the packageDependencies section of package.json? Perhaps someone has and it's not widely known. @kevinsawicki, looks like your code from an eon ago.

It is only meant for running apm install from the root of atom/atom.

It nests the packages in node_modules so it is really only designed for using apm to build an app that ships with a collection of packages, not for packages to depend on one another when installed individually.

@thedaniel

Copy link
Copy Markdown
Contributor

separating package sets and required services into two separate threads? They seem orthogonal to me and the less we have to agree on, the easier it is to achieve consensus.

Strongly agree. Packages with overlapping services, and nuclide-like IDE bundles don't need to be forced into the same abstraction. The latter should be brutally simple, IMO - a set of package names and versions tied to a bundle name, no more.

@joefitzgerald joefitzgerald changed the title [WIP] Proposal: Add Package Sets, Allow Packages To Hint Packages For Service Dependencies [WIP] Proposal: Add Package Sets Jun 30, 2015
@joefitzgerald

Copy link
Copy Markdown
Contributor Author

@nathansobo, @thedaniel This proposal is now for package sets only. Service dependency hinting + metadata has moved to #387.

@just-be-dev

Copy link
Copy Markdown

I've been thinking for a little while that it would be nice to have a "perspective" package (like eclipse perspectives) such that the editor could morph from one thing to another based on the required usage.

A simple example would be switching between a normal atom install and Nuclide. When switching to the Nuclide perspective, the required packages would be enabled and any specified core packages would be disabled.

With that in mind, would it be reasonable to say that not only can packagesets define a group of packages to add, but also specify which packages should be disabled?

{
  "packageset": "tree-factor",
  "includes": [
    "awesome-tree",
    "ace-replace"
  ],
  "disables": [
    "tree-view",
    "find-and-replace"
  ]
}

Ultimately this config would be consumed by apm to install any missing packages and acted on my atom to activate/deactivate the specified packages.

@just-be-dev

Copy link
Copy Markdown

Also, take a look at the package-switch package.

@joefitzgerald

Copy link
Copy Markdown
Contributor Author

I think the notion of activating / disabling packages as a set ("perspectives") is orthogonal to installing / updating packages as a set. But I suppose they are related in so far as a package set could also be a perspective (or could include multiple) (or could have no perspective(s)). I'd prefer to keep the two separate though. That's a super interesting idea though.

@just-be-dev

Copy link
Copy Markdown

The deactivation of packages isn't apart of the perspective, but actually apart of the package-set construct. I don't think packages should be updated as a set either, that mechanism should stay how it is. Updating a package-set would only be required when the configuration of the package-set has changed in which case it wouldn't actually update the individual packages but install new or disable old packages.

I'll go back to Nuclide as my example. Nuclide shouldn't have to have its own installer to be installed easily. A user shouldn't have to look up what packages need to be installed and what packages need to be disabled for it to work correctly. The user should be able to install the "Nuclide IDE" in the Bundles/Package-Sets/whatever tab on settings view and it should install the specified packages AND do whatever else it needs to do to function properly (in this case disable the relevant core packages).

@nathansobo

Copy link
Copy Markdown
Contributor

@joefitzgerald Do you have a proposal for the concrete syntax you'll want to use in package.json? I can't seem to find it.

Initial thoughts/Questions:

  • Right now the package.json has a theme field. It seems a bit weird to continue this pattern. I wonder if we should move toward a packageType field, with the possible values of syntax-theme, ui-theme, or package-set.
  • What will we name the field that contains the list of packages to install? includedPackages?
  • Will the list of packages to install be a hash or an array? I think a hash might be better because the set could specify version ranges.
  • To prevent people abusing this feature into package dependencies, package sets should not allow executable code or any other package content. That's going to be a bit weird because basically the entire contents of the repo will be a README.md and a package.json. I guess that's fine.
  • I think as a first pass we should focus just on installation. What does that UI experience look like?

@just-be-dev

Copy link
Copy Markdown

@nathansobo, Are you sure it should be a hash? Theoretically the packages should interact through versioned services. Granted, I realize that isn't bulletproof, but it's better than having two package-sets installed that depend on different versions of a particular package.

@nathansobo

Copy link
Copy Markdown
Contributor

Are you sure it should be a hash?

No, I'm not sure. Maybe it should be an array and we always install the most recent version of a given package. Actually that's probably better because we won't get into a scenario where packages depend on being installed via a set to be version-compatible.

@joefitzgerald

Copy link
Copy Markdown
Contributor Author

I think we want a hash so that we can specify minimum versions. This would allow us to have a flow that requires the user to upgrade some packages. Initially we may not use the version information, but we could in the future.

@just-be-dev

Copy link
Copy Markdown

What about

{
   "name": "my-package-set",
   "packageType": "package-set",
   "includes": [
     "package1",
     { "package2": { "minVersion": "1.2.3" } },
     "package3"
   ]
}

For the average case of including the latest version of a package it's as simple as specifying the package name as a string. Optionally you could give it an object which can have metadata (which could be expanded in the future if need be).

@joefitzgerald

Copy link
Copy Markdown
Contributor Author

@zephraph I think I may just go with specifying the versions the same way that we allow specifying dependencies; the difference being that we will ignore the maximum version (if specified). This allows us to use the same code we use to handle dependency versioning, minimizing the effort.

@park9140

Copy link
Copy Markdown

✏️ Updated based on a conversation with @joefitzgerald to try and make my position more clear.

@joefitzgerald, @nathansobo
I'm thinking that we really don't need to be adding package set configuration via package.json.

Apm is about installing packages which it does well. A good extension in my mind is to enable apm to install package sets. Both via api, and command line.

A package set based install might have an input that looks like

[
     "package1",
     { "package2": { "minVersion": "1.2.3" } },
     "package3"
]

the apm api implementation could look something like
apm.installPackages(packagesToInstall)

The command line could include some simple request wrapping so it could take local files and urls, so you could run
apm install http://location.com/of/packageSet.json
or
apm install localPackageSet.json

Problems with this method.

  • We lose some simplicity of implementation on the services side. For this to work we need to depend on a secondary listing methodology for package sets.

Benefits as I see it,

  • as @nathansobo said

    To prevent people abusing this feature into package dependencies, package sets should not allow executable code or any other package content. That's going to be a bit weird because basically the entire contents of the repo will be a README.md and a package.json. I guess that's fine

    to me this shows that when we are talking about these packages we don't really need or actually want alot of things that are built into an apm install.

    • adding dependencies for this package seem entirely unnecessary
    • we may want to allow users to see that the package set was updated but it's not really a necessary thing that should show up in the packages updated list
    • it really shouldn't have a package updated value
  • apm code is not burdened with having to managed package sets when they don't really follow the same install patterns as other packages.

@nathansobo

Copy link
Copy Markdown
Contributor

I'm not totally married to supporting this in apm, but it does seem like atom.io is a natural place to publish and consume these things. That fact alone makes apm and atom/atom a pretty convenient place to implement it. @park9140 do you have a suggestion as what the publishing workflow would look like if we didn't go with apm?

@thedaniel

Copy link
Copy Markdown
Contributor

it does seem like atom.io is a natural place to publish and consume these things

I generally agree with this, but we need to make sure they can be used and worked on outside the atom.io ecosystem, for development or private packages sets etc, so we probably still need to specify some kind of static format even if it's only used for test/dev.

@park9140

Copy link
Copy Markdown

@nathansobo, just updated my comment with an idea as to how package sets could be integrated into apm. Installing could be as simple as a gist with the package config in it.

The atom.io website could provide a rest service that allows users to post and consume package sets.
I'd see the simple rest endpoints being

  • packagesets/id PUT/GET: (authenticated by github creds, editable by anyone listed as a maintainer on the package set
  • packagesets GET: which would have the filterable list of package sets
  • package/id/packagesets GET: which would get the package sets that contain a given package (this would be used by atom.io, and atom package list to list packagesets that contain a package)

A atom package would be necessary to manage them within atom and that could operate off the same apis or allow you to point at your own gist/repo if you had a set of packages you used on all your machines.

@park9140

Copy link
Copy Markdown

@thedaniel, I updated my comment above on where I think apm actually should be in the packageset installation process.

@park9140

Copy link
Copy Markdown

@nathansobo is the atom.io website on github, I'm pretty interested in looking into what it would take to get service dependencies built into the apm listings so we can add ui for helping users discover packages that utilize or provide services.

@joefitzgerald

Copy link
Copy Markdown
Contributor Author

In my view this is not viable if it's not supported by atom.io and handled by the existing publishing workflow. I'm not going to invest the time to build alternate publishing, hosting, and distribution workflows. If apm isn't viable, I consider this issue closed.

- Current values: `package` (the implicit default, if omitted), `ui-theme`, `syntax-theme`
Comment thread src/list.coffee Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this maintain backwards compatibility?

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

So if I want to uninstall a package set, we cannot currently remove any packages from the set since that might remove a package that I had installed prior to installing the set.

I think that even if a package was previously installed, uninstalling it when the user uninstalls the package set is a fine behavior to start with.

We have very little information about how people will want to use package sets, so there's a high risk of over-engineering this feature, or building the wrong thing entirely. And in this case, the worst outcome is that somebody accidentally uninstalls a package and needs to reinstall it.

@thedaniel

Copy link
Copy Markdown
Contributor

I think that even if a package was previously installed, uninstalling it when the user uninstalls the package set is a fine behavior to start with.

I disagree very strongly.

@thomasjo

Copy link
Copy Markdown
Contributor

I think that even if a package was previously installed, uninstalling it when the user uninstalls the package set is a fine behavior to start with.

I'd be pissed if that happened, but I guess it's something that I'll have to live with.

My point with designing this at least somewhat similar to aptitude, and similar such package managers, is that they've solved most of the points of pain (and what not). We're not exactly in uncharted waters here.

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

My point with designing this at least somewhat similar to aptitude, and similar such package managers, is that they've solved most of the points of pain (and what not). We're not exactly in uncharted waters here.

Yeah, I'm not saying we should re-invent the wheel here. I'm saying that we may not even need a wheel. In other, less metaphorical words:

  1. Our use case is different than aptitude's
  2. aptitude is complex, both for the end user and to implement
  3. I would really prefer to let real user's experiences drive our decision here, not speculate about what we need.

@just-be-dev

Copy link
Copy Markdown

What if instead of just uninstalling all the packages when you go to uninstall the package set, it showed you a list of all the packages that would be uninstalled when you uninstalled the package set. You could then deselect certain items from that list to keep.

The package set would be "uninstalled" along with any selected package, but it would leave the others alone.

Granted it could be annoying for huge package sets, but it's a simple implementation without removing packages you may be using.

@joefitzgerald

Copy link
Copy Markdown
Contributor Author

I think there is a half-way house between these extremes:

  • Don't uninstall any packages when uninstalling a package set
  • Uninstall all packages in the package set when uninstalling a package set

And that is simply to prompt a user visually (settings-view) or textually (apm) to uninstall packages in the package set, while also providing flags to uninstall all or none. This provides a model with three states for uninstall behavior: [all, none, none:all with prompting] (the latter would be the default behavior.

@thomasjo

Copy link
Copy Markdown
Contributor

Our use case is different than aptitude's

Agreed, although not wildly different.

aptitude is complex, both for the end user and to implement

Again agreed, and I'm not saying we should build anything as complex, but they've got some really good concepts. Amongst them are the notions of installed and automatic.

I would really prefer to let real user's experiences drive our decision here, not speculate about what we need.

Sure, but then I suggest we do not remove any packages when uninstalling a set. Removing them is destructive. Leaving them is messy, but at least it's not destructive. Lesser of two evils.

@thomasjo

Copy link
Copy Markdown
Contributor

I think there is a half-way house between these extremes:

  • Don't uninstall any packages when uninstalling a package set
  • Uninstall all packages in the package set when uninstalling a package set

Yeah, that's along the lines of something we discussed in this thread last week (or the week before that?), and would work better than blindly removing everything in a package set.

@bronson

bronson commented Jul 28, 2015

Copy link
Copy Markdown
Contributor

@zephraph and @joefitzgerald well said. That's exactly the point I was trying to get across.

I agree, blindly uninstalling a package without giving the user any warning sucks. If that's the only alternative, then that puts me squarely in @thomasjo and @thedaniel's camp.

Leaving all the packages sucks too. I'd be almost as pissed if I installed uber-vim-mode, didn't like it, then had to spend 15 minutes tracking down all the crap it left behind. I'd never touch another package set after that experience, that's for sure.

Is there anything wrong with showing a single dialog box to let the user choose whether to take additional action or not? (other than additional UI is certainly not something to be added lightly... but in this case, it seems like the best option)

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

I'd be almost as pissed if I installed uber-vim-mode, didn't like it, then had to spend 15 minutes tracking down all the crap it left behind.

I agree. In all of the concrete use cases for package sets that I've heard (uber-vim-mode, nuclide, go-plus), the package sets don't overlap with each other. For example, in @joefitzgerald's proposal go-plus does not include linter. So from what I can tell from our discussion so far, in the common case, the user will intend to uninstall the packages.

I think that if we show a simple, static confirmation dialog that lists the packages to be installed, the user won't be surprised. If they want to uninstall a subset of the packages, they can always do that using the existing UI. I would tend to want to avoid building another way of doing it.

@just-be-dev

Copy link
Copy Markdown

I think the redundancy is justified.

The base case is, as you've stated, to remove everything. That's easy to do because we've got a list of everything necessary to be removed.

How much harder then is it to add one more layer of UI to let the user specify what should be removed?

Personally I think the added control that it gives justifies the extra work. I'm not necessarily suggesting that it has to be a phase 1 feature, but it should be a goal.

@bronson

bronson commented Jul 28, 2015

Copy link
Copy Markdown
Contributor

If we do uber-vim-mode correctly, there's a good chance you'll decide that you don't like vim-mode but you can't live without paner and cursor-history (for example). I hope that keeping one or two packages while blowing away the package set will appeal to people.

That said, I don't feel strongly. In the interest of under-engineering, maybe it makes sense to implement @maxbrunsfeld's static warning for now. It can always be improved once the feature requests and complaints start rolling in. :)

@lloeki

lloeki commented Jul 29, 2015

Copy link
Copy Markdown

I've seen apt and rpm cited as comparisons, does anyone care to take hints at how pacman's take on this works? I've only used it, but the simplicity is refreshing (enough that I didn't even had to ever care about how it's implemented, contrary to apt). I couldn't help but think of it while reading @maxbrunsfeld's and @bronson's comments.

@bronson

bronson commented Jan 6, 2016

Copy link
Copy Markdown
Contributor

Just curious, are package sets on hold for now? It seems like, right as consensus was reached, everything went dark. :)

Near as I can tell, package-deps and atom-package-dependencies are the best way to declare dependencies today, with package-deps looking a bit cleaner and more lively. Is there anything else to consider before just going with one of those?

@Arcanemagus

Copy link
Copy Markdown

@bronson just a heads up: If by "package-deps" you meant package-deps, then remember that it is atom-package-deps on npm, so if you are using that make sure you use the npm name when listing it as a dependency.

@bronson

bronson commented Jan 6, 2016

Copy link
Copy Markdown
Contributor

I did mean that, thanks @Arcanemagus. Still, I'd rather have package sets! (I think...)

@Arcanemagus

Copy link
Copy Markdown

Having it integrated into Atom is definitely preferable 😉.

@thedaniel

Copy link
Copy Markdown
Contributor

Just curious, are package sets on hold for now?

They aren't consciously on hold, and you're right that it seems some kind of consensus was reached. I just think that @joefitzgerald became busy with other things and no one else from the community / core team has picked up the effort since then. They would still be a good thing to have.

@bronson

bronson commented Aug 23, 2016

Copy link
Copy Markdown
Contributor

@joefitzgerald, what's the reason for closing? I'm still interested.

@joefitzgerald

Copy link
Copy Markdown
Contributor Author

This concept has been tested at length by me via go-plus. The concept has a number of side effects and these make it difficult to reason about package sets.

For instance, what if you want all packages in a set, except for 1? What happens if you uninstall a package, and then install a new version of the package set?

It is possible to achieve everything I described here via use of package-deps. But even that falls short. This leads me back to the drawing board, to attempt a different approach via go-plus which could then be codified as a proposal for apm / core.

As others have stated, this actually requires user experience work to make it obvious what will happen when one thing installs other things, and also allows users choice while avoiding undesirable behavior in edge cases (e.g. the uninstall one).

@bronson

bronson commented Aug 23, 2016

Copy link
Copy Markdown
Contributor

Right on, that makes sense. Thanks!

I have yet to see any package manager that doesn't have weird corner cases... Maybe the next attemt will be the first. :)

@joefitzgerald

Copy link
Copy Markdown
Contributor Author

Corner cases will always exist. The takeaway from my comment is that this needs to be user experience led; it's not a raw apm feature.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.