https://github.com/terasakisatoshi/jldev_rye
(Julia + Python/Rye) --> That is gomagoma kyukkyu
https://github.com/terasakisatoshi/jldev_rye
azarashi julia rye
Last synced: about 1 year ago
JSON representation
(Julia + Python/Rye) --> That is gomagoma kyukkyu
- Host: GitHub
- URL: https://github.com/terasakisatoshi/jldev_rye
- Owner: terasakisatoshi
- License: mit
- Created: 2023-12-19T04:43:16.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-28T17:23:53.000Z (over 1 year ago)
- Last Synced: 2025-03-18T20:08:31.920Z (about 1 year ago)
- Topics: azarashi, julia, rye
- Language: Julia
- Homepage:
- Size: 149 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JLRye [](https://github.com/terasakisatoshi/jldev_rye/actions/workflows/JuliaCI.yml) [](https://terasakisatoshi.github.io/JLRye.jl/stable/) [](https://terasakisatoshi.github.io/JLRye.jl/dev/)
[](https://rye-up.com)
## How to use
## Prerequisites
- Install Julia
- It is a good idea to use [juliaup](https://github.com/JuliaLang/juliaup).
- Install `rye`
- Please follow [the instructions](https://rye-up.com/guide/installation/).
- Optionally, you can install [uv](https://github.com/astral-sh/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
```console
$ 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
```console
$ 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:
```console
$ rye run python file.py
```
### Run Julia Script
Assuming you want to run `file.jl`, please use the following command:
```console
$ julia --project file.jl
```
That's it. Go on to the next section.
## Plot Lorenz Attractor
### Python
```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
```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:
```julia
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
```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
```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
```console
$ rye sync
$ rye run pytest
```
### Julia
```console
$ julia --project -e 'using Pkg; Pkg.instantiate()'
$ julia --project -e 'using Pkg; Pkg.test()'
```