From 5013e80817d1453f57ea2e2d961470e992708e48 Mon Sep 17 00:00:00 2001 From: "E. David Aja" Date: Fri, 16 Dec 2022 11:43:16 -0500 Subject: [PATCH 1/5] remove RETICULATE_PYTHON detection --- rsconnect/bundle.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/rsconnect/bundle.py b/rsconnect/bundle.py index 24b3ba77..32d398af 100644 --- a/rsconnect/bundle.py +++ b/rsconnect/bundle.py @@ -1117,9 +1117,6 @@ def which_python(python, env=os.environ): raise RSConnectException('The file, "%s", does not exist or is not executable.' % python) return python - if "RETICULATE_PYTHON" in env: - return os.path.expanduser(env["RETICULATE_PYTHON"]) - return sys.executable From 40e707d77082cc0adfa1f0453742f82be8a696ca Mon Sep 17 00:00:00 2001 From: edavidaja Date: Mon, 9 Jan 2023 10:59:38 -0500 Subject: [PATCH 2/5] remove reticulate python test --- tests/test_bundle.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_bundle.py b/tests/test_bundle.py index 5c451bb4..a3276c4d 100644 --- a/tests/test_bundle.py +++ b/tests/test_bundle.py @@ -652,7 +652,6 @@ def test_which_python(self): self.assertEqual(which_python(sys.executable), sys.executable) self.assertEqual(which_python(None), sys.executable) - self.assertEqual(which_python(None, {"RETICULATE_PYTHON": "fake-python"}), "fake-python") def test_default_title(self): self.assertEqual(_default_title("testing.txt"), "testing") From 71083f2e8f4c5809f480fd511a4c3dc3caf03093 Mon Sep 17 00:00:00 2001 From: edavidaja Date: Mon, 9 Jan 2023 11:23:06 -0500 Subject: [PATCH 3/5] more RETICULATE_PYTHON cleanup --- README.md | 3 +-- rsconnect/actions.py | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/README.md b/README.md index 46e61f9e..67e8a947 100644 --- a/README.md +++ b/README.md @@ -220,8 +220,7 @@ specified package list. If there is no `requirements.txt` file or the `--force-generate` option is specified, the package dependencies will be determined from the current Python environment, or -from an alternative Python executable specified via the `--python` option or via the -`RETICULATE_PYTHON` environment variable: +from an alternative Python executable specified via the `--python` option: ```bash rsconnect deploy notebook --python /path/to/python my-notebook.ipynb diff --git a/rsconnect/actions.py b/rsconnect/actions.py index 46c994ba..46ca1161 100644 --- a/rsconnect/actions.py +++ b/rsconnect/actions.py @@ -113,7 +113,6 @@ def which_python(python, env=os.environ): In priority order: * --python specified on the command line - * RETICULATE_PYTHON defined in the environment * the python binary running this script """ warn("This method has been moved and will be deprecated.", DeprecationWarning, stacklevel=2) @@ -122,9 +121,6 @@ def which_python(python, env=os.environ): raise RSConnectException('The file, "%s", does not exist or is not executable.' % python) return python - if "RETICULATE_PYTHON" in env: - return os.path.expanduser(env["RETICULATE_PYTHON"]) - return sys.executable From f46c142f529f66dbca95d2cf8ce6946f9f81fe81 Mon Sep 17 00:00:00 2001 From: edavidaja Date: Mon, 9 Jan 2023 11:26:50 -0500 Subject: [PATCH 4/5] remove all reticulate references --- README.md | 9 +++------ rsconnect/bundle.py | 1 - 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 67e8a947..32f98f22 100644 --- a/README.md +++ b/README.md @@ -254,8 +254,7 @@ in a later deployment. Use the `write-manifest` command to do this. The `write-manifest` command will also create a `requirements.txt` file, if it does not already exist or the `--force-generate` option is specified. It will contain the package dependencies from the current Python environment, or from an alternative -Python executable specified in the `--python` option or via the `RETICULATE_PYTHON` -environment variable. +Python executable specified in the `--python` option. Here is an example of the `write-manifest` command: @@ -348,8 +347,7 @@ the specified package list. If there is no `requirements.txt` file or the `--force-generate` option is specified, the package dependencies will be determined from the current Python environment, or -from an alternative Python executable specified via the `--python` option or via the -`RETICULATE_PYTHON` environment variable: +from an alternative Python executable specified via the `--python` option: ```bash rsconnect deploy api --python /path/to/python my-api/ @@ -370,8 +368,7 @@ manifest in a later deployment. Use the `write-manifest` command to do this. The `write-manifest` command will also create a `requirements.txt` file, if it does not already exist or the `--force-generate` option is specified. It will contain the package dependencies from the current Python environment, or from an alternative -Python executable specified in the `--python` option or via the `RETICULATE_PYTHON` -environment variable. +Python executable specified in the `--python` option. Here is an example of the `write-manifest` command: diff --git a/rsconnect/bundle.py b/rsconnect/bundle.py index d0c0f32a..b9783c40 100644 --- a/rsconnect/bundle.py +++ b/rsconnect/bundle.py @@ -1080,7 +1080,6 @@ def which_python(python, env=os.environ): In priority order: * --python specified on the command line - * RETICULATE_PYTHON defined in the environment * the python binary running this script """ if python: From 4d3c97f7c5f4e91a9461e17d2f289f635da4d1dc Mon Sep 17 00:00:00 2001 From: edavidaja Date: Thu, 12 Jan 2023 09:33:21 -0500 Subject: [PATCH 5/5] added changelog entry --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04c98ae6..3a821c14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Removed + +- `rsconnect-python` no longer considers the `RETICULATE_PYTHON` environment variable. + In environments where `RETICULATE_PYTHON` is set outside a project context (e.g. by a Posit Workbench administrator), + attempting to deploy content or write manifests in projects using virtual environments required explicitly setting `--python /path/to/virtualenv/python`. + Removing `RETICULATE_PYTHON` detection should simplify the use of the CLI in this case. + ## [1.13.0] - 2022-12-02 ### Added