# Writing a python command line app with a julia package underneath

**URL:** <https://discourse.julialang.org/t/writing-a-python-command-line-app-with-a-julia-package-underneath/66984>\
**Category:** General Usage\
**Tags:** python\
**Created:** [August 25, 2021, 3:04pm UTC](https://discourse.julialang.org/t/writing-a-python-command-line-app-with-a-julia-package-underneath/66984 "2021-08-25T15:04:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![00krishna](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00krishna/32/8843_2.png) [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Post date:** [August 25, 2021, 3:04pm UTC](https://discourse.julialang.org/t/writing-a-python-command-line-app-with-a-julia-package-underneath/66984/1 "2021-08-25T15:04:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [August 25, 2021, 3:08pm UTC](https://discourse.julialang.org/t/writing-a-python-command-line-app-with-a-julia-package-underneath/66984/2 "2021-08-25T15:08:27Z")

</div>

> **[GitHub - JuliaPy/pyjulia: python interface to julia](https://github.com/JuliaPy/pyjulia)**
>
> python interface to julia. Contribute to JuliaPy/pyjulia development by creating an account on GitHub.

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

> [@00krishna](#):
>
> python CLI frameworks are more mature than the present julia CLI frameworks

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

---

<div class="post-metadata">

**Author:** ![00krishna](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00krishna/32/8843_2.png) [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Post date:** [August 25, 2021, 3:21pm UTC](https://discourse.julialang.org/t/writing-a-python-command-line-app-with-a-julia-package-underneath/66984/3 "2021-08-25T15:21:01Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [August 25, 2021, 3:31pm UTC](https://discourse.julialang.org/t/writing-a-python-command-line-app-with-a-julia-package-underneath/66984/4 "2021-08-25T15:31:45Z")

</div>

> [@00krishna](#):
>
> So I was wondering if there was a way to do this without installing the entire julia language?

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.

---

<div class="post-metadata">

**Author:** ![SteffenPL](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steffenpl/32/206270_2.png) [@SteffenPL](https://discourse.julialang.org/u/SteffenPL)\
**Post date:** [August 25, 2021, 3:34pm UTC](https://discourse.julialang.org/t/writing-a-python-command-line-app-with-a-julia-package-underneath/66984/5 "2021-08-25T15:34:30Z")

</div>

> [@00krishna](#):
>
> 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.

You could try to use [GitHub - JuliaPackaging/BinaryBuilder.jl: Binary Dependency Builder for Julia](https://github.com/JuliaPackaging/BinaryBuilder.jl) 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.)

---

<div class="post-metadata">

**Author:** ![Libbum](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/libbum/32/3935_2.png) [@Libbum](https://discourse.julialang.org/u/Libbum)\
**Post date:** [August 25, 2021, 3:54pm UTC](https://discourse.julialang.org/t/writing-a-python-command-line-app-with-a-julia-package-underneath/66984/6 "2021-08-25T15:54:54Z")

</div>

[ArgParse](https://github.com/carlobaldassi/ArgParse.jl) has commands _et al_.
