-
Notifications
You must be signed in to change notification settings - Fork 641
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
Should Idris support versioning of packages? #1832
Comments
Thanks for writing this up! As far as version numbers / ranges: I'm a bit unhappy with how this works out currently on hackage, that is, requiring package authors to guess at some dep ranges in their package description, and hope they guessed right and that upstream packagers adhere to a convention of not breaking the parts of the API they use in minor version bumps. |
Here's a crazy idea: Move the dependency graph out of the packages. As I see it, the stackage approach is halfway there. This could open up for true dependency injection. The packages themselves are only allowed to hint at what packages they need - they should describe what requirements they put on such dependencies but does not point out particular dependencies/versions. It should be possible to generate this requirements description mostly automatically by looking at what the current package declares as imports. A separate entity - a dependency configuration - declares how dependencies are pieced together concretely. A dependency declaration can be handled completely independently from the packages themselves and can be version controlled. Here we can compare the stackage approach. Stackage maintains a list of dependencies that have been proven to build together. Finally - you can release a default dependency configuration with your package. But it becomes optional. One possible way of building your package. |
In node.js we simply write conditions in |
Rust's package manager cargo is one of the nicest I've used for a programming language. While it supports git and path dependencies, it primarily revolves around a central package repository called crates.io which requires that all packages use semantic versioning, e.g. MAJOR.MINOR.PATCH where
You can find more details on semantic versioning here. This allows cargo to provide a Enforced Semver? One common issue with cargo however is that these semantic versioning rules are not enforced, so occasionally a breaking change might slip through into a MINOR or PATCH release, breaking downstream crates. I'd love to see an Idris package manager that attempts to solve this by enforcing the versioning rules. Specifically, if any part of the public API of an Idris package is changed in a way that might break downstream usage, the package manager disallows publishing the package until a newer version is specified, perhaps with a message along the lines of:
Or something similar. This would probably have to be limited to some best-effort, limited scope of API changes like "public data and function signature changes only". I imagine this might work better in Idris than other languages though due to its rich type system! Immutability Another benefit of cargo and its central package repository is providing package immutability. Packages published to crates.io cannot be removed, greatly reducing the chance of downstream packages mysteriously breaking for reasons like this. That said, I'm not sure what happens if legal action is taken (e.g. a package violates some copyright or something). |
@mitchmindtree If you are thinking of contributing updates to the package manager you are welcome to. I think the features you are suggesting sound exciting, and of course you are welcome to add the changes incrementally. I do not like the idea that packages can not be removed, since I can think of plenty of legitimate reasons to keep the feature. |
@mitchmindtree As w.r.t to backwards compatability and enforced semver, this might not be trivial to detect. You are welcome to propose an algorithm of course, but you could e.g. change Perhaps, it can be strongly suggested changes, but not necessarily enforced (i.e., the tool can list possibly breaking changes). |
@ahmadsalim Ah true, I should have elaborated on this: although you can't completely remove packages, cargo allows you to "yank" packages. Here's the description:
|
Is there any progress on package management in Idris? I'm very interested in the language and its features, but I'm wary of lacking tooling/ecosystem. |
Idris has several features that can cause imports to break very easily. Use of unqualified names is one issue. You could have a file The above problem can be solved by disallowing unqualified names. However, a similar problem exists when it comes to finding interface implementations. Auto implicits and elaborator reflection may rely on the environment in even more subtle ways. What I conclude from this is that semantic versioning cannot guarantee that imports won't break. This makes it enticing to depend on a specific version of a package. If packages depend on specific versions of their dependencies, then what do we do when two packages In NPM fashion we could import two versions of So if we have this: -- Suppose packages a, b, c provide namespaces A, B, C with the following content
A.T : Type
B.f : A.T
C.g : A.T -> Nat Then this would be rewritten as: b_A.T : Type
c_A.T : Type
B.f : b_A.T
C.g : c_A.T -> Nat However, functions like h : Nat
h = g . f In the case where TL;DR. It strikes me that managing dependencies in languages like Idris will be particularly challenging. Warning: Sci Fi musings ahead Having looked at some of the problems that some of Idris’s features pose, let’s look at some of Idris’s strengths:
This makes me think that we could add scripts to our IDE for handling potential conflicts between packages:
Roughly, I’m proposing this:
|
We may want to consider supporting the versioning of packages. This will be useful when constructing an Idris package manager and help towards resolving dependancy issues.
Some, issues to consider:
Note parts of this issue may be 'resolved' in the future depending on how modules are implemented.
The text was updated successfully, but these errors were encountered: