Skip to content

Commit

Permalink
Clean up useless files from jp server template
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollonval committed Dec 2, 2024
1 parent aef1fe6 commit 8bc2315
Show file tree
Hide file tree
Showing 14 changed files with 197 additions and 202 deletions.
12 changes: 10 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
interval: "monthly"
groups:
actions:
patterns:
- "*"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
interval: "monthly"
groups:
pip:
patterns:
- "*"
97 changes: 49 additions & 48 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches: ["main"]
pull_request:
schedule:
- cron: "0 0 * * *"

defaults:
run:
Expand All @@ -18,54 +16,78 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [ '3.8', '3.9', '3.10', "3.11" ]
python-version: ["3.9", "3.13"]

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v4

- 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 jupyter_server
- name: Install the extension
run: |
python -m pip install ".[test]"
- name: Build the extension
run: |
python -m pip install .
jupyter server extension list 2>&1 | grep -ie "jupyter_nbmodel_client.*OK"
- name: Test the extension
run: |
pytest .
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"
- name: Build the extension
run: |
pip install build
python -m build --sdist
cp dist/*.tar.gz my_server_extension.tar.gz
pip uninstall -y "jupyter_kernel_client"
rm -rf "jupyter_kernel_client"
- uses: actions/upload-artifact@v2
with:
name: my_server_extension-sdist
path: my_server_extension.tar.gz
- uses: actions/upload-artifact@v4
with:
name: my_server_extension-sdist
path: my_server_extension.tar.gz

check_links:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- 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: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Run Linters
run: |
bash ./.github/workflows/lint.sh
test_sdist:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
architecture: "x64"
- uses: actions/download-artifact@v4
with:
name: my_server_extension-sdist
- name: Install and Test
run: |
pip install my_server_extension.tar.gz
pip list 2>&1 | grep -ie "jupyter_kernel_client"
python -c "import jupyter_kernel_client"
check_release:
needs: test_sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install Dependencies
Expand All @@ -76,28 +98,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Distributions
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: jupyter_nbmodel_client-releaser-dist-${{ github.run_number }}
name: jupyter_kernel_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"
62 changes: 62 additions & 0 deletions .github/workflows/fix-license-header.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Fix License Headers

on:
pull_request_target:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
header-license-fix:
runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout the branch from the PR that triggered the job
run: gh pr checkout ${{ github.event.pull_request.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Fix License Header
# pin to include https://github.com/apache/skywalking-eyes/pull/168
uses: apache/skywalking-eyes/header@e19b828cea6a6027cceae78f05d81317347d21be
with:
mode: fix

- name: List files changed
id: files-changed
shell: bash -l {0}
run: |
set -ex
export CHANGES=$(git status --porcelain | tee /tmp/modified.log | wc -l)
cat /tmp/modified.log
echo "N_CHANGES=${CHANGES}" >> $GITHUB_OUTPUT
git diff
- name: Commit any changes
if: steps.files-changed.outputs.N_CHANGES != '0'
shell: bash -l {0}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git pull --no-tags
git add *
git commit -m "Automatic application of license header"
git config push.default upstream
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 2 additions & 3 deletions .github/workflows/lint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env bash
pip install -e ".[test,lint]"
pip install -e ".[lint, typing]"
mypy --install-types --non-interactive .
ruff .
black --check --diff .
ruff check .
mdformat --check *.md
pipx run 'validate-pyproject[all]' pyproject.toml
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ celerybeat-schedule
.dmypy.json
dmypy.json

# ruff
.ruff_cache

# Pyre type checker
.pyre/

Expand Down
16 changes: 16 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
header:
license:
spdx-id: BSD-3-Clause
copyright-owner: Datalayer, Inc.
copyright-year: 2023-2024
software-name: jupyter-kernel-client

paths-ignore:
- '**/*.ipynb'
- '**/*.json'
- '**/*.yaml'
- '**/*.yml'
- '**/.*'
- 'LICENSE'

comment: on-failure
14 changes: 5 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: end-of-file-fixer
- id: check-case-conflict
Expand All @@ -19,24 +19,20 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.19.2
rev: 0.29.4
hooks:
- id: check-github-workflows

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
rev: 0.7.19
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
rev: v0.8.0
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format
23 changes: 1 addition & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,7 @@ jupyter server extension list
# 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
pip install -e ".[test,lint,typing]"
```

### Running Tests
Expand All @@ -72,12 +57,6 @@ 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
Expand Down
35 changes: 13 additions & 22 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ The extension can be published to `PyPI` manually or using the [Jupyter Releaser

### Python package

This extension can be distributed as Python
packages. All of the Python
This repository can be distributed as Python
package. 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`.

Expand All @@ -21,38 +21,29 @@ To create a Python source package (`.tar.gz`) and the binary package (`.whl`) in
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.
> [!NOTE]
> The extension repository is compatible with the Jupyter Releaser. But
> the GitHub repository and PyPI may need to be properly set up. Please
> follow the instructions of the Jupyter Releaser [checklist](https://jupyter-releaser.readthedocs.io/en/latest/how_to_guides/convert_repo_from_repo.html).
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
- Run the "Step 1: Prep Release" workflow
- Check the draft changelog
- Run the "Step 2: Publish Release" workflow

> [!NOTE]
> Check out the [workflow documentation](https://jupyter-releaser.readthedocs.io/en/latest/get_started/making_release_from_repo.html)
> for more information.
## Publishing to `conda-forge`

Expand Down
Loading

0 comments on commit 8bc2315

Please sign in to comment.