Update to jupyter-packaging 0.10 (#179)

* Update to jupyter-packaging 0.10

* Update to jupyter-packaging 0.10 on CI

* Update pyproject metadata

* Update target

* Update targets

* Update build command

* Update MANIFEST.in

* Fix build backend

* Add build:prod command to packages

* Update RELEASE.md

* Enable server extension in dev mode

* Enable for the notebook server

* Fix typo

* Add jupyter labextension develop . to the Binder

* Update dev instructions
This commit is contained in:
Jeremy Tuloup 2021-07-14 15:11:46 +02:00 committed by GitHub
parent b2ca240c63
commit 96671df358
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 112 additions and 97 deletions

View File

@ -47,7 +47,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install jupyter_packaging
python -m pip install jupyter_packaging~=0.10
- name: Install the package
run: |
python -m pip install .
@ -82,10 +82,10 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install setuptools jupyter_packaging "jupyterlab>=3,<4"
python -m pip install setuptools jupyter_packaging~=0.10 "jupyterlab>=3,<4" build
- name: Build pypi distributions
run: |
python setup.py sdist bdist_wheel
python -m build
- name: Build npm distributions
run: |
mkdir pkgs

View File

@ -27,7 +27,7 @@ jobs:
architecture: 'x64'
- name: Install dependencies
run: |
python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.7.9 pip
python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.10 pip
jlpm
jlpm run build
- name: Configure git identity to commit
@ -72,7 +72,7 @@ jobs:
architecture: 'x64'
- name: Install dependencies
run: |
python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.7.9 pip
python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.10 pip
jlpm
jlpm run build
- name: Publish to npm in dry-run mode

View File

@ -47,7 +47,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install jupyter_packaging
python -m pip install jupyter_packaging~=0.10
- name: Install the package
run: |
python -m pip install .
@ -82,10 +82,10 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install setuptools jupyter_packaging "jupyterlab>=3,<4"
python -m pip install setuptools jupyter_packaging~=0.10 "jupyterlab>=3,<4" build
- name: Build pypi distributions
run: |
python setup.py sdist bdist_wheel
python -m build
- name: Build npm distributions
run: |
mkdir pkgs
@ -184,7 +184,7 @@ jobs:
architecture: 'x64'
- name: Install dependencies
run: |
python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.7.9 pip
python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.10 pip
jlpm
jlpm run build
- uses: actions/download-artifact@v2

View File

@ -23,6 +23,12 @@ conda activate retrolab
# Install package in development mode
pip install -e .
# Link the RetroLab JupyterLab extension
jupyter labextension develop . --overwrite
# Enable the server extension
jupyter server extension enable retrolab
```
`retrolab` follows a monorepo structure. To build all the packages at once:

View File

@ -1,5 +1,5 @@
include LICENSE
include README.md
include *.md
include pyproject.toml
include jupyter-config/retrolab.json

View File

@ -63,7 +63,7 @@ Make sure the `dist/` folder is empty.
- `jlpm`
- `jlpm run lerna version x.y.z --no-push --amend --force-publish`
4. Run: `python setup.py sdist bdist_wheel`
4. Run: `python -m pip install build && python -m build`
5. Double check the size of the bundles in the `dist/` folder
6. Test the release by installing the wheel or sdist: `python -m pip install ./dist/retrolab-x.y.z-py3-none-any.whl
7. `export TWINE_USERNAME=mypypi_username`

View File

@ -3,3 +3,6 @@ set -euo pipefail
jlpm && jlpm run build
python -m pip install -e .
jupyter labextension develop . --overwrite
jupyter server extension enable retrolab
jupyter serverextension enable retrolab

View File

@ -32,6 +32,7 @@
],
"scripts": {
"build": "tsc -b",
"build:prod": "tsc -b",
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
"docs": "typedoc src",
"prepublishOnly": "npm run build",

View File

@ -31,6 +31,7 @@
],
"scripts": {
"build": "tsc -b",
"build:prod": "tsc -b",
"build:test": "tsc --build tsconfig.test.json",
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
"docs": "typedoc src",

View File

@ -32,6 +32,7 @@
],
"scripts": {
"build": "tsc -b",
"build:prod": "tsc -b",
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
"docs": "typedoc src",
"prepublishOnly": "npm run build",

View File

@ -32,6 +32,7 @@
],
"scripts": {
"build": "tsc -b",
"build:prod": "tsc -b",
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
"docs": "typedoc src",
"prepublishOnly": "npm run build",

View File

@ -4,5 +4,10 @@
"outDir": "lib",
"rootDir": "src"
},
"include": ["src/**/*"]
"include": ["src/**/*"],
"references": [
{
"path": "../ui-components"
}
]
}

View File

@ -32,6 +32,7 @@
],
"scripts": {
"build": "tsc -b",
"build:prod": "tsc -b",
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
"docs": "typedoc src",
"prepublishOnly": "npm run build",

View File

@ -32,6 +32,7 @@
],
"scripts": {
"build": "tsc -b",
"build:prod": "tsc -b",
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
"docs": "typedoc src",
"prepublishOnly": "npm run build",

View File

@ -32,6 +32,7 @@
],
"scripts": {
"build": "tsc -b",
"build:prod": "tsc -b",
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
"docs": "typedoc src",
"prepublishOnly": "npm run build",

View File

@ -29,6 +29,7 @@
],
"scripts": {
"build": "tsc -b",
"build:prod": "tsc -b",
"build:test": "tsc --build tsconfig.test.json",
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
"cleansvg": "svgo --config svgo.yaml",

View File

@ -1,3 +1,17 @@
[build-system]
requires = ["jupyter_packaging~=0.7.9", "jupyterlab>=3.1.0rc1,==3.*", "setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["jupyter_packaging~=0.10", "jupyterlab>=3.1.0rc1,==3.1.*"]
build-backend = "jupyter_packaging.build_api"
[license]
file="LICENSE"
[tool.jupyter-packaging.options]
skip-if-exists = ["retrolab/labextension/static/style.js", "retrolab/static/bundle.js"]
ensured-targets = ["retrolab/labextension/static/style.js", "retrolab/static/bundle.js"]
[tool.jupyter-packaging.builder]
factory = "jupyter_packaging.npm_builder"
[tool.jupyter-packaging.build-args]
build_cmd = "build:prod"
npm = ["jlpm"]

39
setup.cfg Normal file
View File

@ -0,0 +1,39 @@
[metadata]
name = retrolab
version = attr: retrolab._version.__version__
description = JupyterLab Distribution with a retro look and feel
long_description = file: README.md
long_description_content_type = text/markdown
license_file = LICENSE
author = Jupyter Development Team
author_email = jupyter@googlegroups.com
url = https://github.com/jupyterlab/retrolab
platforms = Linux, Mac OS X, Windows
keywords = Jupyter, JupyterLab, Notebook
classifiers =
Intended Audience :: Developers
Intended Audience :: System Administrators
Intended Audience :: Science/Research
License :: OSI Approved :: BSD License
Programming Language :: Python
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Framework :: Jupyter
[options]
zip_safe = False
include_package_data = True
packages = find:
python_requires = >=3.6
install_requires =
jupyterlab>=3.1.0rc1,<4
jupyterlab_server~=2.3
jupyter_server~=1.4
nbclassic~=0.2
tornado>=6.1.0
[options.entry_points]
console_scripts =
jupyter-retro = retrolab.app:main

106
setup.py
View File

@ -1,45 +1,28 @@
"""
retrolab setup
"""
import os
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from pathlib import Path
from jupyter_packaging import (
get_version,
create_cmdclass,
combine_commands,
install_npm,
ensure_targets,
skip_if_exists,
)
import setuptools
HERE = os.path.abspath(os.path.dirname(__file__))
HERE = Path(__file__).parent.resolve()
# The name of the project
NAME = "retrolab"
PACKAGE_NAME = NAME.replace("-", "_")
# Get our version
version = get_version(os.path.join(PACKAGE_NAME, "_version.py"))
main_bundle_dest = os.path.join(HERE, PACKAGE_NAME, "static")
main_bundle_source = os.path.join(HERE, "app")
labext_name = "@retrolab/lab-extension"
lab_extension_dest = os.path.join(HERE, PACKAGE_NAME, "labextension")
lab_extension_source = os.path.join(HERE, "packages", "lab-extension")
lab_extension_dest = HERE / NAME / "labextension"
main_bundle_dest = HERE / NAME / "static"
# Representative files that should exist after a successful build
jstargets = [
os.path.join(lab_extension_dest, "package.json"),
os.path.join(main_bundle_dest, "bundle.js"),
ensured_targets = [
str(lab_extension_dest / "static" / "style.js"),
str(main_bundle_dest / "bundle.js"),
]
package_data_spec = {PACKAGE_NAME: ["*", "templates/*", "static/**"]}
data_files_spec = [
("share/jupyter/labextensions/%s" % labext_name, lab_extension_dest, "**"),
("share/jupyter/labextensions/%s" % labext_name, HERE, "install.json"),
("share/jupyter/labextensions/%s" % labext_name, str(lab_extension_dest), "**"),
("share/jupyter/labextensions/%s" % labext_name, str(HERE), "install.json"),
(
"etc/jupyter/jupyter_server_config.d",
"jupyter-config/jupyter_server_config.d",
@ -52,62 +35,19 @@ data_files_spec = [
),
]
cmdclass = create_cmdclass(
"jsdeps", package_data_spec=package_data_spec, data_files_spec=data_files_spec
)
try:
from jupyter_packaging import wrap_installers, npm_builder, get_data_files
js_command = combine_commands(
install_npm(HERE, build_cmd="install", npm=["jlpm"]),
install_npm(HERE, build_cmd="build", npm=["jlpm"]),
install_npm(main_bundle_source, build_cmd="build:prod", npm=["jlpm"]),
ensure_targets(jstargets),
)
# In develop mode, just run yarn
builder = npm_builder(build_cmd='build', npm='jlpm', force=True)
cmdclass = wrap_installers(post_develop=builder, ensured_targets=ensured_targets)
is_repo = os.path.exists(os.path.join(HERE, ".git"))
if is_repo:
cmdclass["jsdeps"] = js_command
else:
cmdclass["jsdeps"] = skip_if_exists(jstargets, js_command)
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup_args = dict(
name=NAME,
version=version,
url="https://github.com/jupyterlab/retrolab",
author="Project Jupyter",
description="JupyterLab Distribution with a retro look and feel",
long_description=long_description,
long_description_content_type="text/markdown",
cmdclass=cmdclass,
packages=setuptools.find_packages(),
install_requires=[
"jupyterlab>=3.1.0rc1,<4",
"jupyterlab_server~=2.3",
"jupyter_server~=1.4",
"nbclassic~=0.2",
"tornado>=6.1.0",
],
zip_safe=False,
include_package_data=True,
python_requires=">=3.6",
license="BSD-3-Clause",
platforms="Linux, Mac OS X, Windows",
keywords=["Jupyter", "JupyterLab", "Notebook"],
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",
],
entry_points={"console_scripts": ["jupyter-retro = retrolab.app:main"]},
)
setup_args = dict(
cmdclass=cmdclass,
data_files=get_data_files(data_files_spec)
)
except ImportError:
setup_args = dict()
if __name__ == "__main__":