# Python packages and CI

**URL:** <https://discourse.julialang.org/t/python-packages-and-ci/52903>\
**Category:** Tooling\
**Tags:** github, python, ci\
**Created:** [January 5, 2021, 9:06pm UTC](https://discourse.julialang.org/t/python-packages-and-ci/52903 "2021-01-05T21:06:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcobonici](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marcobonici/32/20549_2.png) [@marcobonici](https://discourse.julialang.org/u/marcobonici)\
**Post date:** [January 5, 2021, 9:06pm UTC](https://discourse.julialang.org/t/python-packages-and-ci/52903/1 "2021-01-05T21:06:10Z")

</div>

Hi to everybody! I am a new Julia user, I just started to use Julia a week ago. As a first project, I’d like to translate one of my Python projects, hopefully finding better performances.

Following some tutorials, I started a project on GitHub, setting GutHub actions to make docs and set the continuos integration. When I needed a Python package I used `Conda` and `PyCall` to install and use `numpy`, so that I could use it during unit tests. Now I need to add another package, `classy`. I tried the same procedure but it didn’t work since `classy` cannot be installed with `Conda` (but can be install using pip).

Now, I need to use `classy` for my project and I want a unit tests suite for my project. Which are your suggestions? Using a custom docker-image where these packages have already been installed, removing the necessity of using Conda? In my Python project (which is in a private repo) I use a custom docker image for the tests, but I am afraid I do not know how to change the ci.yml file. I wrote it following a tutorial (and looking into other repo, it looks quite standard to me).  
In particular, I suppose that the docker-image is set from

> Blockquote jobs:  
> test:  
> name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event\_name }}  
> runs-on: ${{ matrix.os }}  
> strategy:  
> fail-fast: false  
> matrix:  
> version:  
> - ‘1.5’  
> os:  
> - ubuntu-latest

where I wrote ubuntu:latest.  
Do you have any suggestions on how to avoid this problem? Maybe I should change my ci.yml file?  
Thank you for your time,  
Marco

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 5, 2021, 9:11pm UTC](https://discourse.julialang.org/t/python-packages-and-ci/52903/2 "2021-01-05T21:11:10Z")

</div>

> [@marcobonici](#):
>
> Now, I need to use `classy` for my project and I want a unit tests suite for my project. Which are your suggestions?

Just run `classy` on your machine for some unit tests and save the output to a file. Then in your Julia project, load the file of expected outputs and check them against the Julia results. That way, you don’t need to have Python at all on the test/CI machine.

---

<div class="post-metadata">

**Author:** ![marcobonici](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marcobonici/32/20549_2.png) [@marcobonici](https://discourse.julialang.org/u/marcobonici)\
**Post date:** [January 5, 2021, 9:30pm UTC](https://discourse.julialang.org/t/python-packages-and-ci/52903/3 "2021-01-05T21:30:36Z")

</div>

Hi, thank you for your answer!  
Yes, I got your point but this won’t work for me. `classy` is a module that I need to integrate in my code, not only for unit testing…so I cannot simply add the output:/

---

<div class="post-metadata">

**Author:** ![marius311](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marius311/32/3953_2.png) [@marius311](https://discourse.julialang.org/u/marius311)\
**Post date:** [January 5, 2021, 9:48pm UTC](https://discourse.julialang.org/t/python-packages-and-ci/52903/4 "2021-01-05T21:48:34Z")

</div>

Welcome to Julia 🙂 The easist option is probably to just pip install from the Github actions script, here’s an example:

[https://github.com/marius311/CMBLensing.jl/blob/dfb5ae44073c39ab7432eeee49c40d5fcc43c2eb/.github/workflows/runtests.yml#L18-L29](https://github.com/marius311/CMBLensing.jl/blob/dfb5ae44073c39ab7432eeee49c40d5fcc43c2eb/.github/workflows/runtests.yml#L18-L29)

That same repo has [an example](https://github.com/marius311/CMBLensing.jl/blob/dfb5ae44073c39ab7432eeee49c40d5fcc43c2eb/.github/workflows/docbuild.yml) of a Github action that runs a Docker image too (although not for tests, for building docs), if you wanted to go that route, its only slightly more complicated.

---

<div class="post-metadata">

**Author:** ![marcobonici](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marcobonici/32/20549_2.png) [@marcobonici](https://discourse.julialang.org/u/marcobonici)\
**Post date:** [January 5, 2021, 10:02pm UTC](https://discourse.julialang.org/t/python-packages-and-ci/52903/5 "2021-01-05T22:02:08Z")

</div>

Hi Marius, thank you for your answer!  
I’ll try it asap…then I’ll write to you if it’s working:)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 5, 2021, 10:18pm UTC](https://discourse.julialang.org/t/python-packages-and-ci/52903/6 "2021-01-05T22:18:18Z")

</div>

> [@marcobonici](#):
>
> `classy` is a module that I need to integrate in my code, not only for unit testing…so I cannot simply add the output:/

I see. In the short run, you can use `pip` with github actions as noted by @marius311. In the long run, you should consider writing a native Julia wrapper for CLASS — since CLASS seems to be a [pure C library with an interface in terms of `structs`](http://class-code.net/), calling it directly from Julia should be straightforward if tedious.

You’d create a CLASS [build script on Yggdrasil](https://github.com/JuliaPackaging/Yggdrasil), then generate Julia `struct` mirrors of the CLASS structs (e.g. automated with [Clang.jl](https://github.com/JuliaInterop/Clang.jl)) to put together a “Classy.jl” front-end package. Many people might find this useful.

---

<div class="post-metadata">

**Author:** ![marcobonici](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marcobonici/32/20549_2.png) [@marcobonici](https://discourse.julialang.org/u/marcobonici)\
**Post date:** [January 5, 2021, 10:31pm UTC](https://discourse.julialang.org/t/python-packages-and-ci/52903/7 "2021-01-05T22:31:20Z")

</div>

It worked…thanks!

---

<div class="post-metadata">

**Author:** ![marcobonici](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marcobonici/32/20549_2.png) [@marcobonici](https://discourse.julialang.org/u/marcobonici)\
**Post date:** [January 5, 2021, 10:36pm UTC](https://discourse.julialang.org/t/python-packages-and-ci/52903/8 "2021-01-05T22:36:21Z")

</div>

I have never written a wrapper, but probably this would be interesting. I’ll consider it…thanks:)

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [January 6, 2021, 1:36pm UTC](https://discourse.julialang.org/t/python-packages-and-ci/52903/9 "2021-01-06T13:36:22Z")

</div>

Conda.jl also supports pip:  
[https://github.com/JuliaPy/Conda.jl#conda-and-pip](https://github.com/JuliaPy/Conda.jl#conda-and-pip)

You can use Conda.jl to install your Conda and pip dependencies directly from a Julia script.
