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

Update to Jupyter Packaging 0.10, adopt the releaser #17

Merged
merged 6 commits into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ jobs:
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '12.x'
node-version: '14.x'
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.9'
architecture: 'x64'


- name: Setup pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-3.7-${{ hashFiles('package.json') }}
key: pip-3.9-${{ hashFiles('package.json') }}
restore-keys: |
pip-3.7-
pip-3.9-
pip-

- name: Get yarn cache directory path
Expand All @@ -45,7 +45,7 @@ jobs:
yarn-

- name: Install dependencies
run: python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.7.9
run: python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.10
- name: Build the extension
run: |
jlpm
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Check Release
on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: write

jobs:
check_release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: 'x64'
- name: Install node
uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip
uses: actions/cache@v1
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg', 'setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache checked links
uses: actions/cache@v2
with:
path: ~/.cache/pytest-link-check
key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/.md') }}-md-links
restore-keys: |
${{ runner.os }}-linkcheck-
- name: Upgrade packaging dependencies
run: |
pip install --upgrade pip setuptools wheel jupyter-packaging~=0.10 --user
- name: Install Dependencies
run: |
pip install .
- name: Check Release
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ node_modules/
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo
jupyterlab-cell-flash/labextension
jupyterlab_cell_flash/labextension

# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python
Expand Down Expand Up @@ -107,3 +107,5 @@ dmypy.json
.pyre/

# End of https://www.gitignore.io/api/python

.vscode
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ node_modules
**/node_modules
**/lib
**/package.json
jupyterlab-cell-flash
jupyterlab_cell_flash
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

<!-- <START NEW CHANGELOG ENTRY> -->

## 0.3.2

### Changes

- Update to the latest JupyterLab 3.0 packages: https://github.com/jtpio/jupyterlab-cell-flash/pull/8

<!-- <END NEW CHANGELOG ENTRY> -->
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include LICENSE
include README.md
include *.md
include pyproject.toml
include jupyter-config/jupyterlab-cell-flash.json

Expand Down
7 changes: 0 additions & 7 deletions binder/environment.yml

This file was deleted.

File renamed without changes.
File renamed without changes.
23 changes: 17 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"build:prod": "jlpm run build:lib && jlpm run build:labextension",
"clean": "jlpm run clean:lib",
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
"clean:labextension": "rimraf jupyterlab-cell-flash/labextension",
"clean:labextension": "rimraf jupyterlab_cell_flash/labextension",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
Expand All @@ -48,12 +48,12 @@
"watch:src": "tsc -w"
},
"dependencies": {
"@jupyterlab/application": "^3.0.6",
"@jupyterlab/notebook": "^3.0.6",
"@jupyterlab/settingregistry": "^3.0.3"
"@jupyterlab/application": "^3.1.11",
"@jupyterlab/notebook": "^3.1.11",
"@jupyterlab/settingregistry": "^3.1.11"
},
"devDependencies": {
"@jupyterlab/builder": "^3.0.0",
"@jupyterlab/builder": "^3.1.12",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"eslint": "^7.14.0",
Expand All @@ -71,7 +71,18 @@
"jupyterlab": {
"extension": true,
"schemaDir": "schema",
"outputDir": "jupyterlab-cell-flash/labextension"
"outputDir": "jupyterlab_cell_flash/labextension"
},
"jupyter-releaser": {
"hooks": {
"before-build-npm": [
"python -m pip install jupyterlab~=3.1",
"jlpm"
]
}
},
"publishConfig": {
"access": "public"
},
"styleModule": "style/index.js"
}
22 changes: 20 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
[build-system]
requires = ["jupyter_packaging~=0.7.9", "jupyterlab~=3.0", "setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["jupyter_packaging~=0.10", "jupyterlab~=3.0"]
build-backend = "jupyter_packaging.build_api"

[license]
file="LICENSE"

[tool.jupyter-packaging.options]
skip-if-exists = ["jupyterlab_cell_flash/labextension/static/style.js"]
ensured-targets = ["jupyterlab_cell_flash/labextension/static/style.js", "jupyterlab_cell_flash/labextension/package.json"]

[tool.jupyter-packaging.builder]
factory = "jupyter_packaging.npm_builder"

[tool.jupyter-packaging.build-args]
build_cmd = "build:prod"
npm = ["jlpm"]

[tool.check-manifest]
ignore = ["*.json", "*.ipynb", "*.gif", "yarn.lock", ".*", "jupyterlab_cell_flash/labextension/**"]

31 changes: 31 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[metadata]
name = jupyterlab-cell-flash
description = JupyterLab extension to show a flash effect when a cell is executed
long_description = file: README.md
long_description_content_type = text/markdown
license_file = LICENSE
author = Jeremy Tuloup
url = https://github.com/jtpio/jupyterlab-cell-flash
platforms = Linux, Mac OS X, Windows
keywords = Jupyter, JupyterLab, Widgets, IPython
classifiers =
Intended Audience :: Developers
Intended Audience :: Science/Research
License :: OSI Approved :: BSD License
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Framework :: Jupyter
Framework :: Jupyter :: JupyterLab
Framework :: Jupyter :: JupyterLab :: 3
Framework :: Jupyter :: JupyterLab :: Extensions
Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt

[options]
zip_safe = False
include_package_data = True
packages = find:
python_requires = >=3.6
82 changes: 19 additions & 63 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,91 +4,47 @@
import json
from pathlib import Path

from jupyter_packaging import (
create_cmdclass,
install_npm,
ensure_targets,
combine_commands,
skip_if_exists
)
import setuptools

HERE = Path(__file__).parent.resolve()

# The name of the project
name = "jupyterlab-cell-flash"
NAME = "jupyterlab-cell-flash"
PACKAGE = NAME.replace("-", "_")

lab_path = (HERE / name / "labextension")
lab_path = HERE / PACKAGE / "labextension"

# Representative files that should exist after a successful build
jstargets = [
ensured_targets = [
str(lab_path / "package.json"),
str(lab_path / "static" / "style.js"),
]

package_data_spec = {
name: ["*"],
}

labext_name = "jupyterlab-cell-flash"

data_files_spec = [
("share/jupyter/labextensions/%s" % labext_name, str(lab_path), "**"),
("share/jupyter/labextensions/%s" % labext_name, str(HERE), "install.json"),
]

cmdclass = create_cmdclass("jsdeps",
package_data_spec=package_data_spec,
data_files_spec=data_files_spec
)

js_command = combine_commands(
install_npm(HERE, build_cmd="build:prod", npm=["jlpm"]),
ensure_targets(jstargets),
)

is_repo = (HERE / ".git").exists()
if is_repo:
cmdclass["jsdeps"] = js_command
else:
cmdclass["jsdeps"] = skip_if_exists(jstargets, js_command)

long_description = (HERE / "README.md").read_text()

# Get the package info from package.json
pkg_json = json.loads((HERE / "package.json").read_bytes())

setup_args = dict(
name=name,
version=pkg_json["version"],
url=pkg_json["homepage"],
author=pkg_json["author"]["name"],
author_email=pkg_json["author"]["email"],
description=pkg_json["description"],
license=pkg_json["license"],
long_description=long_description,
long_description_content_type="text/markdown",
cmdclass=cmdclass,
packages=setuptools.find_packages(),
install_requires=[
"jupyterlab~=3.0",
],
zip_safe=False,
include_package_data=True,
python_requires=">=3.6",
platforms="Linux, Mac OS X, Windows",
keywords=["Jupyter", "JupyterLab", "JupyterLab3"],
classifiers=[
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Framework :: Jupyter",
],
)
try:
from jupyter_packaging import wrap_installers, npm_builder, get_data_files

# In develop mode, just run yarn
builder = npm_builder(build_cmd="build", build_dir=lab_path, source_dir="src")
cmdclass = wrap_installers(post_develop=builder, ensured_targets=ensured_targets)

setup_args = dict(
cmdclass=cmdclass,
data_files=get_data_files(data_files_spec),
)
except ImportError:
setup_args = dict()

setup_args["version"] = pkg_json["version"]

if __name__ == "__main__":
setuptools.setup(**setup_args)
Loading