├── .github └── workflows │ └── build.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── RELEASE.md ├── deploy.sh ├── favicon.ico ├── jupyter-lite.json ├── jupyter_lite_config.json └── requirements-deploy.txt /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches: main 6 | pull_request: 7 | branches: '*' 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v2 15 | 16 | - name: Base Setup 17 | uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 18 | 19 | - name: Install dependencies 20 | run: python -m pip install -U jupyterlab~=3.1 check-manifest 21 | 22 | - name: Build the extension 23 | run: | 24 | set -eux 25 | jlpm 26 | jlpm run eslint:check 27 | python -m pip install . 28 | 29 | jupyter labextension list 2>&1 | grep -ie "replite.*OK" 30 | python -m jupyterlab.browser_check 31 | 32 | check-manifest -v 33 | 34 | pip install build 35 | python -m build --sdist 36 | cp dist/*.tar.gz myextension.tar.gz 37 | pip uninstall -y "replite" jupyterlab 38 | rm -rf myextension 39 | 40 | - uses: actions/upload-artifact@v2 41 | with: 42 | name: myextension-sdist 43 | path: myextension.tar.gz 44 | 45 | test_isolated: 46 | needs: build 47 | runs-on: ubuntu-latest 48 | 49 | steps: 50 | - name: Checkout 51 | uses: actions/checkout@v2 52 | - name: Install Python 53 | uses: actions/setup-python@v2 54 | with: 55 | python-version: '3.8' 56 | architecture: 'x64' 57 | - uses: actions/download-artifact@v2 58 | with: 59 | name: myextension-sdist 60 | - name: Install and Test 61 | run: | 62 | set -eux 63 | # Remove NodeJS, twice to take care of system and locally installed node versions. 64 | sudo rm -rf $(which node) 65 | sudo rm -rf $(which node) 66 | pip install myextension.tar.gz 67 | pip install jupyterlab 68 | jupyter labextension list 2>&1 | grep -ie "replite.*OK" 69 | python -m jupyterlab.browser_check --no-chrome-test 70 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | MANIFEST 2 | build 3 | dist 4 | lib 5 | 6 | node_modules 7 | .cache 8 | *.py[co] 9 | .pytest_cache 10 | __pycache__ 11 | *.egg-info 12 | *~ 13 | *.bak 14 | .ipynb_checkpoints 15 | .DS_Store 16 | \#*# 17 | .#* 18 | 19 | *.swp 20 | *.map 21 | 22 | coverage/ 23 | tests/**/coverage 24 | tests/**/.cache-loader 25 | docs/_build 26 | docs/api 27 | docs/source/_build 28 | 29 | lerna-debug.log 30 | yarn-error.log 31 | 32 | junit.xml 33 | 34 | *.tsbuildinfo 35 | 36 | # jetbrains IDE stuff 37 | *.iml 38 | .idea/ 39 | 40 | # ms IDE stuff 41 | *.code-workspace 42 | .history 43 | .vscode 44 | 45 | test.ipynb 46 | replite/labextension 47 | 48 | *.doit.db 49 | _output -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | 5 | ## 0.1.1 6 | 7 | ([Full Changelog](https://github.com/jtpio/replite/compare/first-commit...923b5948053e9434ab0ac447020d82f84923e215)) 8 | 9 | ### Enhancements made 10 | 11 | - Fix some 404s in the dev tools console [#16](https://github.com/jtpio/replite/pull/16) ([@jtpio](https://github.com/jtpio)) 12 | - Disable `jupyterlab-plotly` (widgets) plugin [#15](https://github.com/jtpio/replite/pull/15) ([@jtpio](https://github.com/jtpio)) 13 | - Tweak CSS for smaller viewports [#14](https://github.com/jtpio/replite/pull/14) ([@jtpio](https://github.com/jtpio)) 14 | - Inject code directly [#11](https://github.com/jtpio/replite/pull/11) ([@jtpio](https://github.com/jtpio)) 15 | - Add optional toolbar buttons [#9](https://github.com/jtpio/replite/pull/9) ([@jtpio](https://github.com/jtpio)) 16 | - Setup the JupyterLab extension [#6](https://github.com/jtpio/replite/pull/6) ([@jtpio](https://github.com/jtpio)) 17 | 18 | ### Bugs fixed 19 | 20 | - Fix banner color [#7](https://github.com/jtpio/replite/pull/7) ([@jtpio](https://github.com/jtpio)) 21 | 22 | ### Other merged PRs 23 | 24 | - Update to replite [#5](https://github.com/jtpio/replite/pull/5) ([@jtpio](https://github.com/jtpio)) 25 | - Fix output prompts [#4](https://github.com/jtpio/replite/pull/4) ([@jtpio](https://github.com/jtpio)) 26 | - Add Plotly, JupyterLab renderers and more [#3](https://github.com/jtpio/replite/pull/3) ([@jtpio](https://github.com/jtpio)) 27 | 28 | ### Contributors to this release 29 | 30 | ([GitHub contributors page for this release](https://github.com/jtpio/replite/graphs/contributors?from=2022-02-01&to=2022-02-03&type=c)) 31 | 32 | [@jtpio](https://github.com/search?q=repo%3Ajtpio%2Freplite+involves%3Ajtpio+updated%3A2022-02-01..2022-02-03&type=Issues) | [@vercel](https://github.com/search?q=repo%3Ajtpio%2Freplite+involves%3Avercel+updated%3A2022-02-01..2022-02-03&type=Issues) 33 | 34 | 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2022, JupyterLite Contributors 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # replite 2 | 3 | ## ⚠️ Archived ⚠️ 4 | 5 | [JupyterLite](https://jupyterlite.readthedocs.io/en/latest/) now includes a REPL application by default. 6 | 7 | Check out the documentation to learn how to use it and configure it: https://jupyterlite.readthedocs.io/en/latest/quickstart/embed-repl.html 8 | 9 | --- 10 | 11 | An embeddable REPL, powered by JupyterLite. 12 | 13 | ![replite-numpy](https://user-images.githubusercontent.com/591645/151983925-6e5dcc1e-b9be-4f1a-91bc-330579103e78.png) 14 | 15 | ## Usage 16 | 17 | To embed the code console in your website: 18 | 19 | ```html 20 | 22 | ``` 23 | 24 | ## Configuration 25 | 26 | The behavior and the look of the REPL can be configured via URL parameters. 27 | 28 | ### Select a kernel by default 29 | 30 | To avoid the kernel selection dialog and choose a given kernel by default: 31 | 32 | ```html 33 | 35 | ``` 36 | 37 | ### Enable the toolbar 38 | 39 | The toolbar can be enabled (opt-in) to add a couple of useful buttons: 40 | 41 | ```html 42 | 44 | ``` 45 | 46 | ![toolbar](https://user-images.githubusercontent.com/591645/152152632-af6b7020-1dc4-450b-b9c8-1d320e6fd5a5.png) 47 | 48 | ### Auto execute code on startup 49 | 50 | Custom starter code can automatically be executed on startup: 51 | 52 | ```html 53 | 55 | ``` 56 | 57 | https://user-images.githubusercontent.com/591645/152204519-7980e9f6-ef56-4263-bb79-4fcf3e4fd2be.mp4 58 | 59 | ### Themes 60 | 61 | It is also possible to select a theme, for example `JupyterLab Dark`: 62 | 63 | ```html 64 | 66 | ``` 67 | 68 | Additional themes can be installed with `pip` if they are distributed as a JupyterLab prebuilt extension. For example: 69 | 70 | ```bash 71 | pip install jupyterlab-gt-coar-theme 72 | ``` 73 | 74 | https://user-images.githubusercontent.com/591645/152374795-7b415c03-2f7b-43a1-952e-a4406ccb6c5b.mp4 75 | 76 | ## Create your custom deployment 77 | 78 | TBD 79 | -------------------------------------------------------------------------------- /RELEASE.md: -------------------------------------------------------------------------------- 1 | # Making a new release of replite 2 | 3 | The extension can be published to `PyPI` and `npm` manually or using the [Jupyter Releaser](https://github.com/jupyter-server/jupyter_releaser). 4 | 5 | ## Manual release 6 | 7 | ### Python package 8 | 9 | This extension can be distributed as Python 10 | packages. All of the Python 11 | packaging instructions in the `pyproject.toml` file to wrap your extension in a 12 | Python package. Before generating a package, we first need to install `build`. 13 | 14 | ```bash 15 | pip install build twine 16 | ``` 17 | 18 | To create a Python source package (``.tar.gz``) and the binary package (`.whl`) in the `dist/` directory, do: 19 | 20 | ```bash 21 | python -m build 22 | ``` 23 | 24 | > `python setup.py sdist bdist_wheel` is deprecated and will not work for this package. 25 | 26 | Then to upload the package to PyPI, do: 27 | 28 | ```bash 29 | twine upload dist/* 30 | ``` 31 | 32 | ### NPM package 33 | 34 | To publish the frontend part of the extension as a NPM package, do: 35 | 36 | ```bash 37 | npm login 38 | npm publish --access public 39 | ``` 40 | 41 | ## Automated releases with the Jupyter Releaser 42 | 43 | The extension repository should already be compatible with the Jupyter Releaser. 44 | 45 | Check out the [workflow documentation](https://github.com/jupyter-server/jupyter_releaser#typical-workflow) for more information. 46 | 47 | Here is a summary of the steps to cut a new release: 48 | 49 | - Fork the [`jupyter-releaser` repo](https://github.com/jupyter-server/jupyter_releaser) 50 | - Add `ADMIN_GITHUB_TOKEN`, `PYPI_TOKEN` and `NPM_TOKEN` to the Github Secrets in the fork 51 | - Go to the Actions panel 52 | - Run the "Draft Changelog" workflow 53 | - Merge the Changelog PR 54 | - Run the "Draft Release" workflow 55 | - Run the "Publish Release" workflow 56 | 57 | ## Publishing to `conda-forge` 58 | 59 | If the package is not on conda forge yet, check the documentation to learn how to add it: https://conda-forge.org/docs/maintainer/adding_pkgs.html 60 | 61 | Otherwise a bot should pick up the new version publish to PyPI, and open a new PR on the feedstock repository automatically. 62 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # small script to deploy to Vercel 4 | set -xeu 5 | 6 | # bootstrap the environment 7 | yum install tar wget || true 8 | 9 | export MAMBA_VERSION=0.21.0 10 | URL="https://anaconda.org/conda-forge/micromamba/${MAMBA_VERSION}/download/linux-64/micromamba-${MAMBA_VERSION}-0.tar.bz2" 11 | wget -qO- ${URL} | tar -xvj bin/micromamba 12 | 13 | ./bin/micromamba shell init --shell=bash -p ~/micromamba 14 | 15 | source ~/.bashrc 16 | 17 | micromamba activate 18 | micromamba install python=3.10 -c conda-forge -y 19 | 20 | # install dependencies 21 | python -m pip install -r requirements-deploy.txt 22 | 23 | # populate placeholder content to avoid 404s errors in the dev tools console when fetching all.json 24 | mkdir contents 25 | cp README.md contents 26 | 27 | export LITE_OUTPUT_DIR=_output 28 | # build the JupyterLite site 29 | jupyter lite --version 30 | jupyter lite build --contents contents --output-dir ${LITE_OUTPUT_DIR} 31 | 32 | # add favicon 33 | cp favicon.ico ${LITE_OUTPUT_DIR} -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtpio/replite/bd50129b260415ac40a6287fd65aa0fcdf36e98f/favicon.ico -------------------------------------------------------------------------------- /jupyter-lite.json: -------------------------------------------------------------------------------- 1 | { 2 | "jupyter-lite-schema-version": 0, 3 | "jupyter-config-data": { 4 | "appName": "REPLite", 5 | "appUrl": "./repl", 6 | "disabledExtensions": [ 7 | "@jupyter-widgets/jupyterlab-manager", 8 | "@jupyterlite/javascript-kernel-extension", 9 | "jupyterlab-plotly" 10 | ], 11 | "faviconUrl": "./lab/favicon.ico" 12 | } 13 | } -------------------------------------------------------------------------------- /jupyter_lite_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "LiteBuildConfig": { 3 | "apps": ["repl"], 4 | "no_unused_shared_packages": true, 5 | "no_sourcemaps": true 6 | } 7 | } -------------------------------------------------------------------------------- /requirements-deploy.txt: -------------------------------------------------------------------------------- 1 | ipywidgets~=7.6 2 | jupyterlab~=3.2.9 3 | jupyterlite==0.1.0b0 4 | jupyterlab-fasta>=3,<4 5 | jupyterlab-geojson>=3,<4 6 | plotly>=5,<6 7 | --------------------------------------------------------------------------------