Several questions that arise during learning package development

I’m trying to understand the organization mechanism of Julia packages and seeking for a good workflow that is suitable for me for package development. My expected learning roadmap is to firstly create a minimal package from scratch locally and invoke it from another project, and after that learn how to upload it to GitHub and register it and so on.

Up to now, I have just created a package named MyPackage using command generate under Julia’s package mode and the folder MyPackage has appeared in my working directory named myPkgDev.

Now, I’d like to ask the following several questions:

  1. I’ve learnt there are several ways to invoke this package such as activate, dev or add it, but what are the differences between them?
  2. It seems that to add a local package I need to make it a git repository first, so I executed cd MyPackage, git init, git add . and git commit -a -m "Initial package structure." in sequence and executed add ./MyPackage under Julia package mode in the original working directory. No surprise, it worked, but my question here is, why is the add-ing package process so slow? (I can understand the slow process of adding a registered package from the network, but why is adding the smallest local package so slow? What exactly happened in the process?) And why are there 11 dependencies for a package that only has Hello World!?
(@v1.9) pkg> add ./MyPackage
     Cloning git-repo `D:\myPkgDev\MyPackage`
    Updating git-repo `D:\myPkgDev\MyPackage`
    Updating registry at `C:\Users\Name\.julia\registries\General.toml`
   Resolving package versions...
    Updating `C:\Users\Name\.julia\environments\v1.9\Project.toml`
  [2fed5cd1] + MyPackage v0.1.0 `D:\myPkgDev\MyPackage#main`
    Updating `C:\Users\Name\.julia\environments\v1.9\Manifest.toml`        
  [2fed5cd1] + MyPackage v0.1.0 `D:\myPkgDev\MyPackage#main`
Precompiling project...
  ✓ MyPackage
  11 dependencies successfully precompiled in 159 seconds. 229 already precompiled.
  1 dependency precompiled but a different version is currently loaded. Restart julia to access the new version
  1. It would be nice if you could recommend some complete tutorials or good workflows for Julia package development.

Thanks! :pray:

One way to start developing a new package is to use JuliaCI/PkgTemplates.jl.

I don’t know why adding a local packge was slow in your case…

To the other questions:

  1. First of all, activate is quite different from add and dev.
  • activate just enters a new or existing project environment and allows you to resolve dependencies for different projects independently.
  • add will add a new dependency to the currently activated project. However, it kind of assumes that you are not changing the code of the added package.
  • dev is like add, but with the extra that it will put the added package into a nice location (if not already a local path) and it accepts changes. You could dev a package from other people and make local changes to it.
  1. With package templates you can shorten this process by just doing:
using PkgTemplates

It takes time at the first run, but it is worth it.

  1. Maybe this video and tutorial is helpful: How to develop a Julia package (

A few links for reading are of course 3. Managing Packages · Pkg.jl (
and I also like this source: Writing your code (


Thank you for your generous answer! And happy anniversary of joining the community! :handshake::handshake:

1 Like

Yet another tutorial on package development, that include documentation, testing, registration…

1 Like

My favorite resource on the topic: - Pkg.jl and Julia Environments for Beginners

(Also, some follow-up discussion in this post.)

1 Like

Thank you all for the learning resources, they are really very useful! In particular this one: - Pkg.jl and Julia Environments for Beginners , I have to say, is right up my alley at the moment. :+1: :+1:

1 Like

I saw that none of the above links mention LocalRegistry, I find this to be a very useful stepping stone between having a local package and registration in the General registry. It is also nice if you have code that is not suitable for the General registry (either because it is confidential, experimental or too specialised).


Good stuff! I’ll look into it later! Thank you! :handshake: :handshake:

1 Like