Writing a python command line app with a julia package underneath

This might be a good question for @tim.holy . So I had written a package in python to process some geospatial images–raster files. The package had a nice CLI and everything. The problem was, the python geospatial libraries are a really big mess when it comes to cross-platform installation, etc. Because the python geospatial libraries are wrappers for C and C++ libraries (GDAL, OGR, etc.) in the background, I could not write a package in python that would run on Linux, Mac, and Windows; the compilation of the C and C++ libraries was too fragile. Perhaps there are ways to do it, but I could not figure them out.

I thought about using Julia as the guts of the package instead of the python geospatial. It seems like the Julia geospatial packages are better able to compile on different platforms–even though the julia package also rely on the same C and C++ libraries as python.

BUT, the limitation is that no so many of the users that I am targeting know julia, and the python CLI frameworks are more mature than the present julia CLI frameworks. For example the Click CLI in python support grouping commands into subgroups for a nice interface–but I could not find something similar in the current julia CLI frameworks. So I was wondering how to wrap a julia library in a python package? I was hoping to avoid having to install a full julia implementation on the user’s machine, but it could be okay if that is required? And finally, then would I use pip as the package manager, or conda or is one better than the other for a mixed julia/python package. My original package was written using conda which was better for geospatial stuff–but still ultimately would not compile across platforms.

If anyone has a suggestion or comment, all are welcome.

btw, why do you care if it’s python if it’s a CLI tool?

I guess this doesn’t make much sense to me personally

@jling Thanks for commenting. Yep, I have used pyjulia before, but in that case I had to install the entire julia language as well as python. So I was wondering if there was a way to do this without installing the entire julia language? I might have not made that clear in the original post.

In terms of the CLI frameworks. I was using the Click CLI in python which is nice because you can create commands and command subgroups. I could not find anything like that in the julia CLI packages yet.

Not really, Julia is not Rust/Go/C, it’s non-trivial already to make binary applications (with PackageCompiler.jl), not to mention to make a julia .so shared library kinda of thing for Python.

You could try to use GitHub - JuliaPackaging/BinaryBuilder.jl: Binary Dependency Builder for Julia directly to get the binaries for the platforms you need. (That is what is most likely used by the Julia packages to get their binaries.)
I remember that in one talk the authors mentioned that BinaryBuilder might be useful also for applications outside of Julia… (If you get the binaries this way, you could avoid having Julia as an extra dependency.)

1 Like

ArgParse has commands et al.