# Displaying an update message

**URL:** <https://discourse.julialang.org/t/displaying-an-update-message/12577>\
**Category:** Community\
**Tags:** package\
**Created:** [July 22, 2018, 9:14am UTC](https://discourse.julialang.org/t/displaying-an-update-message/12577 "2018-07-22T09:14:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [July 22, 2018, 9:14am UTC](https://discourse.julialang.org/t/displaying-an-update-message/12577/1 "2018-07-22T09:14:49Z")

</div>

Hello everyone.

In a previous post about [including a changelog](https://discourse.julialang.org/t/please-consider-putting-up-a-changelog-file-after-moving-to-0-7/12454) in your repo, me and many others tried to argue how good it is for your users to have a changelog available to them.

This post is about yet another improvement of user experience: displaying a small message when updating a major version.

By “definition”, updating a major number almost certainly comes with very big changes. However, it is not always the case that a user will check every updated version one by one. What you can do instead, is display an update message when the user is `using YourPackage` for the first time. This message will be displayed only once, and now I will show you how to do it.

1. In your gitignore add `update*`.
2. At the end of `YourPackage.jl` file, add a section like:

```julia
if !isfile(joinpath(@ __DIR__ , "update_v2.0.0"))
printstyled(stdout,
"""
\nUpdate message: DynamicalBilliards v2.0

This is the update message of my package.\n
"""; color = :light_magenta)
touch(joinpath(@ __DIR__ , "update_v2.0.0"))
end

```

1. At major updates, or noteworthy minor updates, change the `"update_v..."` and the update text appropriately.

This approach does not depend on any “building” or “precompilation” process. It happens at `using`.

I suggest the following conventions for update messages:

1. Start the update string with `\nUpdate message: YourPackage version`.
2. Use the color `:ligh_magenta`: I think it is one of the least used at the moment, which would allow it to be established as “the update color standard”. I think it can be debated whether we want _all_ the update string to be in magenta, or only the header (“update message…”). I don’t really know, go ahead and express your opinions!
3. Add `\n` after your update message.

And that’s it. I hope this will be helpful for people like me that always wanted to display update messages in crucial releases!

This is how it looks when I first use my package:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/f/afedb8c9bef697e41232f7ff98e24d5994fe9ea5.png)

This is how it looks the second time:

![image](https://global.discourse-cdn.com/julialang/original/3X/e/d/ede72e59efdc8e51991f5da03403d3d409aabc58.png)

---

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [July 22, 2018, 9:20am UTC](https://discourse.julialang.org/t/displaying-an-update-message/12577/2 "2018-07-22T09:20:08Z")

</div>

I haven’t tested yet what happens when one publishes a new release, e.g. `2.1` without changing the source of `YourPackage.jl` . I am not sure whether the existing touched file gets deleted on update or not…

But in any case, the good thing with this approach is that you can disable it on demand by commenting out the code upon new release tags.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [July 22, 2018, 9:45am UTC](https://discourse.julialang.org/t/displaying-an-update-message/12577/3 "2018-07-22T09:45:00Z")

</div>

Perhaps I missed something, but in Pkg3, AFAIK every new version will be in a different directory.

---

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [July 22, 2018, 9:59am UTC](https://discourse.julialang.org/t/displaying-an-update-message/12577/4 "2018-07-22T09:59:52Z")

</div>

You are correct: `DiffEqBase` have been updated many times since I added it and in my `\.julia\packages\DiffEqBase` there are multiple folders. Well, at least the developer of `YourPackage` chooses when should this update message stop showing.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [July 22, 2018, 12:22pm UTC](https://discourse.julialang.org/t/displaying-an-update-message/12577/5 "2018-07-22T12:22:18Z")

</div>

It is also good to add the file `"update_v2.0.0"` to `.gitignore` (e.g. `/src/update_v*` or something), otherwise this will make the repo dirty.

---

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [July 22, 2018, 12:31pm UTC](https://discourse.julialang.org/t/displaying-an-update-message/12577/6 "2018-07-22T12:31:43Z")

</div>

> [@Datseris](#):
>
> In your gitignore add `update*` .

Yeah this is what my “step 1” does.

---

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [April 28, 2021, 8:50pm UTC](https://discourse.julialang.org/t/displaying-an-update-message/12577/7 "2021-04-28T20:50:40Z")

</div>

For anyone reading this, don’t follow the above approach, and instead see [Use Scratch.jl for update messages · Issue #246 · JuliaDynamics/DrWatson.jl · GitHub](https://github.com/JuliaDynamics/DrWatson.jl/issues/246)
