Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #340 from rstudio/mm-voila
Browse files Browse the repository at this point in the history
Voila mode
  • Loading branch information
mmarchetti authored Mar 7, 2023
2 parents b0abbec + 73e517d commit 5a41249
Show file tree
Hide file tree
Showing 21 changed files with 145 additions and 1,599 deletions.
2 changes: 0 additions & 2 deletions .dockerignore

This file was deleted.

29 changes: 21 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,21 @@ jobs:
- run: echo "PYTHONPATH=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
- run: make prereqs
- run: make version
- run: make install
- run: make lint
- run: make test
lint:
runs-on: ubuntu-latest
name: Lint
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
- uses: actions/setup-python@v2
with:
python-version: 3.8
- run: echo "PYTHONPATH=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
- run: make prereqs
- run: make version
- run: make yarn
- run: make lint
selenium:
runs-on: ubuntu-latest
steps:
Expand All @@ -52,6 +64,11 @@ jobs:
- run: make -C selenium test-env-up
- run: make -C selenium jupyter-up
- run: make -C selenium test
- uses: actions/upload-artifact@v3
if: failure()
with:
name: selenium-logs
path: '**/*.log'
distributions:
needs: test
runs-on: ubuntu-latest
Expand All @@ -63,18 +80,14 @@ jobs:
python-version: 3.8.x
- run: echo "PYTHONPATH=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
- run: make prereqs
- run: pipenv clean
- run: pipenv install --skip-lock --dev
- run: pipenv run pip install -U 'SecretStorage>=3'
- run: git reset --hard HEAD
- run: make dist
id: create_dist
- uses: actions/upload-artifact@v2
with:
name: distributions
path: dist/
- run: pipenv run pip install -vvv ${{ steps.create_dist.outputs.whl }}
- run: pipenv run python -c 'import rsconnect_jupyter;print(rsconnect_jupyter.__version__)'
- run: pip install -vvv ${{ steps.create_dist.outputs.whl }}
- run: python -c 'import rsconnect_jupyter;print(rsconnect_jupyter.__version__)'
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
id: create_release
uses: actions/create-release@v1
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,11 @@ jobs:
with:
fetch-depth: 0

- name: Install pipenv
run: |
python -m pip install --upgrade pipenv
- name: Install Pipfile dependencies (as required by Snyk)
run: pipenv install

- name: Run Snyk
uses: snyk/actions/python@master
with:
command: monitor
args: --file=Pipfile --project-name=python --org=${{ env.SNYK_ORG }}
args: --file=requirements-dev.txt --project-name=python --org=${{ env.SNYK_ORG }}
ui:
runs-on: ubuntu-latest
steps:
Expand Down
13 changes: 5 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@ RUN useradd --password password \
chown ${NB_UID}:${NB_GID} /rsconnect_jupyter

USER ${NB_UID}:${NB_GID}
WORKDIR /rsconnect_jupyter
ENV WORKON_HOME=/home/builder \
PIPENV_DONT_LOAD_ENV=1 \
PIPENV_SHELL=/bin/bash \
PATH=/home/builder/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
PYTHONPATH=/rsconnect_jupyter
COPY Pipfile Pipfile
COPY Pipfile.lock Pipfile.lock
RUN python -m pip install -I -U pip pipenv && \
pipenv install --dev --python=/usr/local/bin/python && \
rm -vf Pipfile*
COPY requirements.txt .
COPY requirements-dev.txt .
RUN /usr/local/bin/python -m pip install -I -U pip && \
/usr/local/bin/python -m pip install -r requirements-dev.txt
WORKDIR /rsconnect_jupyter
47 changes: 17 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ IMAGE := rstudio/rsconnect-jupyter-py
NOTEBOOKS_DIR := /notebooks
PORT := $(shell printenv PORT || echo 9999)
S3_PREFIX := s3://rstudio-connect-downloads/connect/rsconnect-jupyter
VERSION := $(shell pipenv run python setup.py --version 2>/dev/null || echo 'NOTSET')
VERSION := $(shell python setup.py --version 2>/dev/null || echo 'NOTSET')

BDIST_WHEEL := dist/rsconnect_jupyter-$(VERSION)-py2.py3-none-any.whl
JUPYTER_LOG_LEVEL ?= INFO
Expand All @@ -17,16 +17,14 @@ export SOURCE_DATE_EPOCH
PYTHONPATH ?= $(CURDIR)
export PYTHONPATH


.PHONY: prereqs
prereqs:
pip install -U pip
pip install -U pipenv

pip install -r requirements-dev.txt

.PHONY: install-latest-rsconnect-python
install-latest-rsconnect-python:
pipenv run pip install -U https://cdn.rstudio.com/connect/rsconnect-python/latest/rsconnect_python-latest-py2.py3-none-any.whl
pip install -U https://cdn.rstudio.com/connect/rsconnect-python/latest/rsconnect_python-latest-py2.py3-none-any.whl

.PHONY: clean
clean:
Expand All @@ -45,12 +43,8 @@ image%:
--build-arg PY_VERSION=$* \
.

.PHONY: all-tests
all-tests: test3.7 test3.8 test3.9 test3.10 test3.11

.PHONY: test
test: version-frontend
pipenv run pytest -vv --cov=rsconnect_jupyter tests/
pytest -vv --cov=rsconnect_jupyter tests/

.PHONY: test-selenium
test-selenium:
Expand All @@ -64,36 +58,29 @@ test-selenium:
# exported as a point of reference instead.
.PHONY: dist
dist: version-frontend
pipenv run python setup.py bdist_wheel
pipenv run twine check $(BDIST_WHEEL)
rm -vf dist/*.whl
python setup.py bdist_wheel
twine check $(BDIST_WHEEL)
rm -vf dist/*.egg
@echo "::set-output name=whl::$(BDIST_WHEEL)"
@echo "::set-output name=whl_basename::$(notdir $(BDIST_WHEEL))"

.PHONY: run
run: install
mkdir -p $(NOTEBOOKS_DIR)
pipenv run jupyter notebook \
jupyter notebook \
-y \
--log-level=$(JUPYTER_LOG_LEVEL) \
--notebook-dir=$(NOTEBOOKS_DIR) \
--notebook-dir=./notebooks3 \
--ip='0.0.0.0' \
--port=9999 \
--no-browser \
--NotebookApp.token=''

.PHONY: run-local
run-local: NOTEBOOKS_DIR := $(CURDIR)/notebooks3.8
run-local: run

.PHONY: install
install: yarn
pipenv install --dev
$(MAKE) install-latest-rsconnect-python
$(MAKE) version-frontend
pipenv run jupyter nbextension install --symlink --user --py rsconnect_jupyter
pipenv run jupyter nbextension enable --py rsconnect_jupyter
pipenv run jupyter serverextension enable --py rsconnect_jupyter
install: version-frontend
jupyter nbextension uninstall rsconnect_jupyter || true
jupyter nbextension install --symlink --user --py rsconnect_jupyter
jupyter nbextension enable --py rsconnect_jupyter
jupyter serverextension enable --py rsconnect_jupyter

build/mock-connect/bin/flask:
bash -c '\
Expand Down Expand Up @@ -121,12 +108,12 @@ lint-js:

.PHONY: lint-py
lint-py:
pipenv run black --check --diff ./rsconnect_jupyter
pipenv run flake8 ./rsconnect_jupyter
black --check --diff ./rsconnect_jupyter
flake8 ./rsconnect_jupyter

.PHONY: fmt
fmt:
pipenv run black ./rsconnect_jupyter
black ./rsconnect_jupyter

## Specify that Docker runs with the calling user's uid/gid to avoid file
## permission issues on Linux dev hosts.
Expand Down
35 changes: 0 additions & 35 deletions Pipfile

This file was deleted.

Loading

0 comments on commit 5a41249

Please sign in to comment.