Skip to content

Commit ad38308

Browse files
committed
Review
1 parent d224e1f commit ad38308

File tree

10 files changed

+80
-42
lines changed

10 files changed

+80
-42
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
**/style
44
**/package.json
55
**/tsconfig.json
6-
**/patches
76
**/*.d.ts
87

98
.github
@@ -12,6 +11,8 @@ jupyterlab_blockly
1211
docs
1312
examples
1413
node_modules
14+
patches
15+
scripts
1516
.eslintignore
1617
.eslintrc.js
1718
.gitignore

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
**/package.json
55
**/tsconfig.json
66
**/patches
7+
**/scripts
78
**/*.d.ts
89

910
.github
@@ -12,6 +13,8 @@ jupyterlab_blockly
1213
docs
1314
examples
1415
node_modules
16+
patches
17+
scripts
1518
.eslintignore
1619
.eslintrc.js
1720
.gitignore

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ graft jupyterlab_blockly/labextension
1111
recursive-include patches *.patch
1212

1313
# Javascript files
14-
graft src
15-
graft style
14+
graft packages/blockly-extension
1615
prune **/node_modules
1716
prune lib
1817
prune binder
18+
prune scripts
1919

2020
# Patterns to exclude from any directory
2121
global-exclude *~

jupyterlab_blockly/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
def _fetchVersion():
77
HERE = Path(__file__).parent.resolve()
88

9-
for settings in HERE.rglob("package.json"):
9+
for settings in HERE.rglob("packages/blockly-extension/package.json"):
1010
try:
1111
with settings.open() as f:
1212
version = json.load(f)["version"]

package.json

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,7 @@
11
{
2-
"name": "jupyterlab-blockly",
2+
"name": "jupyterlab-blockly-root",
3+
"version": "0.1.0",
34
"private": true,
4-
"version": "0.1.0-alpha.2",
5-
"description": "Blockly extension for JupyterLab.",
6-
"keywords": [
7-
"jupyter",
8-
"jupyterlab",
9-
"jupyterlab-extension"
10-
],
11-
"homepage": "https://github.com/quantstack/jupyterlab-blockly",
12-
"bugs": {
13-
"url": "https://github.com/quantstack/jupyterlab-blockly/issues"
14-
},
15-
"license": "BSD-3-Clause",
16-
"author": {
17-
"name": "quantstack",
18-
"email": ""
19-
},
20-
"repository": {
21-
"type": "git",
22-
"url": "https://github.com/quantstack/jupyterlab-blockly.git"
23-
},
245
"workspaces": {
256
"packages": [
267
"packages/*"

packages/blockly-extension/package.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,5 @@
7171
"jupyterlab": {
7272
"extension": true,
7373
"outputDir": "../../jupyterlab_blockly/labextension"
74-
},
75-
"jupyter-releaser": {
76-
"hooks": {
77-
"before-build-npm": [
78-
"python -m pip install jupyterlab",
79-
"jlpm"
80-
]
81-
}
8274
}
8375
}

packages/blockly/package.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,5 @@
6565
"styleModule": "style/index.js",
6666
"publishConfig": {
6767
"access": "public"
68-
},
69-
"jupyter-releaser": {
70-
"hooks": {
71-
"before-build-npm": [
72-
"python -m pip install jupyterlab",
73-
"jlpm"
74-
]
75-
}
7668
}
7769
}

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@ npm = ["jlpm"]
1515

1616
[tool.check-manifest]
1717
ignore = ["jupyterlab_blockly/labextension/**", "packages/**", "lerna.json", "yarn.lock", ".*", "package-lock.json"]
18+
19+
[tool.jupyter-releaser.hooks]
20+
before-bump-version = ["python -m pip install jupyterlab~=3.4"]
21+
before-build-npm = ["python -m pip install jupyterlab", "jlpm"]
22+
23+
[tool.jupyter-releaser.options]
24+
version-cmd = "python scripts/bump-version.py --force"

scripts/bump-version.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#############################################################################
2+
# Copyright (c) 2018, Voila Contributors #
3+
# Copyright (c) 2018, QuantStack #
4+
# #
5+
# Distributed under the terms of the BSD 3-Clause License. #
6+
# #
7+
# The full license is in the file LICENSE, distributed with this software. #
8+
#############################################################################
9+
10+
import click
11+
from jupyter_releaser.util import get_version, run
12+
from pkg_resources import parse_version
13+
14+
LERNA_CMD = "jlpm run lerna version --no-push --force-publish --no-git-tag-version"
15+
16+
17+
@click.command()
18+
@click.option("--force", default=False, is_flag=True)
19+
@click.argument("spec", nargs=1)
20+
def bump(force, spec):
21+
status = run("git status --porcelain").strip()
22+
if len(status) > 0:
23+
raise Exception("Must be in a clean git state with no untracked files")
24+
25+
curr = parse_version(get_version())
26+
if spec == 'next':
27+
spec = f"{curr.major}.{curr.minor}."
28+
if curr.pre:
29+
p, x = curr.pre
30+
spec += f"{curr.micro}{p}{x + 1}"
31+
else:
32+
spec += f"{curr.micro + 1}"
33+
34+
elif spec == 'patch':
35+
spec = f"{curr.major}.{curr.minor}."
36+
if curr.pre:
37+
spec += f"{curr.micro}"
38+
else:
39+
spec += f"{curr.micro + 1}"
40+
41+
42+
version = parse_version(spec)
43+
44+
# convert the Python version
45+
js_version = f"{version.major}.{version.minor}.{version.micro}"
46+
if version.pre:
47+
p, x = version.pre
48+
p = p.replace("a", "alpha").replace("b", "beta")
49+
js_version += f"-{p}.{x}"
50+
51+
# bump the JS packages
52+
lerna_cmd = f"{LERNA_CMD} {js_version}"
53+
if force:
54+
lerna_cmd += " --yes"
55+
run(lerna_cmd)
56+
57+
58+
if __name__ == "__main__":
59+
bump()

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
long_description = (HERE / "README.md").read_text()
3131

3232
# Get the package info from package.json
33-
pkg_json = json.loads((HERE / "package.json").read_bytes())
33+
pkg_json = json.loads((HERE / "packages/blockly-extension/package.json").read_bytes())
3434
version = (
3535
pkg_json["version"]
3636
.replace("-alpha.", "a")
@@ -51,6 +51,9 @@
5151
long_description_content_type="text/markdown",
5252
packages=setuptools.find_packages(),
5353
install_requires=[],
54+
extras_require={
55+
'dev': ['click','jupyter_releaser==0.22']
56+
},
5457
zip_safe=False,
5558
include_package_data=True,
5659
python_requires=">=3.7",

0 commit comments

Comments
 (0)