-
Notifications
You must be signed in to change notification settings - Fork 80
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
Consider supporting package aliases / remapping #354
Comments
Above, I've briefly described the suggestion I remember from the registry call -- @f-f, please correct me if I've gotten anything wrong! That said, I have a few reasons why I currently don't think this is a good idea (though I'm open to changing my mind, of course!). Primarily, I just don't see how adding this remapping ability will really make the package sets any more usable for these two provided use cases. First, I'll describe why that is, and then I'll describe how you might do this without any changes to the registry package sets. Will this make package sets more viable for alternate backends?We're talking about changing the For example, imagine a {
"name": "purerl-ordered-collections",
"dependencies": {
"purerl-prelude": ">=1.0.0 <2.0.0",
"purerl-arrays": ">=1.0.0 <2.0.0"
}
} Let's say we've done this: we registered all our Any time we find a package in the official set that used JS FFI, we remap it: let upstream = ...
let overrides =
{ prelude = Registry { name = "purerl-prelude", version = upstream.version }
, ...
}
in upstream // overrides I've set the stage, and now I must ask: what does this actually buy us? From what I can tell, this buys us essentially nothing: any The only packages that would be affected by remapping are those which have no FFI whatsoever and which will work with any backend. But the Unless I have missed something here, I am not understanding what remapping in the registry package sets can do for us, and so I don't think we should implement it. Alternate solutionsReturning to the point of all this: how exactly can we ease the process of producing a new package set for these alternate backends or for folks who want to override My proposal: punt to the package manager! That's what our parametric package sets are for! If the |
I suppose I am misrepresenting things here, now that I've typed it out and hit the submit button (of course!). It's true that you can register all the The I still don't see why the And so I still think we should punt to package managers, and let package managers provide some mechanism for remapping package names -- something that works for both package sets and solvers. I don't exactly know what it should be, but possibly some kind of alias key could work? { name = "my-project"
, alias =
{ prelude = "purerl-prelude"
, ...
}
} This way the manifests and the registry itself are untouched -- everything stays clean here -- but on the client side you can do remapping to make things convenient. |
Right, this is really the crux of the issue, and I missed that. Does this mean that purerl packages can't be on the registry as it is today and can only be used via package sets? |
Some other problems:
I'm dropping the "in package sets" from the issue title, because this affects more than just package sets. |
I've been putting quite a bit of thought into a namespacing vs aliasing approach to handling support for alternative backends, and although I initially saw a few advantages to using a namespaced approach, I was finding too many corner cases relating to syncing "pure" packages across backends & ensuring package interfaces match. Because of those issues, I think time would be better spent working through the aliasing solution. To get the conversation going, I put some more thought into how an aliasing solution would work: Before thinking about this, I'd like to write down a few assumptions I am working off of:
I'd also like to write a few goals:
The Registry will support a list of known backends, perhaps in a format like the following. These will help us determine if a package is has FFI and if so, which backend it is targetting. I'll call the default JS backend "purs" for now.
To accomplish supporting alternate backends, I'd propose extending the existing
Rules:
There are a few workflows I can see happening that I'd like to talk through the behavior of:
I think I have some rough answers to a few of them:
@f-f / @thomashoneyman, I'd be happy to get your thoughts on this - does it seem to be a step in the right direction? |
I'll briefly sketch a solution to the open questions:
However, I think the scope for this thing is too big right now to include it in the alpha, and we should move on with the alpha if we are confident that this won't heavily disrupt the current design (which I'm personally confident about) |
Every entry in package sets produced by the registry uses the
Address
type, where a package set is aMap PackageName Address
, ie. key/value pairs between package names and addresses:https://github.com/purescript/registry/blob/561aa941c976d1fda6e9622a658394b5e2924d61/v1/Address.dhall#L11-L14
A registry-produced package set can only use the
Registry
constructor, so the package set is essentially a list like this:This indicates that when
package-name
is listed as a dependency in a project, package managers should fetchpackage-name
from the registry at version1.0.0
, read its dependencies, and fetch all those dependencies following the same process.This works just fine in the usual case where you bring in packages from the registry, but there are some times where this becomes inconvenient. Two examples were brought up in the registry call this morning:
purerl
and you need to use forked versions of common packages likeprelude
, because you need to re-implement the FFI.prelude
anyway, and you need forprelude
in package sets to point to your forked preludeHow can users deal with these two situations? For example, if you are developing a
purerl
-compatible package set, where packages using the FFI are forked to theirpurerl-
equivalents (ie.purerl-prelude
replacingprelude
), then what is the most straightforward way to produce this package set?The suggestion that was raised in the registry call this morning was to introduce a
name
field to theAddress
type for the registry, ie.Then, users can remap package names, ie. the
prelude
could be mapped topurerl-prelude
while other packages are left alone:When a package manager sees
prelude
as a dependency in your package, it is meant to fetchpurerl-prelude
instead. When it seesbifunctors
as a dependency, it should fetch that package as usual, and when it sees in thebifunctors
manifest that it in turn relies onprelude
, the package manager should recall thatprelude
has been remapped topurerl-prelude
and fetch (or cache) that.The text was updated successfully, but these errors were encountered: