Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to render Python with PythonCall #180

Closed
wants to merge 1 commit into from

Conversation

tuncbkose
Copy link

@tuncbkose tuncbkose commented Sep 5, 2024

Hi, I saw #108 and thought "I may use that" so tried adding it myself. I'm not sure if this is acceptable for a merge (it is not even fully ready yet), but I thought I may put it here in case it would be useful to someone.

Be warned that both this package and PythonCall are new to me, but I replicated the r code closely. One thing to note is that the extension file is basically empty right now, because I am not 100% clear on everything that is happening in the r version.

Todos

  • More extensive tests
  • Figure out a way to specify Python interpreter/control conda stuff

@jkrumbiegel
Copy link
Collaborator

jkrumbiegel commented Sep 9, 2024

I don't think the @py macro is quite the right tool here, because as far as I understand, it tries to convert python-style code to Julia function calls on a best-effort basis. We'd need direct execution of python code, so that any code is supported. I had a discussion about that with the PythonCall maintainer here JuliaPy/PythonCall.jl#551

Looks like one needs to analyze if the last statement should be evaled, I would assume that IPython notebook kernels do the same thing. Not every code fragment in Python results in a value, which is different from Julia, and also different from R I think.

@tuncbkose
Copy link
Author

Oh oops, it worked well enough for my one-line code examples in different languages but I guess the general case is a lot more complicated instead of just a bit more.

I'll close this PR as this works good enough for me for now.

@tuncbkose tuncbkose closed this Sep 9, 2024
@jkrumbiegel jkrumbiegel mentioned this pull request Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants