Skip to content

Commit

Permalink
Merge pull request #1548 from rstudio/dont-discover-python2
Browse files Browse the repository at this point in the history
don't discover python2 in `py_discover_config()`
  • Loading branch information
t-kalinowski authored Mar 13, 2024
2 parents b1c33d5 + 7899673 commit 18ce0df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
15 changes: 9 additions & 6 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
# reticulate (development version)

- `iterate(simplify=TRUE)` rewritten in C for speed improvements.
- `iterate(simplify=TRUE)` rewritten in C for speed improvements.

- Fixed hang encountered (sometimes) when attempting to call `iterate()`
- Fixed hang encountered (sometimes) when attempting to call `iterate()`
on an exhausted `py_iterator()` object multiple times.

- Update for Pandas 2.2 deprecation of `Index.format()` (#1537, #1538).

- Updates for CRAN R-devel (R 4.4).

- Fixed an issue where `py_discover_config()` would discover `python` (v2) on the PATH
in preference of `python3` on the PATH. (#1547)

# reticulate 1.35.0

- Subclassed Python list and dict objects are no longer automatically converted
to R vectors. Additionally, the S3 R `class` attribute for Python objects is
now constructed using the Python `type(object)` directly, rather than from the
now constructed using the Python `type(object)` directly, rather than from the
`object.__class__` attribute. See #1531 for details and context.

- R external pointers (EXTPTRSXP objects) now round-trip through
Expand All @@ -29,7 +32,7 @@
- Added support for partially unexpanded variables like `$USER` in
`XDG_DATA_HOME` and similar (#1513, #1514)

## Knitr Python Engine Changes:
## Knitr Python Engine Changes:

- The knitr python engine now formats captured python exceptions to include the
exception type and any exception notes when chunk options
Expand All @@ -46,7 +49,7 @@
where matplotlib was first imported would be the wrong size
(reported in #1523, fixed in #1530)

- Fixed an issue where the knitr engine would not correctly display altair
- Fixed an issue where the knitr engine would not correctly display altair
compound charts if more than one were present in a document (#1500, #1532).

# reticulate 1.34.0
Expand Down Expand Up @@ -160,7 +163,7 @@
- The knitr engine gains a `jupyter_compat` option, enabling
reticulate to better match the behavior of Jupyter. When this chunk
option is set to `TRUE`, only the return value from the last
expression in a chunk is auto-printed.
expression in a chunk is auto-printed.
(#1391, #1394, contributed by @matthew-brett)

- The knitr engine now more reliably detects and displays matplotlib
Expand Down
7 changes: 4 additions & 3 deletions R/config.R
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ py_discover_config <- function(required_module = NULL, use_environment = NULL) {
## In other words,
## - no use_python(), use_virtualenv(), use_condaenv()
## - no RETICULATE_PYTHON, RETICULATE_PYTHON_ENV, or RETICULATE_PYTHON_FALLBACK env vars
## - no existing venv in the current working directory named: venv .venv virtualenv or .virtualenv
## - no env named 'r-bar' if there was a call like `import('foo', delay_load = list(environment = "r-bar"))`
## - no env named 'r-foo' if there was a call like `import('foo')`
## - we're not running under an already activated venv (i.e., no VIRTUAL_ENV env var)
Expand Down Expand Up @@ -385,13 +386,13 @@ py_discover_config <- function(required_module = NULL, use_environment = NULL) {

# if we have a required module ensure it's satisfied.
# also check architecture (can be an issue on windows)
has_python_gte_27 <- as.numeric_version(config$version) >= "2.7"
has_python_gte_36 <- as.numeric_version(config$version) >= "3.6"
has_compatible_arch <- !is_incompatible_arch(config)
has_preferred_numpy <- !is.null(config$numpy) && config$numpy$version >= "1.6"
if (has_compatible_arch && has_preferred_numpy)
valid_python_versions <- c(valid_python_versions, python_version)
append(valid_python_versions) <- python_version
has_required_module <- is.null(config$required_module) || !is.null(config$required_module_path)
if (has_python_gte_27 && has_compatible_arch && has_preferred_numpy && has_required_module)
if (has_python_gte_36 && has_compatible_arch && has_preferred_numpy && has_required_module)
return(config)
}

Expand Down

0 comments on commit 18ce0df

Please sign in to comment.