-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit aef1fe6
Showing
17 changed files
with
620 additions
and
0 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,10 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
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,103 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
defaults: | ||
run: | ||
shell: bash -eux {0} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python-version: [ '3.8', '3.9', '3.10', "3.11" ] | ||
|
||
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 jupyter_server | ||
|
||
- name: Build the extension | ||
run: | | ||
python -m pip install . | ||
jupyter server extension list 2>&1 | grep -ie "jupyter_nbmodel_client.*OK" | ||
pip install build | ||
python -m build --sdist | ||
cp dist/*.tar.gz my_server_extension.tar.gz | ||
pip uninstall -y "jupyter_nbmodel_client" jupyter_server | ||
rm -rf "jupyter_nbmodel_client" | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: my_server_extension-sdist | ||
path: my_server_extension.tar.gz | ||
|
||
check_links: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | ||
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1 | ||
|
||
test_lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | ||
- name: Run Linters | ||
run: | | ||
bash ./.github/workflows/lint.sh | ||
check_release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Base Setup | ||
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | ||
- name: Install Dependencies | ||
run: | | ||
pip install -e . | ||
- name: Check Release | ||
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload Distributions | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: jupyter_nbmodel_client-releaser-dist-${{ github.run_number }} | ||
path: .jupyter_releaser_checkout/dist | ||
|
||
test_sdist: | ||
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: my_server_extension-sdist | ||
- name: Install and Test | ||
run: | | ||
pip install my_server_extension.tar.gz | ||
pip install jupyter_server | ||
jupyter server extension list 2>&1 | grep -ie "jupyter_nbmodel_client.*OK" |
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,7 @@ | ||
#!/usr/bin/env bash | ||
pip install -e ".[test,lint]" | ||
mypy --install-types --non-interactive . | ||
ruff . | ||
black --check --diff . | ||
mdformat --check *.md | ||
pipx run 'validate-pyproject[all]' pyproject.toml |
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,102 @@ | ||
*.egg-info/ | ||
.ipynb_checkpoints | ||
|
||
# Created by https://www.gitignore.io/api/python | ||
# Edit at https://www.gitignore.io/?templates=python | ||
|
||
### Python ### | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
dist/ | ||
downloads/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
.installed.cfg | ||
|
||
# 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/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# Mr Developer | ||
.mr.developer.cfg | ||
.project | ||
.pydevproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# End of https://www.gitignore.io/api/python | ||
|
||
# OSX files | ||
.DS_Store |
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,42 @@ | ||
ci: | ||
autoupdate_schedule: monthly | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: check-case-conflict | ||
- id: check-executables-have-shebangs | ||
- id: requirements-txt-fixer | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: forbid-new-submodules | ||
- id: check-builtin-literals | ||
- id: trailing-whitespace | ||
|
||
- repo: https://github.com/python-jsonschema/check-jsonschema | ||
rev: 0.19.2 | ||
hooks: | ||
- id: check-github-workflows | ||
|
||
- repo: https://github.com/executablebooks/mdformat | ||
rev: 0.7.16 | ||
hooks: | ||
- id: mdformat | ||
additional_dependencies: | ||
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote] | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 22.10.0 | ||
hooks: | ||
- id: black | ||
|
||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: v0.0.165 | ||
hooks: | ||
- id: ruff | ||
args: ["--fix"] |
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) 2024, Datalayer | ||
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,91 @@ | ||
# jupyter_nbmodel_client | ||
|
||
[![Github Actions Status](https://github.com/datalayer/jupyter-nbmodel-client/workflows/Build/badge.svg)](https://github.com/datalayer/jupyter-nbmodel-client/actions/workflows/build.yml) | ||
|
||
Client to interact with Jupyter notebook model. | ||
|
||
## Requirements | ||
|
||
- Jupyter Server | ||
|
||
## Install | ||
|
||
To install the extension, execute: | ||
|
||
```bash | ||
pip install jupyter_nbmodel_client | ||
``` | ||
|
||
## Uninstall | ||
|
||
To remove the extension, execute: | ||
|
||
```bash | ||
pip uninstall jupyter_nbmodel_client | ||
``` | ||
|
||
## Troubleshoot | ||
|
||
If you are seeing the frontend extension, but it is not working, check | ||
that the server extension is enabled: | ||
|
||
```bash | ||
jupyter server extension list | ||
``` | ||
|
||
## Contributing | ||
|
||
### Development install | ||
|
||
```bash | ||
# Clone the repo to your local environment | ||
# Change directory to the jupyter_nbmodel_client directory | ||
# Install package in development mode - will automatically enable | ||
# The server extension. | ||
pip install -e . | ||
``` | ||
|
||
|
||
You can watch the source directory and run your Jupyter Server-based application at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension. For example, | ||
when running JupyterLab: | ||
|
||
```bash | ||
jupyter lab --autoreload | ||
``` | ||
|
||
If your extension does not depend a particular frontend, you can run the | ||
server directly: | ||
|
||
```bash | ||
jupyter server --autoreload | ||
``` | ||
|
||
### Running Tests | ||
|
||
Install dependencies: | ||
|
||
```bash | ||
pip install -e ".[test]" | ||
``` | ||
|
||
To run the python tests, use: | ||
|
||
```bash | ||
pytest | ||
|
||
# To test a specific file | ||
pytest jupyter_nbmodel_client/tests/test_handlers.py | ||
|
||
# To run a specific test | ||
pytest jupyter_nbmodel_client/tests/test_handlers.py -k "test_get" | ||
``` | ||
|
||
### Development uninstall | ||
|
||
```bash | ||
pip uninstall jupyter_nbmodel_client | ||
``` | ||
|
||
### Packaging the extension | ||
|
||
See [RELEASE](RELEASE.md) |
Oops, something went wrong.