# Gradual Julia-ization of Python libraries

**URL:** <https://discourse.julialang.org/t/gradual-julia-ization-of-python-libraries/117828>\
**Category:** General Usage\
**Tags:** package, python, pythoncall\
**Created:** [August 5, 2024, 4:09am UTC](https://discourse.julialang.org/t/gradual-julia-ization-of-python-libraries/117828 "2024-08-05T04:09:56Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![thautwarm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thautwarm/32/37760_2.png) [@thautwarm](https://discourse.julialang.org/u/thautwarm)\
**Post date:** [August 7, 2024, 1:59pm UTC](https://discourse.julialang.org/t/gradual-julia-ization-of-python-libraries/117828/21 "2024-08-07T13:59:00Z")

</div>

I believe this is something heavily discussed in TongYuan between @JohnnyChen94 and me. We have engaged in some local open-source activities and have considered quite a lot about user-side adoption of Julia-based scientific computing frameworks (this is necessary if we want to make the use of Julia grow among the target users and make the company success).

We have also tried a lot.

[JNumPy](https://github.com/Suzhou-Tongyuan/jnumpy) is very similar to what @kdheepak assumed about the so-called “PythonLimitedApi.jl”. Integrating PackageCompiler.jl can be awesome but we previously do not consider this, because loading multiple shared libraries that are all created by PackageCompiler.jl is a challenge.

```julia
module example

using TyPython
using TyPython.CPython

@export_py function mat_mul(a::AbstractArray, b::AbstractArray)::Array
    return a * b
end

function init()
    @export_pymodule _example begin
        jl_mat_mul = Pyfunc(mat_mul)
    end
end

# the following code is optional,
# but makes Python code loading much faster since the second time.
precompile(init, ())

end

```

What’s more about PackageCompiler.jl: Chen and I have thought that we might provide a battled-included build of PackageCompiler.jl where we can include a large number of Julia libraries for regular scientic computing scenarios, and finally export well-designed C functions for Python integration. This looks very promising for commercial products, and I feel sad that Syslab (TongYuan’s scientific computing IDE product based on Julia and VSCode) didn’t take this approach (it seems that it’s a bit late). However, this approach is still limited because Julia applications cannot be modular, running multiple Julia sysimages in a single process is pretty problematic. Chen said he was willing to solve things by inter-process solutions (like containers, local/remote services, etc.)

[SyslabCC](https://discourse.julialang.org/t/syslabcc-suzhou-tongyuans-proprietary-julia-aot-compiler-is-now-available-for-free-use-personal-educational-license-only/114633) is an AOT compiler developed by TongYuan, and it’s highly welcome for you to have collaborations with us. **This AOT compiler is capable of producing libraries for integrating with languages such as Python**. We have recently supported C++ code generation and active/passive multi-threading use (e.g., Threads.@threads for-loops). The performance is competitive, at least not notably slower than native Julia for compuation tasks.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/5/75b3b73c2d9850588140f04336f0fc5fb7356b65.png)

You can run the benchmarks if you have Syslab community version installed, the source code is located at [JuliaCon2024-JuliaAOT/benchmarks at main · Suzhou-Tongyuan/JuliaCon2024-JuliaAOT (github.com)](https://github.com/Suzhou-Tongyuan/JuliaCon2024-JuliaAOT/tree/main/benchmarks).

We are currently using our AOT compiler to write simulation algorithms and integrate them in Sysplorer, system multi-disciplinary modeling and simulation environment product in TongYuan (I believe the company actually earns money with this). The combination of high performance and rich ecosystem is a game changer for this area, as for all algorithms we wrote with Julia AOT are far faster than some traditional “established solution” for simulation.

---

_[View the full topic](https://discourse.julialang.org/t/gradual-julia-ization-of-python-libraries/117828)._
