-
Notifications
You must be signed in to change notification settings - Fork 762
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
feat: asdf list
commands to sort output by version, not lexical
#1428
Comments
Any PR to resolve this should also include a test case which we expect to fail with the data from this issue, so we can guard against regressions. I think the fix for this is actually pretty simple. Mechanisms like asdf/test/banned_commands.bats Lines 35 to 45 in 27c8a10
The solution I would propose is moving asdf/lib/commands/command-update.bash Lines 46 to 49 in 27c8a10
into And then using asdf/lib/commands/command-list.bash Line 33 in 27c8a10
like so: -versions=$(list_installed_versions "$plugin_name")
+versions=$(list_installed_versions "$plugin_name" | sort_versions) I am AFK at the moment so cannot PR this myself. Whoever gets to it, the PR must include test cases for what we expect to succeed and what we expect to fail. Whatever solution we implement here, won't order the more complex versions from plugins like Java, but the current solution is just a glob pattern, so I guess this wouldn't technically be worse 🤔 Java plugin versions:
|
asdf list
commands to sort output by version, not lexicalasdf list
commands to sort output by version, not lexical
I would alternatively suggest moving away from In
The latter is ~40% faster. While these times are small, this kind of heavily piped code exists all over asdf, and they add up. Additionally, this is on a fairly zippy machine. On a much slower Debian server with spinning disks, I get this:
That is over twice as fast as before, with the first taking nearly 20 milliseconds. As far as the actual output as it relates to this question, here is a sample showing that it correctly sorts and differentiates between alpha, beta, release candidate, and final versions:
|
For the I'm not certain what we should do in this case with the |
To recap:
After mulling this over for a few days I was going to suggest a optional (mandatory? 🤔) plugin @stephanGarland I see these as our options:
My preference would be 3. |
Ah, gotcha. I'm still trying to work through the various parts of asdf and see where various functions are being called / used. I'm fine with any of options 2-4. As an aside, lest it be buried in an old issue, I made this comment, with a proposed patch (no PR). It speeds up |
I did see that post. Haven't run the patch myself yet. We're happy to receive patches for our broken tests! :D We're also happy to receive performance improvements, though, as you can see from my comment in that thread (immediately above yours), I do want to get performance testing into our CI pipeline to start capturing, tracking and publishing our perf data so it can be replicated and improved. So, happy to hear your thoughts on that in the other thread. Thanks for helping out! |
From your list @jthegedus , my preference would be 3. If we add support for that to asdf core plugins that need it could implement and start using it immediately after the next release of asdf. |
Great! A consensus on 3.
I will introduce this after I have completed #1445 plugin docs refactoring. |
Is your feature request related to a problem? Please describe
asdf list
,asdf list python
, etc output version numbers that are lexicographically sorted, e.g.:❯ asdf list python 2.7.18 3.10.0 3.10.3 3.10.6 *3.10.9 3.11.1 3.6.15 3.7.14 3.7.6 3.8.13 3.9.11
But it'd be nicer to see them version-sorted (example below)
Describe the proposed solution
Would like to see this:
❯ asdf list python 2.7.18 3.6.15 3.7.6 3.7.14 3.8.13 3.9.11 3.10.0 3.10.3 3.10.6 *3.10.9 3.11.1
Describe similar
asdf
features and why they are not sufficientn/a
Describe other workarounds you've considered
piping to
sort -V
kinda works, but the*
messes it upThe text was updated successfully, but these errors were encountered: