Using JuliaSim Packages Locally via the JuliaHub Registry
To use JuliaSim packages on your local machine, you will need to add JuliaHub as a registry on your computer. To do this, you need to download an authentication token from the platform.
Adding the JuliaHub registry
Start a Julia session and install the PkgAuthentication
package. This package can be used for both initial setup and to stay connected to the registry.
julia> using Pkg
julia> original_active_project = Base.active_project()
julia> try
withenv("JULIA_PKG_SERVER" => nothing) do
Pkg.activate("v$(VERSION.major).$(VERSION.minor)"; shared = true)
Pkg.add("PkgAuthentication")
end
finally
Pkg.activate(original_active_project)
end
Next, configure Julia to be aware of http://juliahub.com's package server:
julia> using PkgAuthentication
julia> PkgAuthentication.install("juliahub.com")
Then add all known registries on https://juliahub.com, including the JuliaHub registry, from the "Pkg REPL" (by pressing ]
from the Julia REPL), using
julia> Pkg.Registry.add()
The command above will only work on Julia v1.8 and later. On versions prior to v1.8 use the pkg>
REPL command registry add
instead.
This will open up a new browser window or tab and ask you to sign in to https://juliahub.com or to confirm authenticating as an already logged in user.
Once logged in, the browser tab can be closed. Julia will be authenticated with the package server at https://juliahub.com and download all available registries.
This will also change the package server to https://juliahub.com for all Julia sessions that run startup.jl
.
Staying connected to the JuliaHub registry
The authentication token will expire after a while, so it is convenient to enable an automatic mechanism for renewal. This can be achieved using the previously installed PkgAuthentication
package, by adding the following snippet to your local <home directory>/.julia/config/startup.jl
file.
Base.eval(Module(), quote
using PkgAuthentication
PkgAuthentication.install("juliahub.com")
end)
This will ensure that whenever a Pkg
operation is performed that an up-to-date authentication token is available either silently or through another browser interaction.
Supported Packages
The following JuliaSim packages currently support usage through the JuliaHub registry:
- JuliaSimCompiler
- JuliaSimModelOptimizer
- JuliaSimControl
See the relevant package's documentation for more details.
JuliaSim is a proprietary software developed by JuliaHub Inc. Using the packages through the registry requires a valid JuliaSim license. It is free to use for non-commercial academic teaching and research purposes. For commercial users, license fees apply. Please refer to the End User License Agreement for details. Please contact sales@juliahub.com for purchasing information.