-
Notifications
You must be signed in to change notification settings - Fork 710
[RFC] Introduce name-agnostic package filename #6299
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
No one's forcing you to name your cabal files by their pacakge-name, it's just a convention. In fact naming every cabal file |
Evaluating your points above one by one: 1) Nope, you can keep the name the same, it'll still work. 2) IMO tools should use the Cabal library to read cabal files anyways or they're just going to be prone to break. 3) Come on, finding |
Ah,
So this wouldn't be distributable on Hackage actually! |
Not true,
|
Partially agree. Sometimes you just want to get a value of the
This is not exactly true if I want to scrawl GitHub. Knowing owner and package name, I can't just construct the URL to the
This requires to perform an extra call to the GitHub API to get the content information making the code less performant and hitting GitHub API rate limit even sooner. |
I'd say, no you cannot. You can do some smart regex, but that's a hack.
But you can now, what's the problem then? How about multi package repositories, this change won't help those, will it? That said I'm not against this idea in general. But a bit more elaborate proposal would be nice, the migration story have to explicitly written out.
|
On Thu, Oct 17, 2019 at 09:13:31AM -0700, Dmitrii Kovanikov wrote:
Also, `Cabal` is a boot library and supporting builds of your package under multiple GHC version can be a bit painful if you want to do something simple.
Just because it's a boot library does not mean you have to support all
versions of it. That is only true if you also happen to depend on the
`ghc` library so not in general.
Also, I don't see a function of type `getCabal :: IO GenericPackageDescription`. AFAIU, you still need to provide a full path to the `.cabal` file:
getCabal verbosity =
readGenericPackageDescription verbosity
=<< defaultPackageDesc verbosity
> 3) Come on, finding .cabal files is like five lines of code, that's not a fair trade for literally thousands of independent projects having to change to comply with this!
This is not exactly true if I want to scrawl GitHub. Knowing owner and package name, I can't just construct the URL to the `cabal` file like this if I want to fetch information:
```
https://github.com/raw/kowainik/relude/master/relude.cabal
```
This requires to perform an extra call to the GitHub API to get the content information making the code less performant and hitting GitHub API rate limit even sooner.
Ah that makes more sense. I honestly still don't think the whole
ecosystem should pay the price just because of this arbitrary
limitation though. Have you tried asking Github for a better API even? ;)
|
What I can now is to get the list of all Haskell repositories with their names in a single GitHub search query (well, almost, but that's implementation detail). However, as I mentioned, the GitHub repository can have a different name from the Haskell package inside. And for now, my application can't handle such repositories without extra work.
It actually will, because the file for describing multiple packages is already always called
I agree with this, sounds reasonable.
I'm not aware of such implementation details, but I guess that's fine. |
Yes, I tried, and they are not going to change the way their API is implemented. My primary motivation is not to adapt to the specifics of the GitHub API, though, this would solve a real practical problem for me. I think that this is a general overall improvement. And this feature is opt-in. However, I have a feeling that a lot of people will appreciate this change 🙂 |
I suppose if we make this conditional on the cabal-version it wouldn't be as bad as I thought actually. At that point it really is just an aestetics thing but doesn't (really) break anything. Though I'm not sure you can call it opt-in if we start enforcing the |
I'm scared of the internet nowadays... Also I'm quite sure something in I can only say that this is non-trivial change, and one will learn more when implementing it |
HI! Could we re-open this discussion? We are currently in-between the two worlds --- I think we should either error out early if package foo doesn't have |
Before, if the name of the Cabal file did not match the acutual package name, then `cabal sdist` would include the Cabal file as-is in the source distribution, causing a subsequent `cabal check` to issue a warning and the failure of a Hackage upload. This commit changes that behaviour: The name of the Cabal file in the source distribution always matches the package name, regardless what it was named in the filesystem. Related issue: haskell#6299
Before, if the name of the Cabal file did not match the acutual package name, then `cabal sdist` would include the Cabal file as-is in the source distribution, causing a subsequent `cabal check` to issue a warning and the failure of a Hackage upload. This commit changes that behaviour: The name of the Cabal file in the source distribution always matches the package name, regardless what it was named in the filesystem. Related issue: haskell#6299
Before, if the name of the Cabal file did not match the acutual package name, then `cabal sdist` would include the Cabal file as-is in the source distribution, causing a subsequent `cabal check` to issue a warning and the failure of a Hackage upload. This commit changes that behaviour: The name of the Cabal file in the source distribution always matches the package name, regardless what it was named in the filesystem. Related issue: haskell#6299
If I have a package called
foo
the.cabal
file for this package must be calledfoo.cabal
. For the packagebar
it must be namedbar.cabal
. So the name of the file that describes package metadata should be the same as the package name. This is a minor inconvenience that makes it harder to write tooling and interact with packages:default-extension
can't just read a single file, and they need to filter files with the.cabal
extension and do extra work.So It feels that introducing a single name for all packages can make the ecosystem healthier. I'm not sure what are the benefits of forcing the
.cabal
file to have the same name as a package. But I see the benefits of having a single file name without apparent drawbacks.Proposed change
package.cabal
or just.cabal
).cabal-install
should first look at thepackage.cabal
file to read metadata and if this file is not present, fall back to the current scheme.Pros
Cons
cabal-install
permanently or temporary (if this change is going to be accepted and all packages will migrate to this scheme after 10 years).Alternatives
The text was updated successfully, but these errors were encountered: