-
Notifications
You must be signed in to change notification settings - Fork 334
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 py_require()
#1718
Updates to py_require()
#1718
Conversation
- still discover r-reticualte venv before bootstrapping - only bootstrap a venv if initializing python - give a way to opt out
- pass through stderr while running the command via `system2()` - use `is_alive()` to check if the process is still running - simplify output post-processing
Restarting R session...
> reticulate::repl_python()
Python 3.13.1 (/Users/tomasz/Library/Caches/r-reticulate/uv-cache/archive-v0/Kc-xLPZ1uy6xA8d7Kourf/bin/python3)
Reticulate 1.40.0.9000 REPL -- A Python interpreter in R.
Enter 'exit' or 'quit' to exit the REPL and return to R.
>>>
|
You're talking about only for |
I would suggest to go even simpler: Python version: 3.13.1
Installed Python packages: numpy, pandas, ...<other requirements from py_require()>
Reticulate 1.40.0.9000 REPL -- A Python interpreter in R.
Enter 'exit' or 'quit' to exit the REPL and return to R. |
Good question. Maybe we should modify the print methods for py_config and py_last_error too, to avoid showing the path to the cached env. |
Actually, using UV_PYTHON seems to be a good mechanism to set a "soft" default: > x <- uv_get_or_create_env()
> system2(x, c("--version"))
Python 3.13.1
>
> withr::with_envvar(
+ list("UV_PYTHON" = "3.11"), {
+ x <- uv_get_or_create_env()
+ system2(x, c("--version"))
+ }
+ )
Python 3.11.11
>
> withr::with_envvar(
+ list("UV_PYTHON" = "3.11"), {
+ x <- uv_get_or_create_env(python_version = c("3.10"))
+ system2(x, c("--version"))
+ }
+ )
Python 3.10.16
>
> withr::with_envvar(
+ list("UV_PYTHON" = "3.11"), {
+ x <- uv_get_or_create_env(python_version = c(">=3.11", "<=3.12"))
+ system2(x, c("--version"))
+ }
+ )
Python 3.12.0 |
Thanks Edgar! I merged to unblock Max; We'll address remaining issues in followup PR's. |
Changes:
Update order of discovery:
Update
uv_get_or_create_env()
:Update
uv_binary()
Update uv cache resolution:
uv cache dir
if the uv installation is not managed by reticulate.Changes to tests:
py_require()