-
Notifications
You must be signed in to change notification settings - Fork 697
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
Being able to explicitly specify package repository namespaces #8695
Comments
I'm not sure that this is the behaviour you actually want. For example, the reason there are forks of Hackage packages in the Cardano package repository is because we want to use them instead of the ones from Hackage. That means we're relying on the "late binding" of package names in With this proposal, package metadata would more precisely bind the package dependency, which would prevent this kind of overriding. That's not to say it's not desirable, just that it would make it harder to do what we do today. I'd like to propose something slightly different. I think what we have here is at least analogous a petname system.
The crux here is that we have somewhat-underspecified names that are helpful for generally finding packages, but don't pin things down entirely, and then in a particular context we pin them down to something specific. So perhaps we could instead have something like an "address book" in
(deliberately terrible syntax and naming to avoid starting that discussion off yet) That tells This might also give us a cleaner alternative to the current This problem pops up in another place: the wild namespace of C libraries. At the moment The same system would be very useful there! In a
That would again let users patch up the loose global names as they see fit, in exactly the same way. |
Please don't touch
(It would be technically possible to rename packages as repository indices are made)
Also |
Are there many companies in the wild (besides Cardano) which run private Hackage servers? Most of the time people just use |
While I wrote the original proposal this is based on, I'm sympathetic to the idea that we should avoid changing cabal file syntax if possible, and that the new tools and machinery we have built since that proposal was drafted could provide a roadmap to doing so. One issue that the discussion here has not addressed, but which the original proposal did, is what happens when emergent overlap occurs. Assume I have a private repo, which provides We have no way, at the moment, of building As a hackage maintainer, I've certainly become aware of some companies that run private hackages -- the competing internal solution, used at e.g. my current company, is nix, which I find also works well. I couldn't estimate how many such companies there are, but I do think there are enough current and also potential users that this problem is worth spending some time to solve well and thoroughly (though not urgently!) |
No idea about "many". But we do. Probably, among others. How "many" do you need to justify fixing this? |
(I'm not making any decisions here.) My original point was to seek feedback on the proposal from potential users, but I knew none, thus asked. |
There's a chicken-egg problem here if you want to see users of a system before building the system. I've considered running a package server but never pursued it because there would be no way to namespace the packages. |
I hope that renaming The story would be quite different if there were competing central repositories, e.g. Hackage and EvilTwin, and packages from both of these were used by companies. Let's not build such future. |
Forgot to say
scenario can happen with just a monorepository. And there a repository namespacing won't help. |
What I'd love to be able to see is a system in which it is possible to self-publish packages that are just as accessible as packages on the central Hackage. If there are two package servers A and B, a library hosted on server A should be able to declare a dependency on a library hosted on server B, and vice versa. Without placing URLs in the cabal file itself, I am not sure this proposal accomplishes enough. It seems to me that it pushes the problem out a little, but still requires a central registry to map repository names to URLs? |
https://cabal.readthedocs.io/en/stable/config.html?#local-no-index-repositories on a network drive. |
Currently, if a package is on Hackage, somebody can publish another package and declare a dependency on it. Suppose I self-publish a package named |
I really don't believe this would be a bad thing. Multiple service providers aren't necessarily fighting with one another. Just one use case I had in mind: I'd love to be able to start a server that welcomes useless beginner package contributions, so that people could follow an intro tutorial that involves realistically publishing a package (a package that would violate Hackage rules because the publisher does not intend to maintain it or for it to be useful to others). This has reason to exist as a separate server and it would be a "competing" server but not in an antagonistic sense. |
Why would you want to make your and your users life hard? What would happen when your user publishes a package with How |
Okay, then suppose I first give my package a unique name, and then somebody else publishes another useful package of the same name on Hackage without any knowledge that people are using mine. |
First step is that you can define shadowing. That will help until the uniquely named package on Hackage becomes popular so it finds a way into your dependencies, like @gbaz explained. Hopefully by that time you'll figure out and have already renamed your package. EDIT: and if renaming your package is somehow extremely hard, then I'd say that the addressbook approach could still be able to rename it as index of your repository is made. |
@phadej Would you say that you disagree with the following?
haskell/ecosystem-proposals#4 (comment)
My proposal says:
|
Good. So Chris would always need to write How |
I feel we've conflated two things into one proposal:
|
Yes, I agree, much like we have package-scoped |
I think we have to keep the "what" separate from the "where", and only the first belongs to .cabal files. Securely unique names can be achieved at a higher level (cabal-install, distro packages...). Go mixes the two, and while it appears simple, I think it can lead to a lot of problems. They even had to build a massive caching infrastructure to deal with it. Just an example: suppose repository @A gets abandoned, or the maintainer of package @a/x wants to migrate it to @b/x. Suddenly all versions of all reverse dependencies need their metadata changed! "What" is immutable, "where" isn't. |
Note: This is an effort to finish the work that was started with the Provenance-Qualified Package Imports GHC proposal
Scenario: I am a user in a corporate environment and I wish to rely on packages across several package repositories: Hackage Central, a privately-hosted package repository, and a public third-party repository. As it happens, the package names are not unique across the repositories, because internal forks have happened.
Repository marker
I would like to be able to specify the package repository where a dependency belong so that its origin is made crystal clear from only reading the cabal file. Example:
Here we have four elements:
@hackage
is explicitly referring to the Hackage Central server@mycompany
is explicitly referring to my company's privately hosted package repo@cardano
is a publicly available package repository based on Cardano's Foliage setup.The '@' syntax is take from package repositories like NPM (@purescript/node-fs).
Today, the Flora meta-index already supports the namespacing of Hackage packages like @hackage/base-orphans.
Isolation
Hackage Central normally operates under a "closed world" assumption (with the notable exception of packages later removed because they were fraudulent), and it is desirable to maintain this constraint. As the GHC Proposal linked above suggest, it should unequivocally reject packages that make use of this feature.
Regarding third-party repositories, I am of the initial opinion that they could allow packages that refer to other third-party repositories, and the packages themselves would document the configuration procedure to add new package repositories.
Configuration
There are two aspects to consider:
$XDG_CONFIG_HOME/cabal/config
and/orcabal.project
that would declare the configured package repositories:I am certainly missing some crucial elements here, and I'd be happy to consolidate this ticket based on your inputs. 🙂
cc @gbaz @andreabedini
The text was updated successfully, but these errors were encountered: