LocalRegistry doesn't automatically pull

I’ve been using LocalRegistry to manage a personal registry in a remote git hosting website.

It allows me to do what I wanted, versioning my own packages and have Pkg do its dependency resolution job. But there’s a slight annoyance that I wanted to ask about.

My registry is called Registry. In my case, for whatever reason, I need to manually cd to ~/.julia/registry/Registry and then call git pull after every package version that I register. I understand the reason for this - julia is looking at the local copy of the Registry repo to figure which version it knows about. However, for the default General registry julia decides when it needs to download it. I would rather have my own registry work the same way, because the way it is now adds the extra git pull step which I believe could be happening automatically.

Is this a matter of configuring LocalRegistry, or julia, or something else?

Have you tried just doing

using Pkg
pkg"registry up"

instead of the manual pull?

1 Like

Cf. Pull-first · Issue #63 · GunnarFarneback/LocalRegistry.jl · GitHub

Possible reasons not to pull automatically are that (…)

Hey Gunnar thanks for coming back. I’m still confused. Are you saying that even the General registry is some times not pulled automatically? Even if that’s the case and the General is some times not pulled automatically, it some times is. My own local registry on the other hand, as far as I can tell is never pulled automatically. So they behave differently, no? What is the source of this difference? Is it that Pkg knows that General is somehow special and some times decides to pull, whereas it never pulls other registries automatically?

I would call that also a manual pull. According to Gunnar’s link, the two are equivalent. I say manual in contrast to General, where I never have to do either git pull or registry up.

I understand. The reason that I wrote that post was to illustrate that there is a simple way to do this from the Julia REPL, as in my opinion, forcing users to explicitly change things in the .julia directory would be bad design (except for custom configuration like startup.jl).

It’s the same for General and other registries, either none is updated automatically or all registries are. What might fool you is that Pkg only does an automatic update once per session, so if you want to refresh the registry information more than once in a session, you must do an explicit update.

Illustration of both registries being updated:

$ mkdir /tmp/testdepot
$ mkdir /tmp/testregistry/
$ git -C /tmp/testregistry/ init --bare
Initialized empty Git repository in /tmp/testregistry/
$ JULIA_DEPOT_PATH=/tmp/testdepot julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.9 (2025-03-10)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(@v1.10) pkg> add LocalRegistry
  Installing known registries into `/tmp/testdepot`
       Added `General` registry to /tmp/testdepot/registries
    Updating registry at `/tmp/testdepot/registries/General.toml`
   Resolving package versions...
[...]

julia> using LocalRegistry

julia> create_registry("testregistry", "file:///tmp/testregistry", push = true)
[...]
[ Info: Created registry in directory /tmp/testdepot/registries/testregistry
"/tmp/testdepot/registries/testregistry"

julia> exit()
$ JULIA_DEPOT_PATH=/tmp/testdepot julia
[...]

(@v1.10) pkg> add Example
    Updating registry at `/tmp/testdepot/registries/testregistry`
    Updating git-repo `file:///tmp/testregistry`
    Updating registry at `/tmp/testdepot/registries/General.toml`
   Resolving package versions...
   Installed Example ─ v0.5.5
    Updating `/tmp/testdepot/environments/v1.10/Project.toml`
  [7876af07] + Example v0.5.5
    Updating `/tmp/testdepot/environments/v1.10/Manifest.toml`
  [7876af07] + Example v0.5.5
Precompiling packages finished.
  1 dependency successfully precompiled in 1 seconds. 4 already precompiled.
5 Likes

Ok confirmed.

I’ve confirmed it by bumping some package and registering it on the Julia session that I use for registering, then on my Julia where I don’t have the package dev’ed I restarted Julia, then ran up (note, not registry up), and that brought the new version.

This is the info I was looking for, thank you.