Skip to content

Commit 366d384

Browse files
authored
Merge branch 'RoboStack:master' into master
2 parents e1c1fe8 + 2be3189 commit 366d384

File tree

12 files changed

+343
-107
lines changed

12 files changed

+343
-107
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ jobs:
2222
- name: Build the extension
2323
run: |
2424
set -eux
25-
jlpm
26-
jlpm run eslint:check
25+
# TODO: add lint check
26+
#pushd js
27+
#jlpm
28+
#jlpm run eslint:check
29+
#popd
30+
2731
python -m pip install .
2832
jupyter labextension list
2933
jupyter labextension list 2>&1 | grep -ie "@robostack/jupyter-ros.*OK"

.github/workflows/check-release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Check Release
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
check_release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
- name: Install Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: 3.9
23+
architecture: 'x64'
24+
- name: Install node
25+
uses: actions/setup-node@v2
26+
with:
27+
node-version: '14.x'
28+
29+
30+
- name: Get pip cache dir
31+
id: pip-cache
32+
run: |
33+
echo "::set-output name=dir::$(pip cache dir)"
34+
- name: Cache pip
35+
uses: actions/cache@v1
36+
with:
37+
path: ${{ steps.pip-cache.outputs.dir }}
38+
key: ${{ runner.os }}-pip-${{ hashFiles('package.json') }}
39+
restore-keys: |
40+
${{ runner.os }}-pip-
41+
- name: Cache checked links
42+
uses: actions/cache@v2
43+
with:
44+
path: ~/.cache/pytest-link-check
45+
key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/.md') }}-md-links
46+
restore-keys: |
47+
${{ runner.os }}-linkcheck-
48+
- name: Upgrade packaging dependencies
49+
run: |
50+
pip install --upgrade pip setuptools wheel jupyter-packaging~=0.10 --user
51+
- name: Install Dependencies
52+
run: |
53+
pip install .
54+
- name: Check Release
55+
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v1
56+
with:
57+
token: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: Upload Distributions
60+
uses: actions/upload-artifact@v2
61+
with:
62+
name: jupyros-releaser-dist-${{ github.run_number }}
63+
path: .jupyter_releaser_checkout/dist

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
<!-- <START NEW CHANGELOG ENTRY> -->
4+
5+
## 0.5.0
6+
7+
<!-- <END NEW CHANGELOG ENTRY> -->

MANIFEST.in

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
11
include LICENSE
2-
include README.md
2+
include *.md
33
include pyproject.toml
44

5-
include jupyros/jupyros.json
5+
graft jupyros/ros1
6+
graft jupyros/ros2
7+
include jupyros/_version.py
8+
include jupyros/__init__.py
9+
10+
# Extensions
11+
graft jupyros/nbextension
12+
graft jupyros/labextension
13+
include install.json
14+
include jupyros/jupyter-ros.json
615
include jupyros/jupyros_server_extension.json
716

8-
graft jupyros/static
9-
graft jupyros/labextension
17+
# Javascript files
18+
include js/package.json
19+
include js/webpack.config.js
20+
21+
prune **/node_modules
22+
23+
# Patterns to exclude from any directory
24+
global-exclude *~
25+
global-exclude *.pyc
26+
global-exclude *.pyo
27+
global-exclude .git
28+
global-exclude .ipynb_checkpoints

js/package.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
"name": "@robostack/jupyter-ros",
33
"version": "0.5.0",
44
"description": "Jupyter widgets for the ROS ecosystem.",
5-
"author": "Wolf Vollprecht",
5+
"homepage": "https://github.com/wolfv/jupyter-ros.git",
6+
"author": {
7+
"name": "Wolf Vollprecht",
8+
"email": "[email protected]"
9+
},
10+
"license": "BSD-3-Clause",
611
"main": "lib/labplugin.js",
712
"repository": {
813
"type": "git",
@@ -21,8 +26,12 @@
2126
],
2227
"scripts": {
2328
"clean": "rimraf dist/ ../jupyros/nbextension ../jupyros/labextension",
24-
"build": "jlpm run clean && webpack",
25-
"build:labextension": "jlpm run build && jupyter labextension build .",
29+
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
30+
"build:lib": "webpack",
31+
"build:prod": "jlpm run clean && jlpm run build:lib && jlpm run build:labextension",
32+
"build:labextension": "jupyter labextension build .",
33+
"build:labextension:dev": "jupyter labextension build --development True .",
34+
"install:extension": "jlpm run build",
2635
"watch": "run-p watch:src && watch:labextension",
2736
"watch:src": "webpack --watch",
2837
"watch:labextension": "jupyter labextension watch .",

jupyros/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# The full license is in the file LICENSE, distributed with this software. #
77
#############################################################################
88

9-
from ._version import version_info, __version__
9+
from ._version import __version__
1010
import os
1111

1212
try:

jupyros/_version.py

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,38 @@
66
# The full license is in the file LICENSE, distributed with this software. #
77
#############################################################################
88

9-
version_info = (0, 5, 0, 'final', 0)
9+
import json
10+
from pathlib import Path
1011

11-
_specifier_ = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc', 'final': ''}
12+
__all__ = ["__version__"]
1213

13-
__version__ = '%s.%s.%s%s'%(version_info[0], version_info[1], version_info[2],
14-
'' if version_info[3]=='final' else _specifier_[version_info[3]]+str(version_info[4]))
14+
def _fetchVersion():
15+
HERE = Path(__file__).parent.parent.resolve()
16+
17+
for settings in HERE.rglob("package.json"):
18+
try:
19+
with settings.open() as f:
20+
version = json.load(f)["version"]
21+
return (
22+
version.replace("-alpha.", "a")
23+
.replace("-beta.", "b")
24+
.replace("-rc.", "rc")
25+
)
26+
except FileNotFoundError:
27+
pass
28+
29+
raise FileNotFoundError(f"Could not find package.json under dir {HERE!s}")
30+
31+
def _fetchJSVersion():
32+
HERE = Path(__file__).parent.parent.resolve()
33+
34+
for settings in HERE.rglob("package.json"):
35+
try:
36+
with settings.open() as f:
37+
return json.load(f)["version"]
38+
except FileNotFoundError:
39+
pass
40+
41+
raise FileNotFoundError(f"Could not find package.json under dir {HERE!s}")
42+
43+
__version__ = _fetchVersion()

jupyros/ros1/ros3d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
from traitlets import *
1212
import ipywidgets as widgets
1313

14-
from .._version import version_info
14+
from .._version import _fetchJSVersion
1515

16-
js_version = '^' + '.'.join([str(x) for x in version_info[:3]])
16+
js_version = '^' + _fetchJSVersion()
1717

1818

1919
def _quick_widget(package_name, version, has_view=True):

pyproject.toml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
11
[build-system]
2-
requires = ["jupyter_packaging~=0.7.9", "jupyterlab>=3.0.0,==3.*", "setuptools>=40.8.0", "wheel"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["jupyter_packaging~=0.10,<2", "jupyterlab>=3,<4"]
3+
build-backend = "jupyter_packaging.build_api"
4+
5+
[tool.jupyter-packaging.options]
6+
skip-if-exists = ["jupyros/labextension/static/style.js", "jupyros/nbextension/extension.js", "jupyros/nbextension/index.js"]
7+
ensured-targets = ["jupyros/labextension/static/style.js", "jupyros/labextension/package.json", "jupyros/nbextension/extension.js", "jupyros/nbextension/index.js"]
8+
9+
[tool.jupyter-packaging.builder]
10+
factory = "jupyter_packaging.npm_builder"
11+
12+
[tool.jupyter-packaging.build-args]
13+
path="js"
14+
build_cmd = "build:prod"
15+
source_dir="lib"
16+
npm = ["jlpm"]
17+
18+
[tool.check-manifest]
19+
ignore = ["jupyros/labextension/**", "jupyros/nbextension/**", "notebooks/**", "scripts/**", "docs/**", "js/**", ".*"]
20+
21+
[tool.jupyter-releaser.hooks]
22+
before-bump-version = ["python -m pip install jupyterlab", "cd js && jlpm clean"]
23+
before-build-npm = ["python -m pip install jupyterlab", "cd js && jlpm clean && jlpm"]
24+
before-build-python = ["cd js && jlpm clean"]
25+
26+
[tool.jupyter-releaser.options]
27+
version-cmd = "python scripts/bump-version.py"

scripts/bump-version.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#############################################################################
2+
# Copyright (c) 2018, QuantStack #
3+
# #
4+
# Distributed under the terms of the BSD 3-Clause License. #
5+
# #
6+
# The full license is in the file LICENSE, distributed with this software. #
7+
#############################################################################
8+
9+
import json
10+
import click
11+
from pathlib import Path
12+
from jupyter_releaser.util import get_version, run
13+
from pkg_resources import parse_version
14+
15+
def _update_version(version):
16+
HERE = Path(__file__).parent.parent.resolve()
17+
18+
for settings in HERE.rglob("package.json"):
19+
try:
20+
with settings.open('r') as f:
21+
pckg_json = json.load(f)
22+
23+
pckg_json['version'] = version
24+
25+
with settings.open('w') as f:
26+
json.dump(pckg_json, f, indent=2)
27+
28+
# Check version
29+
with settings.open('r') as f:
30+
ver = json.load(f)['version']
31+
print("package.json version:", ver)
32+
33+
return
34+
35+
except FileNotFoundError:
36+
pass
37+
38+
raise FileNotFoundError(f"Could not find package.json under dir {HERE!s}")
39+
40+
@click.command()
41+
@click.argument("spec", nargs=1)
42+
def bump(spec):
43+
status = run("git status --porcelain").strip()
44+
if len(status) > 0:
45+
raise Exception("Must be in a clean git state with no untracked files")
46+
47+
curr = parse_version(get_version())
48+
49+
if spec == 'next':
50+
spec = f"{curr.major}.{curr.minor}."
51+
if curr.pre:
52+
p, x = curr.pre
53+
spec += f"{curr.micro}{p}{x + 1}"
54+
else:
55+
spec += f"{curr.micro + 1}"
56+
57+
elif spec == 'patch':
58+
spec = f"{curr.major}.{curr.minor}."
59+
if curr.pre:
60+
spec += f"{curr.micro}"
61+
else:
62+
spec += f"{curr.micro + 1}"
63+
64+
65+
version = parse_version(spec)
66+
67+
# convert the Python version
68+
js_version = f"{version.major}.{version.minor}.{version.micro}"
69+
if version.pre:
70+
p, x = version.pre
71+
p = p.replace("a", "alpha").replace("b", "beta")
72+
js_version += f"-{p}.{x}"
73+
74+
# bump the JS packages
75+
_update_version(js_version)
76+
77+
78+
if __name__ == "__main__":
79+
bump()

0 commit comments

Comments
 (0)