Skip to content

Commit

Permalink
Format with pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Nov 25, 2023
1 parent c316976 commit 2c47b21
Show file tree
Hide file tree
Showing 32 changed files with 319 additions and 248 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/binder-on-pr.yml
Expand Up @@ -7,7 +7,6 @@ on:
permissions:
pull-requests: write


jobs:
binder:
runs-on: ubuntu-latest
Expand All @@ -28,4 +27,3 @@ jobs:
env:
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
PR_HEAD_USERREPO: ${{ github.event.pull_request.head.repo.full_name }}

113 changes: 56 additions & 57 deletions .github/workflows/build.yml
Expand Up @@ -11,78 +11,77 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Install dependencies
run: python -m pip install -U "jupyterlab>=4.0.0,<5"
- name: Install dependencies
run: python -m pip install -U "jupyterlab>=4.0.0,<5"

- name: Lint the extension
run: |
set -eux
jlpm
jlpm run lint:check
- name: Lint the extension
run: |
set -eux
jlpm
jlpm run lint:check
- name: Build the extension
run: |
set -eux
python -m pip install .[test]
- name: Build the extension
run: |
set -eux
python -m pip install .[test]
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "jupyter_app_launcher.*OK"
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "jupyter_app_launcher.*OK"
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "jupyter_app_launcher.*OK"
python -m jupyterlab.browser_check
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "jupyter_app_launcher.*OK"
python -m jupyterlab.browser_check
- name: Package the extension
run: |
set -eux
- name: Package the extension
run: |
set -eux
pip install build
python -m build
pip uninstall -y "jupyter_app_launcher" jupyterlab
pip install build
python -m build
pip uninstall -y "jupyter_app_launcher" jupyterlab
- name: Upload extension packages
uses: actions/upload-artifact@v3
with:
name: extension-artifacts
path: dist/jupyter_app_launcher*
if-no-files-found: error
- name: Upload extension packages
uses: actions/upload-artifact@v3
with:
name: extension-artifacts
path: dist/jupyter_app_launcher*
if-no-files-found: error

test_isolated:
needs: build
runs-on: ubuntu-latest

steps:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
architecture: 'x64'
- uses: actions/download-artifact@v3
with:
name: extension-artifacts
- 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 "jupyterlab>=4.0.0,<5" jupyter_app_launcher*.whl
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "jupyter_app_launcher.*OK"
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "jupyter_app_launcher.*OK"
python -m jupyterlab.browser_check --no-browser-test
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
architecture: 'x64'
- uses: actions/download-artifact@v3
with:
name: extension-artifacts
- 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 "jupyterlab>=4.0.0,<5" jupyter_app_launcher*.whl
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "jupyter_app_launcher.*OK"
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "jupyter_app_launcher.*OK"
python -m jupyterlab.browser_check --no-browser-test
check_links:
name: Check Links
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/check-release.yml
@@ -1,9 +1,9 @@
name: Check Release
on:
push:
branches: ["main"]
branches: ['main']
pull_request:
branches: ["*"]
branches: ['*']

jobs:
check_release:
Expand All @@ -16,7 +16,6 @@ jobs:
- name: Check Release
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
with:

token: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Distributions
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Expand Up @@ -52,4 +52,4 @@ jobs:
uses: JamesIves/github-pages-deploy-action@4.1.3
with:
branch: gh-pages
folder: dist
folder: dist
16 changes: 8 additions & 8 deletions .github/workflows/prep-release.yml
@@ -1,22 +1,22 @@
name: "Step 1: Prep Release"
name: 'Step 1: Prep Release'
on:
workflow_dispatch:
inputs:
version_spec:
description: "New Version Specifier"
default: "next"
description: 'New Version Specifier'
default: 'next'
required: false
branch:
description: "The branch to target"
description: 'The branch to target'
required: false
post_version_spec:
description: "Post Version Specifier"
description: 'Post Version Specifier'
required: false
since:
description: "Use PRs with activity since this date or git reference"
description: 'Use PRs with activity since this date or git reference'
required: false
since_last_stable:
description: "Use PRs with activity since the last stable git tag"
description: 'Use PRs with activity since the last stable git tag'
required: false
type: boolean
jobs:
Expand All @@ -36,6 +36,6 @@ jobs:
since: ${{ github.event.inputs.since }}
since_last_stable: ${{ github.event.inputs.since_last_stable }}

- name: "** Next Step **"
- name: '** Next Step **'
run: |
echo "Optional): Review Draft Release: ${{ steps.prep-release.outputs.release_url }}"
12 changes: 6 additions & 6 deletions .github/workflows/publish-release.yml
@@ -1,15 +1,15 @@
name: "Step 2: Publish Release"
name: 'Step 2: Publish Release'
on:
workflow_dispatch:
inputs:
branch:
description: "The target branch"
description: 'The target branch'
required: false
release_url:
description: "The URL of the draft GitHub release"
description: 'The URL of the draft GitHub release'
required: false
steps_to_skip:
description: "Comma separated list of steps to skip"
description: 'Comma separated list of steps to skip'
required: false

jobs:
Expand Down Expand Up @@ -44,13 +44,13 @@ jobs:
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
release_url: ${{ steps.populate-release.outputs.release_url }}

- name: "** Next Step **"
- name: '** Next Step **'
if: ${{ success() }}
run: |
echo "Verify the final release"
echo ${{ steps.finalize-release.outputs.release_url }}
- name: "** Failure Message **"
- name: '** Failure Message **'
if: ${{ failure() }}
run: |
echo "Failed to Publish the Draft Release Url:"
Expand Down
53 changes: 53 additions & 0 deletions .pre-commit-config.yaml
@@ -0,0 +1,53 @@
ci:
# pre-commit.ci will open PRs updating our hooks once a month
autoupdate_schedule: monthly
# skip any check that needs internet access
autofix_prs: true

repos:
# Autoformat and linting, misc. details
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: forbid-new-submodules
- id: end-of-file-fixer
exclude: galata/.*-snapshots
- id: check-case-conflict
- id: requirements-txt-fixer
- id: check-added-large-files
args: ['--maxkb=5000']
- id: check-case-conflict
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: check-builtin-literals
- id: trailing-whitespace
exclude: .bumpversion.cfg

# Autoformat: Python code
- repo: https://github.com/psf/black
rev: 23.10.1
hooks:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.4
hooks:
- id: ruff
args: ['--fix']

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.54.0
hooks:
- id: eslint
files: \.tsx?$
types: [file]
additional_dependencies:
- 'eslint@8.36.0'
- '@typescript-eslint/eslint-plugin@6.1.0'
- '@typescript-eslint/parser@6.1.0'
2 changes: 1 addition & 1 deletion .yarnrc.yml
@@ -1,2 +1,2 @@
nodeLinker: node-modules
enableImmutableInstalls: false
enableImmutableInstalls: false
27 changes: 17 additions & 10 deletions binder/jupyter_app_launcher/jp_app_launcher_config.yaml
@@ -1,46 +1,46 @@
- title: Simply supported beam theory
description: Simply supported beam computation
source: ../../samples/beam.md
source: ../../samples/beam.md
cwd: ../../samples
type: markdown
catalog: Simply supported beam computation

- title: Simulation Dashboard
description: Simply supported beam computation
source: ../../samples/beam.ipynb
source: ../../samples/beam.ipynb
cwd: ../../samples
type: notebook-grid
catalog: Simply supported beam computation

- title: Simulation Notebook
description: Simply supported beam computation
source: ../../samples/beam.ipynb
source: ../../samples/beam.ipynb
cwd: ../../samples
type: notebook
catalog: Simply supported beam computation

- title: NVIDIA
description: Nvidia stock dashboard
source: ../../samples/stock.ipynb
source: ../../samples/stock.ipynb
cwd: ../../samples
type: notebook-grid
catalog: Stock dashboard

- title: Dashboard example
description: Example of opening a notebook in dashboard mode without Voila
source: ../../samples/sample.ipynb
source: ../../samples/sample.ipynb
cwd: ../../samples
type: notebook-grid

- title: Notebook example
description: Example of opening a notebook in dashboard mode without Voila
source: ../../samples/sample.ipynb
source: ../../samples/sample.ipynb
cwd: ../../samples
type: notebook

- title: Voila example
description: Example of opening a notebook in dashboard mode with Voila
source: ../../samples/sample.ipynb
source: ../../samples/sample.ipynb
cwd: ../../samples
type: notebook-voila
args:
Expand All @@ -51,15 +51,22 @@
source: https://jupyterlab.readthedocs.io/en/stable/
type: url
args:
sandbox: [ 'allow-same-origin', 'allow-scripts', 'allow-downloads', 'allow-modals', 'allow-popups']
sandbox:
[
'allow-same-origin',
'allow-scripts',
'allow-downloads',
'allow-modals',
'allow-popups'
]

- title: Markdown example
description: Example of opening a Markdown file in a tab
source: ../../samples/sample.md
source: ../../samples/sample.md
type: markdown

- title: Streamlit example
description: Example of opening a streamlit app
description: Example of opening a streamlit app
source: http://localhost:$PORT/
cwd: ./
type: local-server
Expand Down

0 comments on commit 2c47b21

Please sign in to comment.