Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap structure for a widget examples repo #13

Merged
merged 22 commits into from
Mar 22, 2021
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 155 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: "*"

jobs:
build_extensions:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
example:
- hello-world
os: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Path filter
id: filter
uses: dorny/paths-filter@v2
with:
filters: |
extension:
- '${{ matrix.example }}/**'
- name: Cache lerna
if: steps.filter.outputs.extension == 'true'
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-lerna-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-lerna-
- name: Check config files
if: steps.filter.outputs.extension == 'true'
run: |
diff hello-world/tsconfig.json ${EXAMPLE_FOLDER}/tsconfig.json
diff hello-world/.eslintignore ${EXAMPLE_FOLDER}/.eslintignore
diff hello-world/.eslintrc.js ${EXAMPLE_FOLDER}/.eslintrc.js
diff hello-world/.gitignore ${EXAMPLE_FOLDER}/.gitignore
env:
EXAMPLE_FOLDER: ${{ matrix.example }}
shell: bash
- name: Install node
if: steps.filter.outputs.extension == 'true'
uses: actions/setup-node@v2
with:
node-version: "12.x"
- name: Install Python
if: steps.filter.outputs.extension == 'true'
uses: actions/setup-python@v2
with:
python-version: "3.7"
architecture: "x64"
- name: Get pip cache dir
if: steps.filter.outputs.extension == 'true'
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
shell: bash
- name: Cache pip
if: steps.filter.outputs.extension == 'true'
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/environment.yml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install the Python dependencies
if: steps.filter.outputs.extension == 'true'
run: |
python -m pip install --upgrade pip jupyter_packaging~=0.7.9 jupyterlab~=3.0
- name: Install the NPM dependencies
if: steps.filter.outputs.extension == 'true'
run: |
cd ${EXAMPLE_FOLDER}
yarn
env:
EXAMPLE_FOLDER: ${{ matrix.example }}
shell: bash
- name: Lint the files
if: steps.filter.outputs.extension == 'true'
run: |
cd ${EXAMPLE_FOLDER}
yarn run lint:check
env:
EXAMPLE_FOLDER: ${{ matrix.example }}
shell: bash
- name: Build and check by extension
if: steps.filter.outputs.extension == 'true'
run: |
cd ${EXAMPLE_FOLDER}
pip install -e .
jupyter labextension list 2>&1 | grep -ie "@jupyter-widget-examples/*.*OK"
python -m jupyterlab.browser_check
pip uninstall -y $(python setup.py --name)
env:
EXAMPLE_FOLDER: ${{ matrix.example }}
shell: bash

build_all:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache lerna
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-lerna-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-lerna-
- name: Install node
uses: actions/setup-node@v2
with:
node-version: "12.x"
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
architecture: "x64"
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
shell: bash
- name: Cache pip
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/environment.yml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install the Python dependencies
run: python -m pip install jupyter_packaging~=0.7.9 jupyterlab~=3.0 pytest pytest-check-links
- name: Bootstrap the dependencies
run: yarn
- name: Build all the extensions
run: |
yarn install-py
yarn build-ext
yarn lint:check
# Check links as last step as new tutorial may set links not yet valid (like file not yet in master)
# TODO: enable tests
# pytest --check-links
160 changes: 158 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,158 @@
*.ipynb_checkpoints
*.swp
.DS_Store
*.bundle.*
lib/
node_modules/
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo
__pycache__
_static

# Ensure embedme does not run on node_modules README.md files.
**/node_modules/**/README.md

static
labextension
nbextension

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask instance folder
instance/

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
docs/source/_static/embed-bundle.js
docs/source/_static/embed-bundle.js.map

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows
# =========================

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk
5 changes: 5 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}": [
"prettier --write"
]
}
9 changes: 9 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
dist
docs
**/node_modules
**/lib
**/package.json
**/labextension
**/nbextension
**/.pytest_cache
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2020, Project Jupyter 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:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* 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.

* 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.
Loading