Julia should ship with a shell command-line interface for Pkg's pkg> mode.
Many other modern programming languages ship with a CLI for their package manager:
- Rust ships with
cargo
- Node.js ships with
npm
- Python ships with
pip
- Go ships with
go get/mod
- Ruby ships with
gem
- Julia ships with...
julia --project=. -e 'using Pkg; Pkg. 😕
I think this creates a lot of unnecessary friction.
Current workarounds
jlpkg is one such attempt to make this, but it exists as a third-party package. This means:
- It needs to be installed separately
- It is not easily discoverable (I only found it when searching for related issues)
- It needs to configured to point at the specific Julia to use (
--julia flag)
- It's another dependency to manage
I find it easier to put the following in my bashrc instead:
jlpkg() {
julia --project=. -e "using Pkg; Pkg.REPLMode.pkgstr(\"$*\")"
}
However, I do not think users should have to write such workarounds; such a feature should just ship with Julia.
Reasoning
- Pkg.jl is already part of Julia
Pkg.jl is a standard library component, not a third-party package. It has a CLI already: pkg>. But it requires you to launch Julia to use it, which is really inconvenient when working with other command line tools like git.
- It's trivially simple
Here is an entire pure-Julia implementation of this:
import Pkg
Pkg.REPLMode.pkgstr(join(ARGS, " "))
All flags can be forwarded to the underlying standard Julia binary.
- Ecosystem consistency
When teaching Julia or onboarding developers, we have to explain why Julia uniquely lacks this tooling. I worry that it makes Julia feel less mature than it actually is.
Implementation Options
I think one of the following would be nice:
Option A: Ship a minimal script
Include a dead-simple jlpkg script with Julia, such as the following
import Pkg
Pkg.REPLMode.pkgstr(join(ARGS, " "))
That's it. No dependencies, no complexity.
Option B: Add a julia --pkg flag
Build it into julia itself: julia --pkg-{cmd} {arg}. For example, julia --pkg-add LinearAlgebra. This keeps everything integrated in one binary.
However, this is a bit less convenient, and probably overloads too much into one CLI.
Option C: Include with juliaup
Since many users install Julia via juliaup, include a jlpkg command there.
Edit: JuliaLang/juliaup#1230
Option D: Precompiled binary
Use PackageCompiler to create a fast-startup binary version.
Prior Art & Related Work
Summary
Many modern programming languages provide a CLI for package management out of the box. Julia has an excellent package manager in Pkg.jl, and actually already has a CLI for it. It just needs to expose it directly to the shell, with a separate executable. This would significantly improve the developer experience with nearly zero maintenance burden.
Julia should ship with a shell command-line interface for Pkg's
pkg>mode.Many other modern programming languages ship with a CLI for their package manager:
cargonpmpipgo get/modgemjulia --project=. -e 'using Pkg; Pkg.😕I think this creates a lot of unnecessary friction.
Current workarounds
jlpkgis one such attempt to make this, but it exists as a third-party package. This means:--juliaflag)I find it easier to put the following in my bashrc instead:
However, I do not think users should have to write such workarounds; such a feature should just ship with Julia.
Reasoning
Pkg.jl is a standard library component, not a third-party package. It has a CLI already:
pkg>. But it requires you to launch Julia to use it, which is really inconvenient when working with other command line tools like git.Here is an entire pure-Julia implementation of this:
All flags can be forwarded to the underlying standard Julia binary.
When teaching Julia or onboarding developers, we have to explain why Julia uniquely lacks this tooling. I worry that it makes Julia feel less mature than it actually is.
Implementation Options
I think one of the following would be nice:
Option A: Ship a minimal script
Include a dead-simple
jlpkgscript with Julia, such as the followingThat's it. No dependencies, no complexity.
Option B: Add a
julia --pkgflagBuild it into julia itself:
julia --pkg-{cmd} {arg}. For example,julia --pkg-add LinearAlgebra. This keeps everything integrated in one binary.However, this is a bit less convenient, and probably overloads too much into one CLI.
Option C: Include with juliaup
Since many users install Julia via juliaup, include a
jlpkgcommand there.Edit: JuliaLang/juliaup#1230
Option D: Precompiled binary
Use PackageCompiler to create a fast-startup binary version.
Prior Art & Related Work
Summary
Many modern programming languages provide a CLI for package management out of the box. Julia has an excellent package manager in Pkg.jl, and actually already has a CLI for it. It just needs to expose it directly to the shell, with a separate executable. This would significantly improve the developer experience with nearly zero maintenance burden.