# How to manage versions in my package?

**URL:** https://discourse.julialang.org/t/how-to-manage-versions-in-my-package/80713
**Category:** General Usage
**Tags:** question, package
**Created:** [May 8, 2022, 3:49pm UTC](https://discourse.julialang.org/t/how-to-manage-versions-in-my-package/80713 "2022-05-08T15:49:58Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![roi.holtzman](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)
#### Post date: [May 8, 2022, 3:49pm UTC](https://discourse.julialang.org/t/how-to-manage-versions-in-my-package/80713/1 "2022-05-08T15:49:58Z")

</div>

I am writing my own package, and I want to implement versions.  
I am using this package in my projects, and I want to make sure that old projects can use an old version of the package while new projects can use the new version. Is there a way to properly maintain versions?

---

<div class="post-metadata">

### Author: ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)
#### Post date: [May 8, 2022, 4:14pm UTC](https://discourse.julialang.org/t/how-to-manage-versions-in-my-package/80713/2 "2022-05-08T16:14:18Z")

</div>

Sure! Julia’s package versioning system is great for that. If you maintain the package as a git repository, each commit is a potential different version, which users can choose at their will for each project:  
[https://pkgdocs.julialang.org/v1/managing-packages/](https://pkgdocs.julialang.org/v1/managing-packages/)

The “proper way” of maintaining versions, however, also involves registering your package (you can use the [General registry](https://github.com/JuliaRegistries/General), or even make your own [local registry](https://github.com/GunnarFarneback/LocalRegistry.jl)), so that you can tell the package manager what version you want to add using version numbers, instead of ugly git commit IDs.

Each new version that you register, takes its number from the `Project.toml` file:  
[https://pkgdocs.julialang.org/v1/toml-files/](https://pkgdocs.julialang.org/v1/toml-files/)

---

<div class="post-metadata">

### Author: ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)
#### Post date: [May 8, 2022, 7:40pm UTC](https://discourse.julialang.org/t/how-to-manage-versions-in-my-package/80713/3 "2022-05-08T19:40:46Z")

</div>

> [@heliosdrm](#):
>
> The “proper way” of maintaining versions, however, also involves registering your package (you can use the [General registry](https://github.com/JuliaRegistries/General), or even make your own [local registry](https://github.com/GunnarFarneback/LocalRegistry.jl)), so that you can tell the package manager what version you want to add using version numbers, instead of ugly git commit IDs.

It is not necessary to register a package. Versions are available by referring to tags  
of unregistered packages. One can do `]add https:...PackageName.git#v1.5.1` using tags. Here `v1.5.1`.

---

<div class="post-metadata">

### Author: ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)
#### Post date: [May 8, 2022, 8:00pm UTC](https://discourse.julialang.org/t/how-to-manage-versions-in-my-package/80713/4 "2022-05-08T20:00:54Z")

</div>

Oh yes, you’re right!

Just for clarity, then I think it’s advisable to distinguish between “registered versions” (those that you can add as `]add PackageName@1.5.1` and “tagged versions” (`]add PackagePath#v1.5.1`). Julia’s [TagBot](https://github.com/JuliaRegistries/TagBot) helps to keep both kinds of versions sync’ed in registered packages, but same numbers of those two kinds of versions might refer to different commits!

---

<div class="post-metadata">

### Author: ![roi.holtzman](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)
#### Post date: [May 9, 2022, 12:06pm UTC](https://discourse.julialang.org/t/how-to-manage-versions-in-my-package/80713/5 "2022-05-09T12:06:37Z")

</div>

@PetrKryslUCSD @heliosdrm Thank you very much for the useful answers.  
At the moment I am still in the phase of developing the package, so I am using `dev Package` when I use it in my projects since I am changing things all the time.  
So it seems to me like versioning should work only with `add Package`, which means it is not suited for my case really. Perhaps I am not in the phase of versioning yet.

---

<div class="post-metadata">

### Author: ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)
#### Post date: [May 9, 2022, 12:42pm UTC](https://discourse.julialang.org/t/how-to-manage-versions-in-my-package/80713/6 "2022-05-09T12:42:39Z")

</div>

Yes, when the package is installed in an environment as `dev`, no fixed version is used: `using Package` just looks into the local version of the code – including changes you make to it.

Nevertheless, you can have a package in perpetual `dev` state, and yet (if you are using git for version control) register or tag particular commits, so that in some projects with their own environment, you `add` those fixed versions in a reproducible way, as indicated. That’s possible even on the same computer.
