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

Can't get the latest version of miniconda3 #648

Closed
goulartdev opened this issue Feb 1, 2020 · 10 comments
Closed

Can't get the latest version of miniconda3 #648

goulartdev opened this issue Feb 1, 2020 · 10 comments
Labels

Comments

@goulartdev
Copy link

Steps to reproduce

asdf latest python miniconda3

Expected behavior

Should return the latest version of miniconda 3

Actual behavior

It returns nothing

Environment

OS: WSL/Ubuntu

asdf version: 0.7.6

The problem is with this regex, in asdf/lib/commands/command-latest:

grep -vE "(^Available versions:|-src|-dev|-latest|-stm|[-\\.]rc|-alpha|-beta|[-\\.]pre|-next|(a|b|c)[0-9]+|snapshot|master)"

The pattern (a|b|c)[0-9]+ will remove all anaconda2, anaconda3, miniconda2 and miniconda3 from the result. This could be a solution:

(a|b|c)(?<!conda)[0-9]+

Or, since this could happen with other plugins, maybe a more general solution would be better:

-(a|b|c)[0-9]+

But I don't know which plugins uses this (a|b|c)[0-9]+ pattern, so changing this could break another plugin. Perhaps it should be possible for a plugin to overwrite this regex or the entire command, so this can be handled individually.

@Stratus3D
Copy link
Member

Stratus3D commented Feb 3, 2020

The command looks for all versions that start with the exact prefix (https://asdf-vm.com/#/core-manage-versions?id=show-latest-stable-version). The command you want is asdf latest python miniconda-3. The dash is not ignored, and the only version of miniconda 3 is miniconda-3.18.3. If you don't care about the miniconda version just asdf latest python miniconda should give you all available miniconda versions.

@goulartdev
Copy link
Author

goulartdev commented Feb 3, 2020

Hey Trevor, thank you for answering. This can be a little confusing, but there is two versions os miniconda. Miniconda/miniconda2 are based on python 2 (in some point, miniconda was renamed to miniconda2), and miniconda3 is based on python 3. So:

  • asdf latest python miniconda2 should return miniconda2-4.3.30
  • asdf latest python miniconda3 should return miniconda3-4.3.30

But both return nothing because of that pattern in te regex. Typing just asdf latest python miniconda will return miniconda-3.18.3, that is an old version of miniconda2, released in 2015. Sorry if that wasn't clear.

@Stratus3D
Copy link
Member

@DjouGoulart oh I see. I misunderstood. miniconda-3.18.3 isn't a miniconda3 version at all. What happens when you run asdf list-all python? Do you see miniconda3 versions that you would expect? If not, this sounds like an issue for the Python plugin itself - https://github.com/danhper/asdf-python

@goulartdev
Copy link
Author

Yes, it shows all versions as expected.

@goulartdev
Copy link
Author

You can see the regex matches here: https://regexr.com/4th57

@Stratus3D Stratus3D reopened this Feb 3, 2020
@Stratus3D Stratus3D added the bug label Feb 3, 2020
@Stratus3D
Copy link
Member

Sorry, I didn't read your original issue closely. Definitely a bug. Thanks for reporting! I haven't talked to anyone else about this yet, but I'm actually not a big fan of this latest feature in general, at least not with the way it is currently implemented.

I think there are going to be so many edge cases that implementing this in asdf itself is going to be a pain. You've already found one issue with our implementation, and there are probably other bugs and other limitations because we have to have a generic feature that works with all plugins. I actually think it might be better to delegate this logic out to the plugins themselves, that way each plugin can just handle its own versions.

@Stratus3D
Copy link
Member

So I think the changes made in #575 merit a significant refactoring at the very least.

@goulartdev
Copy link
Author

No problem, I should have been clearer. I agree with you, delegate this will not be the easiest, but will be a better solution.

@goulartdev
Copy link
Author

@Stratus3D I refactored this command to delegate the logic to the plugins, but the tests are failing (even when I run them without making any changes), so I made some tests manually and it seems to be working well. Should I create a pull request?

@Stratus3D
Copy link
Member

@goulartdev sorry for the late response here. It looks like @threkk implemented this for us! Changes have been merged so if you use the latest master the option for the plugin to implement the latest-version selection logic is now available. The new callback is named latest-stable.

At some point soon we should be tagging a new release, so you don't want to use the latest master (which could have unknown bugs or breaking changes) you will want to wait until the next tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants