Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7ee9118

Browse filesBrowse files
committed
fix dev env var + add publish workflow
1 parent fe25c44 commit 7ee9118
Copy full SHA for 7ee9118

File tree

5 files changed

+45
-12
lines changed
Filter options

5 files changed

+45
-12
lines changed

‎.github/workflows/publish.yml

Copy file name to clipboard
+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This workflows will upload a Javscript Package using NPM to npmjs.org when a release is created
2+
# For more information see: https://docs.github.com/en/actions/guides/publishing-nodejs-packages
3+
4+
name: publish
5+
6+
on:
7+
release:
8+
types: [published]
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-node@v2
16+
with:
17+
node-version: 14
18+
- uses: actions/setup-python@v2
19+
with:
20+
python-version: "3.x"
21+
- run: pip install noxopt
22+
- run: nox -s publish
23+
env:
24+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
25+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

‎README.md

Copy file name to clipboardExpand all lines: README.md
+8-9Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,15 @@ For a development installation (requires [Node.js](https://nodejs.org) and [Yarn
9191
$ git clone https://github.com/reactive-python/reactpy-jupyter.git
9292
$ cd reactpy-jupyter
9393
$ pip install -e .
94-
$ jupyter nbextension install --py --symlink --overwrite --sys-prefix reactpy_jupyter
95-
$ jupyter nbextension enable --py --sys-prefix reactpy_jupyter
9694

97-
When actively developing your extension for JupyterLab, run the command:
95+
To automatically re-build and refresh Jupyter when making changes start a Vite dev server:
9896

99-
$ jupyter labextension develop --overwrite reactpy_jupyter
97+
$ npx vite
10098

101-
Then you need to rebuild the JS when you make a code change:
99+
Then, before importing `reactpy_jupyter` set the following environment variable:
102100

103-
$ cd js
104-
$ yarn run build
105-
106-
You then need to refresh the JupyterLab page when your javascript changes.
101+
```python
102+
import os
103+
os.environ["REACTPY_JUPYTER_DEV"] = "1"
104+
import reactpy_jupyter
105+
```

‎noxfile.py

Copy file name to clipboardExpand all lines: noxfile.py
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,10 @@ def check_python(session: Session) -> None:
2020
def check_javascript(session: Session) -> None:
2121
session.run("npm", "ci", external=True)
2222
session.run("npm", "run", "lint", external=True)
23+
24+
25+
@group.session
26+
def publish(session: Session) -> None:
27+
session.install("twine", "build", "wheel")
28+
session.run("python", "-m", "build", "--sdist", "--wheel", "--outdir", "dist/")
29+
session.run("twine", "upload", "dist/*")

‎reactpy_jupyter/__init__.py

Copy file name to clipboardExpand all lines: reactpy_jupyter/__init__.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from .ipython_extension import load_ipython_extension, unload_ipython_extension
1010
from .widget import LayoutWidget, run, set_import_source_base_url, widgetize
1111

12-
__version__ = "0.8.0" # DO NOT MODIFY
12+
__version__ = "0.8.1" # DO NOT MODIFY
1313

1414
__all__ = [
1515
"LayoutWidget",

‎reactpy_jupyter/widget.py

Copy file name to clipboardExpand all lines: reactpy_jupyter/widget.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import asyncio
4+
import os
45
from functools import wraps
56
from pathlib import Path
67
from queue import Queue as SyncQueue
@@ -11,13 +12,14 @@
1112
from IPython.display import DisplayHandle
1213
from IPython.display import display as ipython_display
1314
from jsonpointer import set_pointer
14-
from reactpy.config import REACTPY_DEBUG_MODE
1515
from reactpy.core.layout import Layout
1616
from reactpy.core.types import ComponentType
1717
from traitlets import Unicode
1818
from typing_extensions import ParamSpec
1919

20-
if REACTPY_DEBUG_MODE.current:
20+
DEV = bool(int(os.environ.get("REACTPY_JUPYTER_DEV", "0")))
21+
22+
if DEV:
2123
# from `npx vite`
2224
ESM = "http://localhost:5173/src/index.js?anywidget"
2325
else:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.