Skip to content

Commit

Permalink
Merge pull request #9 from widgetti/solara-support
Browse files Browse the repository at this point in the history
feat: solara support
  • Loading branch information
maartenbreddels authored Oct 17, 2023
2 parents 5f696c8 + 76aea36 commit 2942087
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ jobs:
run: playwright install chromium

- name: Run ui-tests
env:
# do not run solara (yet)
SOLARA_TEST_RUNNERS: "jupyter_lab,jupyter_notebook,voila"
run: pytest tests/ui/ --video=retain-on-failure --solara-update-snapshots-ci -s

- name: Upload Test artifacts
Expand Down Expand Up @@ -128,4 +125,3 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload --skip-existing dist/*

11 changes: 11 additions & 0 deletions ipypopout/popout_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,20 @@
import traitlets
import ipywidgets
import ipyvuetify as v
import sys


def get_kernel_id():
if "solara" in sys.modules:
import solara
if solara._using_solara_server():
try:
import solara.server.kernel_context

context = solara.server.kernel_context.get_current_context()
return context.id
except RuntimeError:
pass
ipython = IPython.get_ipython()
if not ipython or not hasattr(ipython, 'kernel'):
return ''
Expand Down
3 changes: 3 additions & 0 deletions ipypopout/popout_button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ module.exports = {
},
computed: {
popoutPageUrl() {
if (window.solara && (solara.rootPath !== undefined)) {
return solara.rootPath;
}
return 'voila/templates/ipypopout/static/popout.html'
}
}
Expand Down
7 changes: 7 additions & 0 deletions tests/ui/popout_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,11 @@ def kernel_code():
new_page.locator("text=Test ipypopout").wait_for()
# the button should not be on the page
new_page.locator("_vue=v-btn").wait_for(state="detached")
# if we do not go to a blank page, on solara, the server will not get the close beacon
# and the kernel will not shut down
new_page.goto("about:blank")
# wait for the kernel to shut down, if we close the page to early
# it seem again the server will not get the close beacon
# and solara's test framework fails
new_page.wait_for_timeout(1000)
new_page.close()

0 comments on commit 2942087

Please sign in to comment.