gnames / gnparser

GNparser normalises scientific names and extracts their semantic elements.
MIT License
40 stars 5 forks source link

Programmatically getting download links for go binaries in releases? #91

Closed dimus closed 2 years ago

dimus commented 3 years ago

created by @sckott at https://gitlab.com/gogna/gnparser/-/issues/91

Hi @dimus - Trying to write code to help R users install gnparser go binaries on each operating system. For example install https://gitlab.com/gogna/gnparser/uploads/47d90de5bdaf8c51d578bc1f74a05859/gnparser-v0.14.1-mac.tar.gz on macos. There's a few issues.

First, it seems it's not straightforward to get urls for the release files without using authentication - I don't want user to have to have Gitlab token to be able to download gnparser. I can use https://gitlab.com/gogna/gnparser/-/releases.json to get JSON of gnparser releases, but the links for each binary are in a text string unfortunately, making it fragile to get the URLs (that is, I could regex them out, but that could break easily).

Second, I can't predict the URL for the binary - see above - as it has a sha in it, which isn't an easily extractable field in the JSON payload from the url above. I wonder if there is a shorthand for each release binary for mac/linux/windows that just has the release version, without that sha in it.

dimus commented 3 years ago

created by @sckott at https://gitlab.com/gogna/gnparser/-/issues/43

Looks promising!

dimus commented 3 years ago

created by @dimus at https://gitlab.com/gogna/gnparser/-/issues/44

My bad, I was not reading carefully.

@LocoDelAssembly found this:

https://gitlab.com/api/v4/projects/gogna%2Fgnparser/releases/v0.14.1/assets/links 

Looks this should be the endpoint but returns an empty array

https://docs.gitlab.com/ee/api/releases/links.html#create-a-link

Something I probably can use to create stable links

dimus commented 3 years ago

created by @sckott at https://gitlab.com/gogna/gnparser/-/issues/45

Sorry to not be more clear. You can download files without being logged in. It's just that I think you can't use the Gitlab API without having a Gitlab account and PAT token.

I can request https://gitlab.com/gogna/gnparser/-/releases.json to get the JSON of releases, and that works as is to get the URLs to then download the binaries for each OS. It may be fragile though since I have to regex to get the URLs for each binary.

Adding a homebrew option will be a good addition

dimus commented 3 years ago

created by @dimus at https://gitlab.com/gogna/gnparser/-/issues/46

Hm, that's a major problem if GitLab does not let people without login to download files! Let me think what to do about it. I did not try to make homebrew packages so far, it is a good idea though, I'll invetsigate, probably after TDWG 2020 though. Making a separate issue about it https://gitlab.com/gogna/gnparser/-/issues/92

dimus commented 3 years ago

created by @sckott at https://gitlab.com/gogna/gnparser/-/issues/47

Follow up. I assume you do not have plans to make gnparser available on homebrew?

dimus commented 2 years ago

gnparser can be installed with homebrew now:

brew tap gnames/gn
brew install gnparser

Also see https://github.com/gnames/homebrew-gn/blob/master/Formula/gnparser.rb