Skip to content
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

feature(pkg): dune pkg outdated #8773

Merged

Conversation

Alizter
Copy link
Collaborator

@Alizter Alizter commented Sep 26, 2023

We add a dune pkg outdated package that will display outdated package dependencies with respect to the configured opam repositories.

It comes with a --transitive flag that shows all outdated transitive deps.

Screenshots

image
image
image

@Alizter Alizter force-pushed the ps/branch/feature_pkg___dune_pkg_outdated branch 4 times, most recently from 10cd623 to de6abb3 Compare September 27, 2023 00:32
@Alizter Alizter force-pushed the ps/branch/feature_pkg___dune_pkg_outdated branch from de6abb3 to 754f77c Compare September 27, 2023 01:27
@rgrinberg
Copy link
Member

I like how the output can separate transitive vs. immediate dependencies, but I don't think this is something users will find obvious. So how about making the normal mode explain this. E.g.

12/15 immediate and 140/200 transitive dependencies are out of date. Displaying immediate dependencies only, add `--transitive` to display everything.

bin/pkg.ml Outdated Show resolved Hide resolved
bin/pkg.ml Outdated Show resolved Hide resolved
@Alizter Alizter force-pushed the ps/branch/feature_pkg___dune_pkg_outdated branch from 754f77c to e9c0d97 Compare September 27, 2023 14:04
@Alizter
Copy link
Collaborator Author

Alizter commented Sep 27, 2023

@rgrinberg I've refactored the error handling to use result instead rather than messing around with fibers. At the end I use Fiber.parallel_iter to raise all of them as user errors. I could combine this into a single raise if that's better.

I've also added support for the --all-contexts arg and updated the test so that it works for lockfiles in different contexts also. We also now print which lock file we are talking about to be clearer to the user. See the image in the top post for an updated screenshot.

I'll see what I can do for adding more information about immediate vs transitive deps in the message and also some counting.

@Alizter Alizter force-pushed the ps/branch/feature_pkg___dune_pkg_outdated branch 3 times, most recently from f345681 to 3f741e3 Compare September 27, 2023 15:26
@Alizter
Copy link
Collaborator Author

Alizter commented Sep 27, 2023

I've merged the errors into a single error message, however they are still separate errors per context. See the test for how this looks in practice.

@Alizter Alizter force-pushed the ps/branch/feature_pkg___dune_pkg_outdated branch from 3f741e3 to 42df514 Compare September 27, 2023 23:38
@Alizter
Copy link
Collaborator Author

Alizter commented Sep 27, 2023

I've pushed a change that gives informative statuses based on the information present. Notably there is now a module Dune_pkg.Better_candidate in charge of dealing with all this status printing business. It was getting too long and complex to include in pkg.ml so I opted to move it to its separate module where its internal workings are hidden.

This also lets us test the messages extensively, so I have gone ahead and done that and enumerated all the combinations of 4 packages both transitive and immediate to test how the message ought to change.

I haven't yet settles on the forms of the status, notably I didn't incorporate @rgrinberg's suggestion of counts in the statuses yet.

I also have some cleanup to do in the cram test since there is some redundant information with the context.

I will iterate on this tomorrow.

@Alizter Alizter force-pushed the ps/branch/feature_pkg___dune_pkg_outdated branch 4 times, most recently from 8b4baa3 to 1d1dcd6 Compare September 28, 2023 14:21
@Alizter
Copy link
Collaborator Author

Alizter commented Sep 28, 2023

I've pushed some more changes.

The number of packages that need updating is now reported. Have a look at the screenshots spoiler in the original post.

image

Edit: I've tweaked the styles a bit further now.

@Alizter Alizter force-pushed the ps/branch/feature_pkg___dune_pkg_outdated branch from 1d1dcd6 to 5814c0d Compare September 28, 2023 14:48
@Alizter Alizter force-pushed the ps/branch/feature_pkg___dune_pkg_outdated branch 2 times, most recently from 81cea41 to 806c8c5 Compare October 2, 2023 02:02
@Alizter Alizter force-pushed the ps/branch/feature_pkg___dune_pkg_outdated branch from 94a98a3 to baf0658 Compare October 4, 2023 02:12
src/dune_pkg/outdated_packages.mli Outdated Show resolved Hide resolved
src/dune_pkg/outdated_packages.mli Outdated Show resolved Hide resolved
bin/pkg.ml Outdated Show resolved Hide resolved
@rgrinberg
Copy link
Member

All the pretty printing code should be moved from dune_pkg and into the binary. All of that stuff are implementation details of the command itself.

@Alizter
Copy link
Collaborator Author

Alizter commented Oct 4, 2023

@rgrinberg Can I propose splitting up pkg.ml then? Otherwise that file is getting too long.

@rgrinberg
Copy link
Member

How about you just add your own command as pkg_outdated and split the existing stuff in a subsequent PR?

@Alizter
Copy link
Collaborator Author

Alizter commented Oct 4, 2023

@rgrinberg Sorry, I didn't mean splitting all the other commands, I just meant outdated.

@Alizter Alizter force-pushed the ps/branch/feature_pkg___dune_pkg_outdated branch 4 times, most recently from f6e8423 to ae5824b Compare October 10, 2023 21:51
bin/pkg.ml Outdated Show resolved Hide resolved
@Alizter Alizter force-pushed the ps/branch/feature_pkg___dune_pkg_outdated branch 4 times, most recently from f256c36 to 9691b00 Compare October 10, 2023 22:35
We add a `dune pkg outdated` package that will display outdated package
dependencies with respect to the condigured opam repositories.

It comes with a --transitive flag that shows all outdated transitive
deps.

Signed-off-by: Ali Caglayan <[email protected]>
@Alizter Alizter force-pushed the ps/branch/feature_pkg___dune_pkg_outdated branch from 9691b00 to 25c360e Compare October 11, 2023 11:49
@Alizter
Copy link
Collaborator Author

Alizter commented Oct 11, 2023

@rgrinberg I've removed the changes to the dune files like you suggested.

@rgrinberg rgrinberg merged commit 87d957d into ocaml:main Oct 11, 2023
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Print All Outdated Packages
3 participants