This repository has been archived by the owner on Oct 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from jtpio/extension
Setup the JupyterLab extension
- Loading branch information
Showing
29 changed files
with
6,745 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules | ||
dist | ||
coverage | ||
**/*.d.ts | ||
tests | ||
replite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module.exports = { | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended' | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
sourceType: 'module' | ||
}, | ||
plugins: ['@typescript-eslint'], | ||
rules: { | ||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
{ | ||
'selector': 'interface', | ||
'format': ['PascalCase'], | ||
'custom': { | ||
'regex': '^I[A-Z]', | ||
'match': true | ||
} | ||
} | ||
], | ||
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }], | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-namespace': 'off', | ||
'@typescript-eslint/no-use-before-define': 'off', | ||
'@typescript-eslint/quotes': [ | ||
'error', | ||
'single', | ||
{ avoidEscape: true, allowTemplateLiterals: false } | ||
], | ||
curly: ['error', 'all'], | ||
eqeqeq: 'error', | ||
'prefer-arrow-callback': 'error' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: main | ||
pull_request: | ||
branches: '*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Base Setup | ||
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | ||
|
||
- name: Install dependencies | ||
run: python -m pip install -U jupyterlab~=3.1 check-manifest | ||
|
||
- name: Build the extension | ||
run: | | ||
set -eux | ||
jlpm | ||
jlpm run eslint:check | ||
python -m pip install . | ||
jupyter labextension list 2>&1 | grep -ie "replite.*OK" | ||
python -m jupyterlab.browser_check | ||
check-manifest -v | ||
pip install build | ||
python -m build --sdist | ||
cp dist/*.tar.gz myextension.tar.gz | ||
pip uninstall -y "replite" jupyterlab | ||
rm -rf myextension | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: myextension-sdist | ||
path: myextension.tar.gz | ||
|
||
test_isolated: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.8' | ||
architecture: 'x64' | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: myextension-sdist | ||
- name: Install and Test | ||
run: | | ||
set -eux | ||
# Remove NodeJS, twice to take care of system and locally installed node versions. | ||
sudo rm -rf $(which node) | ||
sudo rm -rf $(which node) | ||
pip install myextension.tar.gz | ||
pip install jupyterlab | ||
jupyter labextension list 2>&1 | grep -ie "replite.*OK" | ||
python -m jupyterlab.browser_check --no-chrome-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Check Release | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
check_release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
architecture: 'x64' | ||
- name: Install node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14.x' | ||
|
||
|
||
- name: Get pip cache dir | ||
id: pip-cache | ||
run: | | ||
echo "::set-output name=dir::$(pip cache dir)" | ||
- name: Cache pip | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.pip-cache.outputs.dir }} | ||
key: ${{ runner.os }}-pip-${{ hashFiles('package.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Cache checked links | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pytest-link-check | ||
key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/.md') }}-md-links | ||
restore-keys: | | ||
${{ runner.os }}-linkcheck- | ||
- name: Upgrade packaging dependencies | ||
run: | | ||
pip install --upgrade pip setuptools wheel jupyter-packaging~=0.10 --user | ||
- name: Install Dependencies | ||
run: | | ||
pip install . | ||
- name: Check Release | ||
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload Distributions | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: replite-releaser-dist-${{ github.run_number }} | ||
path: .jupyter_releaser_checkout/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
**/node_modules | ||
**/lib | ||
**/package.json | ||
replite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"arrowParens": "avoid" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Changelog | ||
|
||
<!-- <START NEW CHANGELOG ENTRY> --> | ||
|
||
<!-- <END NEW CHANGELOG ENTRY> --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2022, JupyterLite Contributors | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
include LICENSE | ||
include *.md | ||
include pyproject.toml | ||
|
||
include package.json | ||
include install.json | ||
include ts*.json | ||
include yarn.lock | ||
|
||
graft replite/labextension | ||
|
||
# Javascript files | ||
graft src | ||
graft style | ||
prune **/node_modules | ||
prune lib | ||
prune binder | ||
|
||
# Patterns to exclude from any directory | ||
global-exclude *~ | ||
global-exclude *.pyc | ||
global-exclude *.pyo | ||
global-exclude .git | ||
global-exclude .ipynb_checkpoints |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Making a new release of replite | ||
|
||
The extension can be published to `PyPI` and `npm` manually or using the [Jupyter Releaser](https://github.com/jupyter-server/jupyter_releaser). | ||
|
||
## Manual release | ||
|
||
### Python package | ||
|
||
This extension can be distributed as Python | ||
packages. All of the Python | ||
packaging instructions in the `pyproject.toml` file to wrap your extension in a | ||
Python package. Before generating a package, we first need to install `build`. | ||
|
||
```bash | ||
pip install build twine | ||
``` | ||
|
||
To create a Python source package (``.tar.gz``) and the binary package (`.whl`) in the `dist/` directory, do: | ||
|
||
```bash | ||
python -m build | ||
``` | ||
|
||
> `python setup.py sdist bdist_wheel` is deprecated and will not work for this package. | ||
Then to upload the package to PyPI, do: | ||
|
||
```bash | ||
twine upload dist/* | ||
``` | ||
|
||
### NPM package | ||
|
||
To publish the frontend part of the extension as a NPM package, do: | ||
|
||
```bash | ||
npm login | ||
npm publish --access public | ||
``` | ||
|
||
## Automated releases with the Jupyter Releaser | ||
|
||
The extension repository should already be compatible with the Jupyter Releaser. | ||
|
||
Check out the [workflow documentation](https://github.com/jupyter-server/jupyter_releaser#typical-workflow) for more information. | ||
|
||
Here is a summary of the steps to cut a new release: | ||
|
||
- Fork the [`jupyter-releaser` repo](https://github.com/jupyter-server/jupyter_releaser) | ||
- Add `ADMIN_GITHUB_TOKEN`, `PYPI_TOKEN` and `NPM_TOKEN` to the Github Secrets in the fork | ||
- Go to the Actions panel | ||
- Run the "Draft Changelog" workflow | ||
- Merge the Changelog PR | ||
- Run the "Draft Release" workflow | ||
- Run the "Publish Release" workflow | ||
|
||
## Publishing to `conda-forge` | ||
|
||
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 | ||
|
||
Otherwise a bot should pick up the new version publish to PyPI, and open a new PR on the feedstock repository automatically. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"packageManager": "python", | ||
"packageName": "replite", | ||
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package replite" | ||
} |
Oops, something went wrong.
b5bd220
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: