Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Update to jupyter-packaging 0.10 #179

Merged
merged 15 commits into from
Jul 14, 2021
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/buildutils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
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/retrolab.json

Expand Down
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
3 changes: 3 additions & 0 deletions binder/postBuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions packages/application-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/application/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/docmanager-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/help-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 6 additions & 1 deletion packages/lab-extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@
"outDir": "lib",
"rootDir": "src"
},
"include": ["src/**/*"]
"include": ["src/**/*"],
"references": [
{
"path": "../ui-components"
}
]
}
1 change: 1 addition & 0 deletions packages/notebook-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/terminal-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/tree-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/ui-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 16 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 changes: 39 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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 changes: 23 additions & 83 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -52,62 +35,19 @@
),
]

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="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),
)

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)

try:
from jupyter_packaging import wrap_installers, npm_builder, get_data_files

with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
# 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)

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__":
Expand Down