Skip to content

Commit bf5719c

Browse files
committed
Initial commit
0 parents  commit bf5719c

File tree

21 files changed

+844
-0
lines changed

21 files changed

+844
-0
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
- package-ecosystem: "pip"
8+
directory: "/"
9+
schedule:
10+
interval: "weekly"

.github/workflows/binder-on-pr.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Reference https://mybinder.readthedocs.io/en/latest/howto/gh-actions-badges.html
2+
name: Binder Badge
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
7+
permissions:
8+
pull-requests: write
9+
10+
11+
jobs:
12+
binder:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: comment on PR with Binder link
16+
uses: actions/github-script@v3
17+
with:
18+
github-token: ${{secrets.GITHUB_TOKEN}}
19+
script: |
20+
var PR_HEAD_USERREPO = process.env.PR_HEAD_USERREPO;
21+
var PR_HEAD_REF = process.env.PR_HEAD_REF;
22+
github.issues.createComment({
23+
issue_number: context.issue.number,
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${PR_HEAD_USERREPO}/${PR_HEAD_REF}) :point_left: Launch a Binder on branch _${PR_HEAD_USERREPO}/${PR_HEAD_REF}_`
27+
})
28+
env:
29+
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
30+
PR_HEAD_USERREPO: ${{ github.event.pull_request.head.repo.full_name }}
31+

.github/workflows/build.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
schedule:
8+
- cron: "0 0 * * *"
9+
10+
defaults:
11+
run:
12+
shell: bash -eux {0}
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-latest, macos-latest, windows-latest]
21+
python-version: [ '3.8', '3.9', '3.10', "3.11" ]
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v2
26+
27+
- name: Base Setup
28+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
29+
30+
- name: Install dependencies
31+
run: python -m pip install -U jupyter_server
32+
33+
- name: Build the extension
34+
run: |
35+
python -m pip install .
36+
jupyter server extension list 2>&1 | grep -ie "jupyter_server_nbmodel.*OK"
37+
38+
pip install build
39+
python -m build --sdist
40+
cp dist/*.tar.gz my_server_extension.tar.gz
41+
pip uninstall -y "jupyter_server_nbmodel" jupyter_server
42+
rm -rf "jupyter_server_nbmodel"
43+
44+
- uses: actions/upload-artifact@v2
45+
with:
46+
name: my_server_extension-sdist
47+
path: my_server_extension.tar.gz
48+
49+
check_links:
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v2
53+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
54+
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
55+
56+
test_lint:
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v2
60+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
61+
- name: Run Linters
62+
run: |
63+
bash ./.github/workflows/lint.sh
64+
65+
check_release:
66+
runs-on: ubuntu-latest
67+
steps:
68+
- uses: actions/checkout@v2
69+
- name: Base Setup
70+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
71+
- name: Install Dependencies
72+
run: |
73+
pip install -e .
74+
- name: Check Release
75+
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
76+
with:
77+
token: ${{ secrets.GITHUB_TOKEN }}
78+
- name: Upload Distributions
79+
uses: actions/upload-artifact@v2
80+
with:
81+
name: jupyter_server_nbmodel-releaser-dist-${{ github.run_number }}
82+
path: .jupyter_releaser_checkout/dist
83+
84+
test_sdist:
85+
needs: build
86+
runs-on: ubuntu-latest
87+
88+
steps:
89+
- name: Checkout
90+
uses: actions/checkout@v2
91+
- name: Install Python
92+
uses: actions/setup-python@v2
93+
with:
94+
python-version: '3.8'
95+
architecture: 'x64'
96+
- uses: actions/download-artifact@v2
97+
with:
98+
name: my_server_extension-sdist
99+
- name: Install and Test
100+
run: |
101+
pip install my_server_extension.tar.gz
102+
pip install jupyter_server
103+
jupyter server extension list 2>&1 | grep -ie "jupyter_server_nbmodel.*OK"

.github/workflows/lint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
pip install -e ".[test,lint]"
3+
mypy --install-types --non-interactive .
4+
ruff .
5+
black --check --diff .
6+
mdformat --check *.md
7+
pipx run 'validate-pyproject[all]' pyproject.toml

.gitignore

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
*.egg-info/
2+
.ipynb_checkpoints
3+
4+
# Created by https://www.gitignore.io/api/python
5+
# Edit at https://www.gitignore.io/?templates=python
6+
7+
### Python ###
8+
# Byte-compiled / optimized / DLL files
9+
__pycache__/
10+
*.py[cod]
11+
*$py.class
12+
13+
# C extensions
14+
*.so
15+
16+
# Distribution / packaging
17+
.Python
18+
build/
19+
dist/
20+
downloads/
21+
lib/
22+
lib64/
23+
parts/
24+
sdist/
25+
var/
26+
wheels/
27+
pip-wheel-metadata/
28+
share/python-wheels/
29+
.installed.cfg
30+
31+
# PyInstaller
32+
# Usually these files are written by a python script from a template
33+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
34+
*.manifest
35+
*.spec
36+
37+
# Installer logs
38+
pip-log.txt
39+
pip-delete-this-directory.txt
40+
41+
# Unit test / coverage reports
42+
htmlcov/
43+
.tox/
44+
.nox/
45+
.coverage
46+
.coverage.*
47+
.cache
48+
nosetests.xml
49+
coverage.xml
50+
*.cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Scrapy stuff:
59+
.scrapy
60+
61+
# Sphinx documentation
62+
docs/_build/
63+
64+
# PyBuilder
65+
target/
66+
67+
# pyenv
68+
.python-version
69+
70+
# celery beat schedule file
71+
celerybeat-schedule
72+
73+
# SageMath parsed files
74+
*.sage.py
75+
76+
# Spyder project settings
77+
.spyderproject
78+
.spyproject
79+
80+
# Rope project settings
81+
.ropeproject
82+
83+
# Mr Developer
84+
.mr.developer.cfg
85+
.project
86+
.pydevproject
87+
88+
# mkdocs documentation
89+
/site
90+
91+
# mypy
92+
.mypy_cache/
93+
.dmypy.json
94+
dmypy.json
95+
96+
# Pyre type checker
97+
.pyre/
98+
99+
# End of https://www.gitignore.io/api/python
100+
101+
# OSX files
102+
.DS_Store

.pre-commit-config.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
ci:
2+
autoupdate_schedule: monthly
3+
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v4.4.0
7+
hooks:
8+
- id: end-of-file-fixer
9+
- id: check-case-conflict
10+
- id: check-executables-have-shebangs
11+
- id: requirements-txt-fixer
12+
- id: check-added-large-files
13+
- id: check-case-conflict
14+
- id: check-toml
15+
- id: check-yaml
16+
- id: debug-statements
17+
- id: forbid-new-submodules
18+
- id: check-builtin-literals
19+
- id: trailing-whitespace
20+
21+
- repo: https://github.com/python-jsonschema/check-jsonschema
22+
rev: 0.19.2
23+
hooks:
24+
- id: check-github-workflows
25+
26+
- repo: https://github.com/executablebooks/mdformat
27+
rev: 0.7.16
28+
hooks:
29+
- id: mdformat
30+
additional_dependencies:
31+
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote]
32+
33+
- repo: https://github.com/psf/black
34+
rev: 22.10.0
35+
hooks:
36+
- id: black
37+
38+
- repo: https://github.com/charliermarsh/ruff-pre-commit
39+
rev: v0.0.165
40+
hooks:
41+
- id: ruff
42+
args: ["--fix"]

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
<!-- <START NEW CHANGELOG ENTRY> -->
4+
5+
<!-- <END NEW CHANGELOG ENTRY> -->

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2024, Datalayer
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.

0 commit comments

Comments
 (0)