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

Updates to enable repl_python() to use Positron Python kernel #1648

Merged
merged 34 commits into from
Sep 3, 2024

Conversation

t-kalinowski
Copy link
Member

@t-kalinowski t-kalinowski commented Aug 16, 2024

This PR works towards making repl_python() able to use Positron Python features and making repl_python() a peer experience to using the Python language pack in Positron.

The updates primarily involve under-the-hood changes to support this goal. These include:

  • A "Pending Python Calls" notifier integrated with R's main thread event loop.
  • Automatic finalization of the Python session when the R session exits.
  • Support for calling R functions from background Python threads, making py_main_thread_func() obsolete and deprecated.

This work continues from #1641, which allowed background Python threads to run concurrently with R on the main thread.

Copy link
Collaborator

@kevinushey kevinushey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM!

src/pending_py_calls_notifier.cpp Outdated Show resolved Hide resolved
src/pending_py_calls_notifier.cpp Show resolved Hide resolved
src/pending_py_calls_notifier.h Show resolved Hide resolved

void safe_print_value(SEXP value, const char* warn_print_failed) {
// Use R_ToplevelExec to safely execute Rf_PrintValue with an inlined lambda
if (!R_ToplevelExec([](void* data) -> void {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧙

@t-kalinowski t-kalinowski marked this pull request as ready for review August 23, 2024 16:21
@t-kalinowski t-kalinowski merged commit 27d6e73 into main Sep 3, 2024
16 checks passed
@t-kalinowski t-kalinowski deleted the positron-repl_python branch September 3, 2024 18:24
@t-kalinowski t-kalinowski changed the title Update repl_python() to use independent Console session in Positron Updates to enable repl_python() to use independent Console session in Positron Sep 3, 2024
@t-kalinowski t-kalinowski changed the title Updates to enable repl_python() to use independent Console session in Positron Updates to enable repl_python() to use Positron Python kernel Sep 3, 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