Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,17 @@ jobs:
uv pip install ".[dev]"
uv pip install --upgrade git+https://github.com/rstudio/vetiver-python@${{ github.sha }}
echo {{ github.sha }}
- name: run Connect
run: |
docker compose up --build -d
pip freeze > requirements.txt
make dev
cat requirements.txt
env:
RSC_LICENSE: ${{ secrets.RSC_LICENSE }}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

# NOTE: edited to run checks for python package
- name: Run tests
run: |
pytest vetiver -m 'rsc_test'
- name: Run Connect integration tests
uses: posit-dev/with-connect@0783dabdd24e360e985a4588ce1239c3dc31c542
with:
license: ${{ secrets.RSC_LICENSE }}
# Plain freeze (unlike the Makefile/weekly jobs, which filter): here
# vetiver is installed from git+...@<sha>, so the freeze yields an
# installable git URL and Connect deploys THIS PR's vetiver. Filtering
# would deploy released vetiver and miss PR-level serving regressions.
command: |
pip freeze > requirements.txt
pytest vetiver/tests/test_rsconnect.py -m 'rsc_test'

test-docker:
name: "Test Docker"
Expand Down
82 changes: 42 additions & 40 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ jobs:
python -m pip install '.[all]'
python -m pip install --upgrade git+https://github.com/rstudio/pins-python

- name: run Connect
run: |
docker compose up --build -d
make dev
env:
RSC_LICENSE: ${{ secrets.RSC_LICENSE }}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Run tests
run: |
make test
Expand Down Expand Up @@ -84,14 +76,6 @@ jobs:
python -m pip install .[dev]
python -m pip install --upgrade git+https://github.com/rstudio/pins-python

- name: run Connect
run: |
docker compose up --build -d
make dev
env:
RSC_LICENSE: ${{ secrets.RSC_LICENSE }}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Run Tests
run: |
make test
Expand Down Expand Up @@ -129,19 +113,28 @@ jobs:
python -m pip install --upgrade pip
python -m pip install .[dev]
python -m pip install --upgrade git+https://github.com/rstudio/rsconnect-python
pip freeze > requirements.txt

- name: run Connect
run: |
docker compose up --build -d
make dev
env:
RSC_LICENSE: ${{ secrets.RSC_LICENSE }}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Run Tests
run: |
pytest -m 'rsc_test'
- name: Run Connect integration tests
uses: posit-dev/with-connect@0783dabdd24e360e985a4588ce1239c3dc31c542
with:
license: ${{ secrets.RSC_LICENSE }}
command: |
pip freeze | grep -v '^vetiver' | grep -v '^-e ' > requirements.txt
echo 'vetiver' >> requirements.txt
pytest vetiver/tests/test_rsconnect.py -m 'rsc_test'

- name: Open issue on failure
if: failure() && github.event_name == 'schedule'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Weekly canary failed: ${context.job}`,
body: `The weekly Connect canary failed on run ${context.runId}. This often means a change in rsconnect-python \`main\` broke vetiver. See https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
labels: ["ci-failure"]
})

vetiver_latest_rsconnect_latest:
name: 'vetiver latest, rsconnect latest'
Expand All @@ -164,16 +157,25 @@ jobs:
python -m pip install --upgrade pip
python -m pip install '.[all]'
python -m pip install --upgrade git+https://github.com/rstudio/rsconnect-python
pip freeze > requirements.txt

- name: run Connect
run: |
docker compose up --build -d
make dev
env:
RSC_LICENSE: ${{ secrets.RSC_LICENSE }}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Run Tests
run: |
pytest -m 'rsc_test'
- name: Run Connect integration tests
uses: posit-dev/with-connect@0783dabdd24e360e985a4588ce1239c3dc31c542
with:
license: ${{ secrets.RSC_LICENSE }}
command: |
pip freeze | grep -v '^vetiver' | grep -v '^-e ' > requirements.txt
echo 'vetiver' >> requirements.txt
pytest vetiver/tests/test_rsconnect.py -m 'rsc_test'

- name: Open issue on failure
if: failure() && github.event_name == 'schedule'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Weekly canary failed: ${context.job}`,
body: `The weekly Connect canary failed on run ${context.runId}. This often means a change in rsconnect-python \`main\` broke vetiver. See https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
labels: ["ci-failure"]
})
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,6 @@ NOTES.md
/.quarto/

/.luarc.json

# Local Connect license for with-connect integration tests
rstudio-connect.lic
25 changes: 4 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
.PHONY: clean-pyc clean-build clean docs
UNAME := $(shell uname)

RSC_API_KEYS=vetiver/tests/rsconnect_api_keys.json

ifeq ($(UNAME), Darwin)
BROWSER := open
else
Expand All @@ -19,9 +17,6 @@ help:
@echo "coverage - check code coverage quickly with the default Python"
@echo "docs - generate HTML documentation, including API docs"
@echo "release - package and upload a release"
@echo "dev - generate Connect API keys"
@echo "dev-start - start up development Connect in Docker"
@echo "dev-stop - stop Connect dev container"

clean: clean-build clean-pyc clean-test

Expand All @@ -47,7 +42,10 @@ test-pdb: clean-test
pytest -m 'not rsc_test and not docker' --pdb

test-rsc: clean-test
pytest
uv run pip freeze | grep -v '^vetiver' | grep -v '^-e ' > requirements.txt
echo 'vetiver' >> requirements.txt
uvx --from git+https://github.com/posit-dev/with-connect@0783dabdd24e360e985a4588ce1239c3dc31c542 \
with-connect -- uv run --with pytest pytest vetiver/tests/test_rsconnect.py -m 'rsc_test'

coverage:
coverage report -m
Expand All @@ -60,21 +58,6 @@ docs doc documentation:
release: dist
twine upload dist/*

dev: vetiver/tests/rsconnect_api_keys.json

dev-start:
docker compose up -d
docker compose exec -T rsconnect bash < script/setup-rsconnect/add-users.sh
# curl fails with error 52 without a short sleep....
sleep 5
curl -s --retry 10 --retry-connrefused http://localhost:3939

dev-stop:
docker compose down
rm -f $(RSC_API_KEYS)

typecheck:
pyright

$(RSC_API_KEYS): dev-start
python script/setup-rsconnect/dump_api_keys.py $@
15 changes: 0 additions & 15 deletions docker-compose.yml

This file was deleted.

1 change: 0 additions & 1 deletion script/setup-rsconnect/add-users.sh

This file was deleted.

21 changes: 0 additions & 21 deletions script/setup-rsconnect/dump_api_keys.py

This file was deleted.

22 changes: 0 additions & 22 deletions script/setup-rsconnect/rstudio-connect.gcfg

This file was deleted.

4 changes: 0 additions & 4 deletions script/setup-rsconnect/users.txt

This file was deleted.

3 changes: 2 additions & 1 deletion vetiver/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,9 @@ def predict(endpoint, data: Union[dict, pd.DataFrame, pd.Series], **kw) -> pd.Da
# TO DO: dispatch

if isinstance(data, pd.DataFrame):
headers = {"Content-Type": "application/json", **kw.pop("headers", {})}
response = requester.post(
endpoint, data=data.to_json(orient="records"), **kw
endpoint, data=data.to_json(orient="records"), headers=headers, **kw
) # TO DO: httpx deprecating data in favor of content for TestClient
elif isinstance(data, pd.Series):
response = requester.post(endpoint, json=[data.to_dict()], **kw)
Expand Down
1 change: 0 additions & 1 deletion vetiver/tests/rsconnect_api_keys.json

This file was deleted.

Loading
Loading