4

I'm developing a package that has been released, but every week or every few weeks there are new features added to the core version.

What I'd like to do is to notify users that new features are available such as

julia> using Package
 Note: new features are available:
         - feature 1
         - feature 2
       call Pkg.update("Package") to make these features available

Is there a standard/built-in way of doing this? I'd rather not make the users have to install the Requests and LibCurl packages for this single feature.

Fengyang Wang
  • 11,901
  • 2
  • 38
  • 67
isebarn
  • 3,812
  • 5
  • 22
  • 38
  • 3
    as a user, I'd rather `watch` the package repo on github to keep tracking new features. the notification could become disturbing if it showed every time when loading a package. – Gnimuc Nov 29 '16 at 11:48
  • yes, but in my case the target audience are biologists which wont have github accounts or even know that repos can be watched, and would dismiss it as unecessary even if they knew it was possible – isebarn Nov 29 '16 at 14:39

1 Answers1

2

There is a built-in command to download a file, download. You could download the next three possible release numbers from GitHub:

for version in [v"0.4.1", v"0.5.0", v"1.0.0"]
    filename = download("https://github.com/JuliaFinance/Currencies.jl/releases/tag/v$version")
    data = readstring(filename)
    if data != """{"error":"Not Found"}"""
        println("Version v$version is available!")
        # this release was tagged on GitHub, notify user
    end
end

Probably this will only work if you tag your versions on GitHub. You should probably hide this all in a try...catch and suppress any errors, so the lack of Internet connection does not affect users' ability to use the package.

Fengyang Wang
  • 11,901
  • 2
  • 38
  • 67