JuliaPy / JuliaPy/PyCall.jl

RFC: Lazier and more interface-based conversion

オープン
#617 コメント 16 件 リアクション 10 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Julia
スター
1.5k
フォーク
186
PR マージ指標
30日以内にマージされた PR はありません

説明

Rather than trying to convert and copy values between Python and Julia, I propose to:

  1. Enhance pyjlwrap and implement most of Python data model such that virtually all Julia values are usable with pyjlwrap. For example, we can translate getindex to __getitem__ etc. such that we can use an AbstractArray without translating it to a Numpy array. We can also implement __array__ in Julia side to make numpy.asarray fast.

  2. Restrict automatic conversion to Julia types which supports ("practically") lossless round-trip (Julia -> Python -> Julia). Maybe something like:

Union{
    Nothing,
    Integer,
    NpyNumber,  # Int64, Float16, Float32, Float64, ...
    Array{<: NpyNumber},
    String,
    Dates.AbstractTime,  # or maybe only the concrete subtypes
    IO,                  # ditto
}

Here is a reference implementation that shows this approach works: https://github.com/tkf/PyBase.jl

It would solve, e.g.,:
https://github.com/JuliaPy/PyCall.jl/issues/11
https://github.com/JuliaPy/PyCall.jl/issues/175
https://github.com/JuliaPy/PyCall.jl/issues/507
https://github.com/JuliaPy/PyCall.jl/issues/555
https://github.com/JuliaPy/PyCall.jl/issues/616
https://github.com/JuliaPy/PyPlot.jl/issues/391
https://github.com/JuliaPy/PyPlot.jl/issues/400
https://github.com/JuliaPy/pyjulia/issues/122
https://github.com/JuliaPy/pyjulia/issues/123
https://github.com/JuliaDiffEq/diffeqpy/issues/21

There are many details that can be refined (e.g., rather than using a single Python class, maybe define a few base class? Or even create Python class on-demand?) but first I'd like to know if it is a reasonable direction for PyCall.jl.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず既存の pyjlwrap のアプローチと、リンクされている PyBase.jl のリファレンス実装を確認し、次にそれらを一覧にある変換関連の issue と比較します。提案されているインターフェースベースの変換方針が PyCall.jl に適しているかを明らかにし、実装前にその範囲を具体化できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
julia, python
領域
developer-experience, tooling
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。