Hi all!
I have been thinking, building, and experimenting standalone manager app implemented in pure Julia (well there are about 50 loc of C in PackageCompiler) in the past few months which is the IonCLI. I’d like to share my findings and start a discussion on the standalone package manager built in Julia and for Julia. And maybe draw some attention from Pkg team as well! (@StefanKarpinski) Since it won’t be possible without some more changes on Pkg side in the future and this demo is not stable enough to use for production at all.
A glance at what I have implemented as a demo
it’s a standalone application built with PackageCompiler, so you don’t need to install julia to use it
Background
By standalone package manager, I mean a package manager does not depend on the Julia compiler one uses or will use. It is an application built by PackageCompiler and can be download and use without installing a Julia compiler.
In other programming languages, this usually refers to things like rust’s cargo, nodejs’s npm.
Advantages
Although the experience of Pkg
in REPL is almost perfect, there are still quite a few advantages of having such manager apps:
Not a Stdlib - more features & fast evolve
I guess, as we all agree, code in stdlibs are half dead.
Since it is a standalone application, it won’t and can’t be a stdlib (or we have to ship it with a complete Julia compiler), this means we can use whatever already exists in the package ecosystem and just depend on them. This means you can support project creation via PkgTemplates, colorful and fast CLIs via Comonicon, and implement a lot other features in a package instead commit them into a centralized stdlib. And increase the functionality without worrying about increasing the dependencies of Julia binary.
Upgrade & Manage Julia Compiler Binaries Seamlessly
I believe lots of people have experienced this: when a new Julia compiler version comes out, you will need to uninstall the previous version manually to do the upgrade, or you will have two or multiple versions of Julia even you don’t need them. And if you are someone like me living on Julia’s master branch, switching/updating julia versions can be quite often.
Moreover, one has to dig into the .julia/env
folder to copy the old environment to the new environment. And because of firewalls, one may need to download the binary via proxies, from a mirror, etc. This might be fine for power users of Julia, since we know a lot of details of how things work, but it is cumbersome for most people, which is why there have been efforts like jill.py, jill, etc.
This feature would be hard to implement within Pkg
since Pkg
is shipped with the Julia compiler. It can be hard to delete and modify yourself. But it is very simple to implement using Julia as a standalone application.
Beautiful CLI and GUI
As a standalone application, we can easily provide a nice CLI and GUI - this would make the ecosystem more accessible to all levels of users. I don’t have a demo for GUIs (but hopefully some point in the future)
Ideally, like rust’s cargo, it can be a small binary that does not depend on the compiler at all, but I find the size of the current build is only about 70~90MB, which is still acceptable I believe.
Closely optimized workflow for CLI/GUI based programming
Julia has an excellent REPL experience already, but due to various reasons (largely about latencies, but also because of the lack of tooling), I have to say the experience of CLIs was not great. But I think with the progress of various packages, now it’s time to make this great and smooth.
As I demonstrate above, with a CLI one can simplify the workflow in the terminal a lot, without opening REPL at all, given in a lot of cases, one just wants to do very simple things, like manage packages, or create a package, or search a package, etc. It’s more convenient to have an entry for this type of task directly from the terminal or potentially a GUI.
Moreover, as a lot of programmers with other programming language experience using CLIs, I think this workflow would much more familiar to a larger population of programmers (since CLIs are what people have been using since the born of Unix), I believe this would help in closing the gap for beginners.
The ability to manage other Binaries with BB and JLLs
As @vchuravy pointed out on Twitter, we can actually manage other binaries like git
, fpmpeg
via JLLs directly, so this could potentially be something more powerful and a replacement of things like brew
with better cross compilation ability through BinaryBuilder
.
Looking Forward
I think 1 year ago, it’s not imaginable to have such a CLI application implemented in pure Julia. But as the compiler keeps progressing (and hopefully someday when the static compilation pipeline becomes mature, so we can have much smaller size of binary) I think the community can already think about this and target this.