JuliaPy / JuliaPy/PythonCall.jl

pystrings for easy global scope evaluation

オープン
#307 コメント 9 件 リアクション 2 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Julia
スター
1.1k
フォーク
86
平均マージ
1日 22時間
マージ済み PR(30日)
3

説明

A feature request to enable support for functionality mirroring PyCall's pystrings. It is very helpful when people are transitioning from python to Julia to be able to execute and grab the results of a few simple lines of code in global python scope. Currently, my hack at reproducing this behavior is below, but making this functionality easier to access (maybe just by making py"""...""" implement the following wrapping) would be appreciated.

In PyCall
py"""
from dustmaps.config import config
config.reset()
config['data_dir'] = '../../dustmaps/'
import dustmaps.sfd
dustmaps.sfd.fetch()
"""

Hack-y PythonCall:
pyexec("from dustmaps.config import config",Main)
pyexec("config.reset()",Main)
pyexec("config['data_dir'] = '../../dustmaps/'",Main)
pyexec("import dustmaps.sfd",Main)
pyexec("dustmaps.sfd.fetch()",Main)

I tried getting something like this working with @pyeval begin ... end, but It was not obvious how to make the scope persist etc... So something to make this easy (or well documented if it exists) would be lovely.

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

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

評価

この issue はまだ評価されていません。

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

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