-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
sorting packages #312
Comments
I found this to be a minor issue with Further improvements are certainly possible (perhaps Poetry could somehow leverage the search result rankings returned by https://pypi.org/), but just placing exact matches at the top would be a nice improvement by itself. |
Not at the top - at the bottom (like https://github.com/Jguer/yay is doing) so we don't have to scroll for best matches but see them instantly where the cursor is (on the bottom that is). |
I agree that it is a usability issue. The idea of putting the more relevant packages at the bottom seems a good improvement to start with. |
I'd sort dependencies alphabetically even in pyproject.toml, I find that helps with merging branches if they both have new entries added |
I took a crack at trying to fix this to learn a bit more about Poetry's guts and contribute to a tool that's made my work a bit easier. I think I may have discovered another issue that relates to specifying packages interactively, and is potentially solved by sorting. When I go through a
So, I think @nchammas 's suggestion above about using the search result ordering from PyPi potentially solves this problem. For reference, I'm using the latest version of master https://github.com/sdispater/poetry/tree/f4803e91bca440e6f4af6ad54e396d01c024a76f. I'm happy to try and throw a fix together assuming it's not already in the works. |
I also believe that alphabetical storage is the best choice as it is done by npm
It deletes the entry of some package from pyproject.toml and adds it in the end. I would expect the pyproject to stay the same |
Until this gets implemented, I've been using the
The downside is that it sorts the entire file and not just the dependencies, but that was an acceptable trade-off for me. You should also be careful because it seems to remove comments if they're on a new line by themselves. |
Since Poetry 1.2 introduces the plugin system, this kind of job can be delegated to plugins. That's what I did https://pypi.org/project/poetry-plugin-sort/ sorts dependencies every time after running poetry self add poetry-plugin-sort Note that it's a beta. Please, let me know how it works if someone will try it |
You didn't link your repository so I did it for you: https://github.com/andrei-shabanski/poetry-plugin-sort. Also your PyPI link didn't work for me: https://pypi.org/project/poetry-plugin-sort/. I look forward to checking it out. |
@tkossak Does Andrei's plug-in solves the problem? Can the issue be closed? |
I don't know if it solves the problem, because I stopped using interactive package searching/additions in poetry. Nowadays I just |
poetry has shown only 10 results for some years now - 2e579c7 - this should probably be closed |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Issue
When I use 'poetry init' and get to the step for searching packages, it looks like huge mess: https://imgur.com/a/WA9CcnJ
Maybe we can get this list sorted alphabetically? Or/except maybe display packages that are most likely what I look for (because the name is exactly what i typed) on the bottom, so I don't have to scroll the list in search for its number.
The text was updated successfully, but these errors were encountered: