Skip to content

terasakisatoshi/jldev_rye

Repository files navigation

JLRye JuliaCI Stable Dev

Rye

How to use

Prerequisites

  • Install Julia
    • It is a good idea to use juliaup.
  • Install rye
  • Optionally, you can install uv which is an extremely fast Python package installer and resolver, written in Rust.
$ curl -LsSf https://astral.sh/uv/install.sh | sh

and run the following command to set uv as a backend.

$ rye config --set-bool behavior.use-uv=true

Here is an output from my machine

$ julia --version
julia version 1.10.2
$ rye --version
rye 0.16.0
commit: 0.16.0 (c003223d5 2023-12-16)
platform: macos (x86_64)
self-python: cpython@3.11
symlink support: true

Setup this project

$ git clone git@github.com:terasakisatoshi/jldev_rye.git
$ cd jldev_rye
$ rye sync
$ julia --project -e 'using Pkg; Pkg.instantiate()'

Run Python Script

Assuming you want to run file.py, please use the following command:

$ rye run python file.py

Run Julia Script

Assuming you want to run file.jl, please use the following command:

$ julia --project file.jl

That's it. Go on to the next section.

Plot Lorenz Attractor

Python

from matplotlib import pyplot as plt
from jlrye.lorenz_attractor import generate_points
df = generate_points()
ax = plt.figure().add_subplot(projection="3d")
ax.plot(df.x, df.y, df.z, markersize=2, marker="o")
ax.set_title("Lorenz Attractor")
plt.show()

Julia

using StatsPlots
using JLRye

df = JLRye.generate_points()
@df df plot3d(:x, :y, :z, marker=2, legend=false, title="Lorenz Attractor")

If you are a Pythonista, you may want to run the following script:

using PythonPlot: pyplot as plt
using JLRye

df = JLRye.generate_points()
ax = plt.figure().add_subplot(projection="3d")
ax.plot(df.x, df.y, df.z, markersize=2, marker="o")
ax.set_title("Lorenz Attractor")
plt.show()

Call Julia functions from Python

from matplotlib import pyplot as plt
import juliacall

from jlrye.julia_interface import JLRye
jldf = JLRye.generate_points()
df = juliacall.PythonCall.pytable(jldf)
ax = plt.figure().add_subplot(projection="3d")
ax.plot(df.x, df.y, df.z, markersize=2, marker="o")
ax.set_title("Lorenz Attractor")
plt.show()

Call Python functions from Julia

using DataFrames: DataFrame
using PythonCall: PyTable
using StatsPlots

using JLRye: jlrye
pydf = jlrye.generate_points()
df = DataFrame(PyTable(pydf))
@df df plot3d(:x, :y, :z, marker=2, legend=false, title="Lorenz Attractor")

Run Tests

Python

$ rye sync
$ rye run pytest

Julia

$ julia --project -e 'using Pkg; Pkg.instantiate()'
$ julia --project -e 'using Pkg; Pkg.test()'

About

(Julia + Python/Rye) --> That is gomagoma kyukkyu

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published