Skip to content

Commit 96671df

Browse files
authored
Update to jupyter-packaging 0.10 (jupyter#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
1 parent b2ca240 commit 96671df

File tree

19 files changed

+112
-97
lines changed

19 files changed

+112
-97
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- name: Install dependencies
4848
run: |
4949
python -m pip install --upgrade pip wheel
50-
python -m pip install jupyter_packaging
50+
python -m pip install jupyter_packaging~=0.10
5151
- name: Install the package
5252
run: |
5353
python -m pip install .
@@ -82,10 +82,10 @@ jobs:
8282
- name: Install dependencies
8383
run: |
8484
python -m pip install --upgrade pip wheel
85-
python -m pip install setuptools jupyter_packaging "jupyterlab>=3,<4"
85+
python -m pip install setuptools jupyter_packaging~=0.10 "jupyterlab>=3,<4" build
8686
- name: Build pypi distributions
8787
run: |
88-
python setup.py sdist bdist_wheel
88+
python -m build
8989
- name: Build npm distributions
9090
run: |
9191
mkdir pkgs

.github/workflows/buildutils.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
architecture: 'x64'
2828
- name: Install dependencies
2929
run: |
30-
python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.7.9 pip
30+
python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.10 pip
3131
jlpm
3232
jlpm run build
3333
- name: Configure git identity to commit
@@ -72,7 +72,7 @@ jobs:
7272
architecture: 'x64'
7373
- name: Install dependencies
7474
run: |
75-
python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.7.9 pip
75+
python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.10 pip
7676
jlpm
7777
jlpm run build
7878
- name: Publish to npm in dry-run mode

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- name: Install dependencies
4848
run: |
4949
python -m pip install --upgrade pip wheel
50-
python -m pip install jupyter_packaging
50+
python -m pip install jupyter_packaging~=0.10
5151
- name: Install the package
5252
run: |
5353
python -m pip install .
@@ -82,10 +82,10 @@ jobs:
8282
- name: Install dependencies
8383
run: |
8484
python -m pip install --upgrade pip wheel
85-
python -m pip install setuptools jupyter_packaging "jupyterlab>=3,<4"
85+
python -m pip install setuptools jupyter_packaging~=0.10 "jupyterlab>=3,<4" build
8686
- name: Build pypi distributions
8787
run: |
88-
python setup.py sdist bdist_wheel
88+
python -m build
8989
- name: Build npm distributions
9090
run: |
9191
mkdir pkgs
@@ -184,7 +184,7 @@ jobs:
184184
architecture: 'x64'
185185
- name: Install dependencies
186186
run: |
187-
python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.7.9 pip
187+
python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.10 pip
188188
jlpm
189189
jlpm run build
190190
- uses: actions/download-artifact@v2

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ conda activate retrolab
2323

2424
# Install package in development mode
2525
pip install -e .
26+
27+
# Link the RetroLab JupyterLab extension
28+
jupyter labextension develop . --overwrite
29+
30+
# Enable the server extension
31+
jupyter server extension enable retrolab
2632
```
2733

2834
`retrolab` follows a monorepo structure. To build all the packages at once:

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
include LICENSE
2-
include README.md
2+
include *.md
33
include pyproject.toml
44
include jupyter-config/retrolab.json
55

RELEASE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Make sure the `dist/` folder is empty.
6363
- `jlpm`
6464
- `jlpm run lerna version x.y.z --no-push --amend --force-publish`
6565

66-
4. Run: `python setup.py sdist bdist_wheel`
66+
4. Run: `python -m pip install build && python -m build`
6767
5. Double check the size of the bundles in the `dist/` folder
6868
6. Test the release by installing the wheel or sdist: `python -m pip install ./dist/retrolab-x.y.z-py3-none-any.whl
6969
7. `export TWINE_USERNAME=mypypi_username`

binder/postBuild

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ set -euo pipefail
33

44
jlpm && jlpm run build
55
python -m pip install -e .
6+
jupyter labextension develop . --overwrite
7+
jupyter server extension enable retrolab
8+
jupyter serverextension enable retrolab

packages/application-extension/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
],
3333
"scripts": {
3434
"build": "tsc -b",
35+
"build:prod": "tsc -b",
3536
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
3637
"docs": "typedoc src",
3738
"prepublishOnly": "npm run build",

packages/application/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
],
3232
"scripts": {
3333
"build": "tsc -b",
34+
"build:prod": "tsc -b",
3435
"build:test": "tsc --build tsconfig.test.json",
3536
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
3637
"docs": "typedoc src",

packages/docmanager-extension/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
],
3333
"scripts": {
3434
"build": "tsc -b",
35+
"build:prod": "tsc -b",
3536
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
3637
"docs": "typedoc src",
3738
"prepublishOnly": "npm run build",

packages/help-extension/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
],
3333
"scripts": {
3434
"build": "tsc -b",
35+
"build:prod": "tsc -b",
3536
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
3637
"docs": "typedoc src",
3738
"prepublishOnly": "npm run build",

packages/lab-extension/tsconfig.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,10 @@
44
"outDir": "lib",
55
"rootDir": "src"
66
},
7-
"include": ["src/**/*"]
7+
"include": ["src/**/*"],
8+
"references": [
9+
{
10+
"path": "../ui-components"
11+
}
12+
]
813
}

packages/notebook-extension/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
],
3333
"scripts": {
3434
"build": "tsc -b",
35+
"build:prod": "tsc -b",
3536
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
3637
"docs": "typedoc src",
3738
"prepublishOnly": "npm run build",

packages/terminal-extension/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
],
3333
"scripts": {
3434
"build": "tsc -b",
35+
"build:prod": "tsc -b",
3536
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
3637
"docs": "typedoc src",
3738
"prepublishOnly": "npm run build",

packages/tree-extension/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
],
3333
"scripts": {
3434
"build": "tsc -b",
35+
"build:prod": "tsc -b",
3536
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
3637
"docs": "typedoc src",
3738
"prepublishOnly": "npm run build",

packages/ui-components/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
],
3030
"scripts": {
3131
"build": "tsc -b",
32+
"build:prod": "tsc -b",
3233
"build:test": "tsc --build tsconfig.test.json",
3334
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
3435
"cleansvg": "svgo --config svgo.yaml",

pyproject.toml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
[build-system]
2-
requires = ["jupyter_packaging~=0.7.9", "jupyterlab>=3.1.0rc1,==3.*", "setuptools>=40.8.0", "wheel"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["jupyter_packaging~=0.10", "jupyterlab>=3.1.0rc1,==3.1.*"]
3+
build-backend = "jupyter_packaging.build_api"
4+
5+
[license]
6+
file="LICENSE"
7+
8+
[tool.jupyter-packaging.options]
9+
skip-if-exists = ["retrolab/labextension/static/style.js", "retrolab/static/bundle.js"]
10+
ensured-targets = ["retrolab/labextension/static/style.js", "retrolab/static/bundle.js"]
11+
12+
[tool.jupyter-packaging.builder]
13+
factory = "jupyter_packaging.npm_builder"
14+
15+
[tool.jupyter-packaging.build-args]
16+
build_cmd = "build:prod"
17+
npm = ["jlpm"]

setup.cfg

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[metadata]
2+
name = retrolab
3+
version = attr: retrolab._version.__version__
4+
description = JupyterLab Distribution with a retro look and feel
5+
long_description = file: README.md
6+
long_description_content_type = text/markdown
7+
license_file = LICENSE
8+
author = Jupyter Development Team
9+
author_email = [email protected]
10+
url = https://github.com/jupyterlab/retrolab
11+
platforms = Linux, Mac OS X, Windows
12+
keywords = Jupyter, JupyterLab, Notebook
13+
classifiers =
14+
Intended Audience :: Developers
15+
Intended Audience :: System Administrators
16+
Intended Audience :: Science/Research
17+
License :: OSI Approved :: BSD License
18+
Programming Language :: Python
19+
Programming Language :: Python :: 3.6
20+
Programming Language :: Python :: 3.7
21+
Programming Language :: Python :: 3.8
22+
Programming Language :: Python :: 3.9
23+
Framework :: Jupyter
24+
25+
[options]
26+
zip_safe = False
27+
include_package_data = True
28+
packages = find:
29+
python_requires = >=3.6
30+
install_requires =
31+
jupyterlab>=3.1.0rc1,<4
32+
jupyterlab_server~=2.3
33+
jupyter_server~=1.4
34+
nbclassic~=0.2
35+
tornado>=6.1.0
36+
37+
[options.entry_points]
38+
console_scripts =
39+
jupyter-retro = retrolab.app:main

setup.py

Lines changed: 23 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,28 @@
1-
"""
2-
retrolab setup
3-
"""
4-
import os
1+
# Copyright (c) Jupyter Development Team.
2+
# Distributed under the terms of the Modified BSD License.
3+
4+
from pathlib import Path
55

6-
from jupyter_packaging import (
7-
get_version,
8-
create_cmdclass,
9-
combine_commands,
10-
install_npm,
11-
ensure_targets,
12-
skip_if_exists,
13-
)
146
import setuptools
157

16-
HERE = os.path.abspath(os.path.dirname(__file__))
8+
HERE = Path(__file__).parent.resolve()
179

1810
# The name of the project
1911
NAME = "retrolab"
20-
PACKAGE_NAME = NAME.replace("-", "_")
21-
22-
# Get our version
23-
version = get_version(os.path.join(PACKAGE_NAME, "_version.py"))
24-
25-
main_bundle_dest = os.path.join(HERE, PACKAGE_NAME, "static")
26-
main_bundle_source = os.path.join(HERE, "app")
2712

2813
labext_name = "@retrolab/lab-extension"
29-
lab_extension_dest = os.path.join(HERE, PACKAGE_NAME, "labextension")
30-
lab_extension_source = os.path.join(HERE, "packages", "lab-extension")
14+
lab_extension_dest = HERE / NAME / "labextension"
15+
main_bundle_dest = HERE / NAME / "static"
3116

3217
# Representative files that should exist after a successful build
33-
jstargets = [
34-
os.path.join(lab_extension_dest, "package.json"),
35-
os.path.join(main_bundle_dest, "bundle.js"),
18+
ensured_targets = [
19+
str(lab_extension_dest / "static" / "style.js"),
20+
str(main_bundle_dest / "bundle.js"),
3621
]
3722

38-
package_data_spec = {PACKAGE_NAME: ["*", "templates/*", "static/**"]}
39-
4023
data_files_spec = [
41-
("share/jupyter/labextensions/%s" % labext_name, lab_extension_dest, "**"),
42-
("share/jupyter/labextensions/%s" % labext_name, HERE, "install.json"),
24+
("share/jupyter/labextensions/%s" % labext_name, str(lab_extension_dest), "**"),
25+
("share/jupyter/labextensions/%s" % labext_name, str(HERE), "install.json"),
4326
(
4427
"etc/jupyter/jupyter_server_config.d",
4528
"jupyter-config/jupyter_server_config.d",
@@ -52,62 +35,19 @@
5235
),
5336
]
5437

55-
cmdclass = create_cmdclass(
56-
"jsdeps", package_data_spec=package_data_spec, data_files_spec=data_files_spec
57-
)
58-
59-
js_command = combine_commands(
60-
install_npm(HERE, build_cmd="install", npm=["jlpm"]),
61-
install_npm(HERE, build_cmd="build", npm=["jlpm"]),
62-
install_npm(main_bundle_source, build_cmd="build:prod", npm=["jlpm"]),
63-
ensure_targets(jstargets),
64-
)
65-
66-
is_repo = os.path.exists(os.path.join(HERE, ".git"))
67-
if is_repo:
68-
cmdclass["jsdeps"] = js_command
69-
else:
70-
cmdclass["jsdeps"] = skip_if_exists(jstargets, js_command)
71-
38+
try:
39+
from jupyter_packaging import wrap_installers, npm_builder, get_data_files
7240

73-
with open("README.md", "r", encoding="utf-8") as fh:
74-
long_description = fh.read()
41+
# In develop mode, just run yarn
42+
builder = npm_builder(build_cmd='build', npm='jlpm', force=True)
43+
cmdclass = wrap_installers(post_develop=builder, ensured_targets=ensured_targets)
7544

76-
setup_args = dict(
77-
name=NAME,
78-
version=version,
79-
url="https://github.com/jupyterlab/retrolab",
80-
author="Project Jupyter",
81-
description="JupyterLab Distribution with a retro look and feel",
82-
long_description=long_description,
83-
long_description_content_type="text/markdown",
84-
cmdclass=cmdclass,
85-
packages=setuptools.find_packages(),
86-
install_requires=[
87-
"jupyterlab>=3.1.0rc1,<4",
88-
"jupyterlab_server~=2.3",
89-
"jupyter_server~=1.4",
90-
"nbclassic~=0.2",
91-
"tornado>=6.1.0",
92-
],
93-
zip_safe=False,
94-
include_package_data=True,
95-
python_requires=">=3.6",
96-
license="BSD-3-Clause",
97-
platforms="Linux, Mac OS X, Windows",
98-
keywords=["Jupyter", "JupyterLab", "Notebook"],
99-
classifiers=[
100-
"License :: OSI Approved :: BSD License",
101-
"Programming Language :: Python",
102-
"Programming Language :: Python :: 3",
103-
"Programming Language :: Python :: 3.6",
104-
"Programming Language :: Python :: 3.7",
105-
"Programming Language :: Python :: 3.8",
106-
"Programming Language :: Python :: 3.9",
107-
"Framework :: Jupyter",
108-
],
109-
entry_points={"console_scripts": ["jupyter-retro = retrolab.app:main"]},
110-
)
45+
setup_args = dict(
46+
cmdclass=cmdclass,
47+
data_files=get_data_files(data_files_spec)
48+
)
49+
except ImportError:
50+
setup_args = dict()
11151

11252

11353
if __name__ == "__main__":

0 commit comments

Comments
 (0)