Any plans to add python code completion to RNotebook when used with reticulate?

Hi, I just saw that it's possible to run python code in RNotebook this is pure amazement!

Are there any plans for code completion?

knitr::opts_chunk$set(echo = TRUE)
library(reticulate)
use_python("/home/myuser/home/myuser/dev/anaconda3/envs/pymachine3/bin/python")
import pandas
##### Please Please Code Completion for python in RNotebooks
flights = pandas.read_csv("~/Downloads/flights.csv") ##### Please Please Code Completion for python!!!
print(flights.head())
2 Likes

I swear I saw a GitHub issue on this a while back, but I can’t seem to find it.

Assuming there is no feature request, I’d encourage you to make one. (Some tips on how best to do that; Writing Good Feature Requests · rstudio/rstudio Wiki · GitHub)

Here’s a discussion about the same feature for Rcpp code chunks from just four months ago,

1 Like

Can’t speak for the issue tracker, but maybe you weren’t imagining things because:

1 Like

Ok I tried 1.2 I see I can do code complete for python inside R but not inside Python snippets

so this get code completion:

```{r setup, include=FALSE}
pandas <- import("pandas")
plt <- import("matplotlib.pyplot")
np <- import("numpy")
t = np$arange(0.1, 2, 0.01)
y <- t^2
.
.
.
```

while this does not get code completion working:

```{python}
flights = pandas.read_csv("~/Downloads/flights.csv")
print(flights.head())
import matplotlib.pyplot as plt
```

I guess that is the supposed to be status in 1.2 thanks!

https://blog.rstudio.com/2018/03/26/reticulate-r-interface-to-python/

1 Like

Hm, so with 1.2 there is:

But not python code completion in R Markdown python chunks?

1 Like

Autocompletion should work within Python chunks in R Markdown documents:

38%20PM

Can you provide more details on what you're seeing?

3 Likes

uploaded moving gif which shows I have completion with pandas but not for arguments in numpy details in video https://imgur.com/a/Z93fg8x

1 Like

Thanks. This is an issue in reticulate itself, and we're somewhat handicapped as Python does not provide argument information for builtin functions. See:

1 Like