pkg: implement a package search command#12547
Conversation
|
I've made some initial comments. Some more points
Things to test for:
Since there might be a few, probably best to make a subdirectory in
|
Thanks for your quick initial review! It is helpful to validate that the general approach here isn't completely off-track, etc.
I'm aware, thanks! My preference is to do it just before marking the PR as ready for merge as a signal that I'm happy with what is here to be merged (if and when it is). But, I can make sure all commits are signed, if that's preferred, generally.
Sure, I'll add cram tests. Thanks for the pointer to the docs!
Makes sense. 👍
Understood. |
933a31a to
ba9552f
Compare
|
I have added some cram tests, and addressed some of your initial comments, @Alizter . I, for one, know that the output produced could use some improvement to make it more readable. But, would you mind taking another look to see if there are other things that need work? Thanks! |
ba9552f to
32d13aa
Compare
|
Regarding the style in the cram tests. We generally like comments to be wrapped at 80 and you don't need to start comments with |
3047aae to
26f0064
Compare
test/blackbox-tests/test-cases/pkg/search/multiple-repos-conflicting-packages.t
Outdated
Show resolved
Hide resolved
rgrinberg
left a comment
There was a problem hiding this comment.
You're on the right track. Thanks for doing this work. I've left some pointers. One last bit of general advice:
Try to keep the implementation of the search itself self contained in bin/pkg and only extend opam_repo as little as possible to provide the apis needed for search.
15c12bd to
c277143
Compare
65cc64c to
61e63a4
Compare
Thanks for taking a look and the quick confirmation that I'm on the right track! I appreciate it.
This makes sense! I've refactored the code taking this piece of advice into account. |
|
Perl style regular expressions adds a lot of extra stuff that probably won't be needed. I think using However if you think Perl style regular expressions would be useful for package search, I would be open to it. I couldn't come up with a use case myself. |
Yes, I'm happy to switch over! I'll update the PR soon. |
@Alizter I'm a little confused about the suggestion here. My understanding is that
|
61e63a4 to
ddf4d27
Compare
|
@punchagan Yes, directly using You can also mention the section from the manual on |
098d05e to
0cbbdad
Compare
Thanks! I've implemented search using dune-glob's functionality. I didn't do the suggested refactor to There's a quirk of using the glob search, though, that may trip up some users. |
0cbbdad to
aed9fee
Compare
192aece to
c163f59
Compare
I pushed a couple of separate commits that implement the search using Also, sharing some "paraphrased" notes from the discussion we had outside GitHub, for the sake of completeness, here:
An additional question: Based on previous input from @Leonidas-from-XIV , I made the |
This makes sense to me on the face of it. Comparing with So it is "morally" returning everything, but practically limiting the results. But this is because they have have roughly 200k more packages that opam does. IMO, listing all 4k packages from |
c163f59 to
5e3c2dc
Compare
Makes sense to me! I pushed a commit that implements this basic sub-string search, making the
|
5e3c2dc to
bad1cda
Compare
Leonidas-from-XIV
left a comment
There was a problem hiding this comment.
Suggesting some possible improvements to the source as I was reading through it.
e0f4f22 to
ab2bd0c
Compare
I think I've addressed all the suggestions for improvement. Thank you!
Created #12586 to track this, since the issue is a bigger one and not limited to the scope of this PR.
I've tweaked the sorting to incorporate this, and added a cram test that demonstrates this (in |
|
Let me know when you are finished tweaking stuff and I can merge. |
Signed-off-by: Puneeth Chaganti <punchagan@muse-amuse.in>
ab2bd0c to
0217fb2
Compare
I've tweaked the imports, and I think I'm done with addressing all other review comments too. |
This PR adds an initial version of
dune pkg search <query>in an attempt to address #12106.Adds a command
dune pkg search >query>.<query>is a required parameter which can be a Perl regular expression that is used to search package names.The command only works in a dune workspace, since it would require
repositories to be configured to perform the search.
Currently, search looks through valid package directory names in a repository and lists the maximum version that has not been marked as
avoid-versionalong with the synopsis.Currently, we only search in the repositories configured in the lock dir for the default context.
NOTE: I'm new to the
dunecodebase and this is my first "significant" code contribution. Please do point me to things to read and learn about, if there are things that can help with building missing conceptual understanding, etc.