Skip to content

Commit ec4b5bf

Browse files
authored
Merge branch 'master' into 177-cacert-option
2 parents 81f8fb4 + 6ec75f8 commit ec4b5bf

File tree

17 files changed

+256
-29
lines changed

17 files changed

+256
-29
lines changed

.github/workflows/main.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,29 @@ jobs:
146146
repo: 'rsconnect-jupyter',
147147
event_type: 'rsconnect_python_latest'
148148
})
149+
test-rsconnect:
150+
name: "Test vetiver"
151+
runs-on: ubuntu-latest
152+
steps:
153+
- uses: actions/checkout@v2
154+
- uses: actions/setup-python@v2
155+
with:
156+
python-version: 3.8
157+
- name: Install dependencies
158+
run: |
159+
python -m pip install --upgrade pip
160+
python -m pip install -r requirements.txt
161+
python -m pip install -r vetiver-testing/vetiver-requirements.txt
162+
- name: run RStudio Connect
163+
run: |
164+
docker-compose up --build -d
165+
pip freeze > requirements.txt
166+
make dev
167+
env:
168+
RSC_LICENSE: ${{ secrets.RSC_LICENSE }}
169+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
170+
171+
# NOTE: edited to run checks for python package
172+
- name: Run tests
173+
run: |
174+
pytest -m 'vetiver'

.github/workflows/snyk.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,23 @@ on:
77
env:
88
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
99
SNYK_ORG: rstudio-connect
10-
SNYK_PROJECT: rsconnect-python
1110

1211
jobs:
13-
python-dependencies:
12+
snyk-monitor:
1413
runs-on: ubuntu-latest
1514
steps:
16-
- uses: actions/checkout@master
17-
- name: Run Snyk on dependencies
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Run Snyk (setup.py)
1820
uses: snyk/actions/python@master
1921
with:
2022
command: monitor
21-
args: --file=setup.py --print-deps --project-name=${{ env.SNYK_PROJECT }} --org=${{ env.SNYK_ORG }}
22-
python-code:
23-
runs-on: ubuntu-latest
24-
steps:
25-
- uses: actions/checkout@master
26-
- name: Run Snyk static analysis
23+
args: --file=setup.py --package-manager=pip --project-name=setup.py --org=${{ env.SNYK_ORG }}
24+
25+
- name: Run Snyk (requirements.txt)
2726
uses: snyk/actions/python@master
2827
with:
29-
command: code test
30-
args: --project-name=${{ env.SNYK_PROJECT }} --org=${{ env.SNYK_ORG }} rsconnect/
28+
command: monitor
29+
args: --file=requirements.txt --package-manager=pip --project-name=requirements.txt --org=${{ env.SNYK_ORG }}

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [Unreleased]
8+
9+
### Removed
10+
11+
- `rsconnect-python` no longer considers the `RETICULATE_PYTHON` environment variable.
12+
In environments where `RETICULATE_PYTHON` is set outside a project context (e.g. by a Posit Workbench administrator),
13+
attempting to deploy content or write manifests in projects using virtual environments required explicitly setting `--python /path/to/virtualenv/python`.
14+
Removing `RETICULATE_PYTHON` detection should simplify the use of the CLI in this case.
15+
716
## [1.13.0] - 2022-12-02
817

918
### Added

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ endif
2020

2121
TEST_ENV =
2222

23+
RSC_API_KEYS=vetiver-testing/rsconnect_api_keys.json
24+
2325
ifneq ($(CONNECT_SERVER),)
2426
TEST_ENV += CONNECT_SERVER=$(CONNECT_SERVER)
2527
endif
@@ -165,3 +167,21 @@ promote-docs-in-s3:
165167
--cache-control max-age=300 \
166168
docs/site/ \
167169
s3://docs.rstudio.com/rsconnect-python/
170+
171+
172+
dev: vetiver-testing/rsconnect_api_keys.json
173+
174+
dev-start:
175+
docker-compose up -d
176+
docker-compose exec -T rsconnect bash < vetiver-testing/setup-rsconnect/add-users.sh
177+
# curl fails with error 52 without a short sleep....
178+
sleep 5
179+
curl -s --retry 10 --retry-connrefused http://localhost:3939
180+
181+
dev-stop:
182+
docker-compose down
183+
rm -f $(RSC_API_KEYS)
184+
185+
$(RSC_API_KEYS): dev-start
186+
python vetiver-testing/setup-rsconnect/dump_api_keys.py $@
187+

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,7 @@ specified package list.
220220

221221
If there is no `requirements.txt` file or the `--force-generate` option is specified,
222222
the package dependencies will be determined from the current Python environment, or
223-
from an alternative Python executable specified via the `--python` option or via the
224-
`RETICULATE_PYTHON` environment variable:
223+
from an alternative Python executable specified via the `--python` option:
225224

226225
```bash
227226
rsconnect deploy notebook --python /path/to/python my-notebook.ipynb
@@ -255,8 +254,7 @@ in a later deployment. Use the `write-manifest` command to do this.
255254
The `write-manifest` command will also create a `requirements.txt` file, if it does
256255
not already exist or the `--force-generate` option is specified. It will contain the
257256
package dependencies from the current Python environment, or from an alternative
258-
Python executable specified in the `--python` option or via the `RETICULATE_PYTHON`
259-
environment variable.
257+
Python executable specified in the `--python` option.
260258

261259
Here is an example of the `write-manifest` command:
262260

@@ -349,8 +347,7 @@ the specified package list.
349347

350348
If there is no `requirements.txt` file or the `--force-generate` option is specified,
351349
the package dependencies will be determined from the current Python environment, or
352-
from an alternative Python executable specified via the `--python` option or via the
353-
`RETICULATE_PYTHON` environment variable:
350+
from an alternative Python executable specified via the `--python` option:
354351

355352
```bash
356353
rsconnect deploy api --python /path/to/python my-api/
@@ -371,8 +368,7 @@ manifest in a later deployment. Use the `write-manifest` command to do this.
371368
The `write-manifest` command will also create a `requirements.txt` file, if it does
372369
not already exist or the `--force-generate` option is specified. It will contain
373370
the package dependencies from the current Python environment, or from an alternative
374-
Python executable specified in the `--python` option or via the `RETICULATE_PYTHON`
375-
environment variable.
371+
Python executable specified in the `--python` option.
376372

377373
Here is an example of the `write-manifest` command:
378374

conftest.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
import sys
2+
import pytest
23

34
from os.path import abspath, dirname
45

56

67
HERE = dirname(abspath(__file__))
78
sys.path.insert(0, HERE)
9+
10+
11+
def pytest_addoption(parser):
12+
parser.addoption(
13+
"--vetiver", action="store_true", default=False, help="run vetiver tests"
14+
)
15+
16+
def pytest_configure(config):
17+
config.addinivalue_line("markers", "vetiver: test for vetiver interaction")
18+
19+
def pytest_collection_modifyitems(config, items):
20+
if config.getoption("--vetiver"):
21+
return
22+
skip_vetiver = pytest.mark.skip(reason="need --vetiver option to run")

docker-compose.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: '3.2'
2+
3+
services:
4+
5+
rsconnect:
6+
image: rstudio/rstudio-connect:latest
7+
restart: always
8+
ports:
9+
- 3939:3939
10+
volumes:
11+
- $PWD/vetiver-testing/setup-rsconnect/users.txt:/etc/users.txt
12+
- $PWD/vetiver-testing/setup-rsconnect/rstudio-connect.gcfg:/etc/rstudio-connect/rstudio-connect.gcfg
13+
# by default, mysql rounds to 4 decimals, but tests require more precision
14+
privileged: true
15+
environment:
16+
RSTUDIO_CONNECT_HASTE: "enabled"
17+
RSC_LICENSE: ${RSC_LICENSE}

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ omit = ["tests/*"]
1010

1111
[tool.setuptools_scm]
1212
write_to = "rsconnect/version.py"
13+
14+
[tool.pytest.ini_options]
15+
markers = [
16+
"vetiver: tests for vetiver",
17+
]

rsconnect/actions.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ def which_python(python, env=os.environ):
113113
114114
In priority order:
115115
* --python specified on the command line
116-
* RETICULATE_PYTHON defined in the environment
117116
* the python binary running this script
118117
"""
119118
warn("This method has been moved and will be deprecated.", DeprecationWarning, stacklevel=2)
@@ -122,9 +121,6 @@ def which_python(python, env=os.environ):
122121
raise RSConnectException('The file, "%s", does not exist or is not executable.' % python)
123122
return python
124123

125-
if "RETICULATE_PYTHON" in env:
126-
return os.path.expanduser(env["RETICULATE_PYTHON"])
127-
128124
return sys.executable
129125

130126

rsconnect/bundle.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,17 +1080,13 @@ def which_python(python, env=os.environ):
10801080
10811081
In priority order:
10821082
* --python specified on the command line
1083-
* RETICULATE_PYTHON defined in the environment
10841083
* the python binary running this script
10851084
"""
10861085
if python:
10871086
if not (exists(python) and os.access(python, os.X_OK)):
10881087
raise RSConnectException('The file, "%s", does not exist or is not executable.' % python)
10891088
return python
10901089

1091-
if "RETICULATE_PYTHON" in env:
1092-
return os.path.expanduser(env["RETICULATE_PYTHON"])
1093-
10941090
return sys.executable
10951091

10961092

0 commit comments

Comments
 (0)