jupyter-opensysml-kernel 0.9.3.dev20261008__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jupyter_opensysml_kernel/__init__.py +14 -0
- jupyter_opensysml_kernel/__main__.py +168 -0
- jupyter_opensysml_kernel/_version.py +8 -0
- jupyter_opensysml_kernel/bin/sysml-jupyter-kernel +4 -0
- jupyter_opensysml_kernel/bin/sysml-jupyter-kernel.exe +4 -0
- jupyter_opensysml_kernel/binary.py +316 -0
- jupyter_opensysml_kernel/kernelspec.py +212 -0
- jupyter_opensysml_kernel/logo-32x32.png +0 -0
- jupyter_opensysml_kernel/logo-64x64.png +0 -0
- jupyter_opensysml_kernel/py.typed +0 -0
- jupyter_opensysml_kernel/release-digests.json +165 -0
- jupyter_opensysml_kernel-0.9.3.dev20261008.data/data/share/jupyter/kernels/sysml/kernel.json +17 -0
- jupyter_opensysml_kernel-0.9.3.dev20261008.data/data/share/jupyter/kernels/sysml/logo-32x32.png +0 -0
- jupyter_opensysml_kernel-0.9.3.dev20261008.data/data/share/jupyter/kernels/sysml/logo-64x64.png +0 -0
- jupyter_opensysml_kernel-0.9.3.dev20261008.dist-info/METADATA +129 -0
- jupyter_opensysml_kernel-0.9.3.dev20261008.dist-info/RECORD +20 -0
- jupyter_opensysml_kernel-0.9.3.dev20261008.dist-info/WHEEL +5 -0
- jupyter_opensysml_kernel-0.9.3.dev20261008.dist-info/entry_points.txt +2 -0
- jupyter_opensysml_kernel-0.9.3.dev20261008.dist-info/licenses/LICENSE +202 -0
- jupyter_opensysml_kernel-0.9.3.dev20261008.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Jupyter kernel for SysML v2, backed by the OpenSysML REPL.
|
|
2
|
+
|
|
3
|
+
The kernel itself is the `sysml-jupyter-kernel` binary every OpenSysML release
|
|
4
|
+
publishes. A platform wheel of this package bundles the build for its machine
|
|
5
|
+
and registers it as the `sysml` kernelspec when it is installed. An install
|
|
6
|
+
from the sdist, or on another platform, downloads the build for the machine,
|
|
7
|
+
verifies it against the digest pinned here for that release, and registers it::
|
|
8
|
+
|
|
9
|
+
python -m jupyter_opensysml_kernel install
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from ._version import VERSION as __version__
|
|
13
|
+
|
|
14
|
+
__all__ = ["__version__"]
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"""`python -m jupyter_opensysml_kernel`: start the bundled kernel, or install or remove the kernelspec.
|
|
2
|
+
|
|
3
|
+
Given the kernel's own flags (`-connection-file FILE`, the form the kernelspec a
|
|
4
|
+
platform wheel installs uses), the bundled `sysml-jupyter-kernel` is started
|
|
5
|
+
with them; given a subcommand, the kernelspec is managed.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import argparse
|
|
11
|
+
import json
|
|
12
|
+
import os
|
|
13
|
+
import stat
|
|
14
|
+
import subprocess
|
|
15
|
+
import sys
|
|
16
|
+
from collections.abc import Sequence
|
|
17
|
+
|
|
18
|
+
from . import kernelspec
|
|
19
|
+
from ._version import VERSION
|
|
20
|
+
from .binary import BINARY_MODE, KernelBinaryError, binary_name, bundled_binary
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
24
|
+
parser = argparse.ArgumentParser(
|
|
25
|
+
prog="jupyter-opensysml-kernel",
|
|
26
|
+
description="Install the SysML v2 (OpenSysML) Jupyter kernel.",
|
|
27
|
+
epilog="Kernel flags (-connection-file FILE, -version, ...) start the kernel bundled in this package.",
|
|
28
|
+
)
|
|
29
|
+
parser.add_argument("--version", action="version", version=f"%(prog)s {VERSION}")
|
|
30
|
+
commands = parser.add_subparsers(dest="command", required=True)
|
|
31
|
+
|
|
32
|
+
install = commands.add_parser(
|
|
33
|
+
"install",
|
|
34
|
+
help="register the kernelspec, with the bundled kernel binary or a verified download of the release's",
|
|
35
|
+
)
|
|
36
|
+
where = install.add_mutually_exclusive_group()
|
|
37
|
+
where.add_argument("--user", action="store_true", help="install for the current user")
|
|
38
|
+
where.add_argument("--sys-prefix", action="store_true", help="install into the current Python environment")
|
|
39
|
+
where.add_argument("--prefix", metavar="DIR", help="install under DIR/share/jupyter")
|
|
40
|
+
where.add_argument("--system", action="store_true", help="install system-wide")
|
|
41
|
+
install.add_argument("--binary", metavar="PATH", help="install this sysml-jupyter-kernel instead of the bundled or downloaded one")
|
|
42
|
+
install.add_argument("--release", metavar="TAG", help="download the kernel of this release (default: the bundled kernel, or the release this package pins)")
|
|
43
|
+
install.add_argument("--name", default=kernelspec.KERNEL_NAME, help="kernelspec name (default: %(default)s)")
|
|
44
|
+
install.add_argument("--display-name", default=kernelspec.DISPLAY_NAME, help="name shown by front ends (default: %(default)s)")
|
|
45
|
+
|
|
46
|
+
uninstall = commands.add_parser("uninstall", help="remove the kernelspec and the kernel binary in it")
|
|
47
|
+
uninstall.add_argument("--name", default=kernelspec.KERNEL_NAME, help="kernelspec name (default: %(default)s)")
|
|
48
|
+
|
|
49
|
+
commands.add_parser("kernelspec", help="print the kernel.json an install writes")
|
|
50
|
+
return parser
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def is_kernel_invocation(argv: Sequence[str]) -> bool:
|
|
54
|
+
"""Whether the arguments are the kernel's (single-dash flags), not a subcommand."""
|
|
55
|
+
return bool(argv) and argv[0].startswith("-") and not argv[0].startswith("--") and argv[0] != "-h"
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# The kernel's flags the launcher forwards: the one Jupyter passes, and the
|
|
59
|
+
# ones that only print. Those of the native `-install` are not among them; the
|
|
60
|
+
# `install` subcommand is the package's way to the same end.
|
|
61
|
+
CONNECTION_FILE_FLAG = "-connection-file"
|
|
62
|
+
KERNEL_SWITCHES = frozenset({"-verbose", "-version", "-man", "-print-kernelspec"})
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class KernelArgumentError(KernelBinaryError):
|
|
66
|
+
"""Arguments that are not the kernel's flags, so are not passed to it."""
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def kernel_arguments(argv: Sequence[str]) -> list[str]:
|
|
70
|
+
"""The kernel's command line for the arguments, each checked against its flag.
|
|
71
|
+
|
|
72
|
+
Raises:
|
|
73
|
+
KernelArgumentError: If an argument is not a kernel flag, or names no
|
|
74
|
+
connection file
|
|
75
|
+
"""
|
|
76
|
+
command: list[str] = []
|
|
77
|
+
connection_file: str | None = None
|
|
78
|
+
args = iter(argv)
|
|
79
|
+
for arg in args:
|
|
80
|
+
flag, has_value, value = arg.partition("=")
|
|
81
|
+
if flag == CONNECTION_FILE_FLAG:
|
|
82
|
+
if not has_value:
|
|
83
|
+
value = next(args, "")
|
|
84
|
+
if connection_file is not None:
|
|
85
|
+
raise KernelArgumentError(f"kernel flag {flag} is given twice")
|
|
86
|
+
if not value or not os.path.isfile(value):
|
|
87
|
+
raise KernelArgumentError(f"kernel flag {flag} needs the connection file Jupyter wrote, not {value!r}")
|
|
88
|
+
connection_file = value
|
|
89
|
+
command += [flag, value]
|
|
90
|
+
elif flag in KERNEL_SWITCHES and not has_value:
|
|
91
|
+
command.append(flag)
|
|
92
|
+
else:
|
|
93
|
+
raise KernelArgumentError(
|
|
94
|
+
f"{arg!r} is not a kernel flag; the kernel takes {CONNECTION_FILE_FLAG} FILE and "
|
|
95
|
+
+ ", ".join(sorted(KERNEL_SWITCHES))
|
|
96
|
+
)
|
|
97
|
+
return command
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def launch(argv: Sequence[str]) -> int:
|
|
101
|
+
"""Run the bundled kernel with the given arguments, in this process where the OS allows.
|
|
102
|
+
|
|
103
|
+
Raises:
|
|
104
|
+
KernelBinaryError: If this install bundles no kernel, or the arguments
|
|
105
|
+
are not its flags
|
|
106
|
+
"""
|
|
107
|
+
path = bundled_binary()
|
|
108
|
+
if path is None:
|
|
109
|
+
raise KernelBinaryError(
|
|
110
|
+
f"this install of {kernelspec.PACKAGE} bundles no {binary_name()} (it was not installed "
|
|
111
|
+
"from a platform wheel); `python -m jupyter_opensysml_kernel install` registers a verified one"
|
|
112
|
+
)
|
|
113
|
+
command = [path, *kernel_arguments(argv)]
|
|
114
|
+
if sys.platform == "win32":
|
|
115
|
+
process = subprocess.Popen(command)
|
|
116
|
+
try:
|
|
117
|
+
return process.wait()
|
|
118
|
+
except BaseException:
|
|
119
|
+
process.terminate()
|
|
120
|
+
raise
|
|
121
|
+
if stat.S_IMODE(os.stat(path).st_mode) != BINARY_MODE:
|
|
122
|
+
try:
|
|
123
|
+
os.chmod(path, BINARY_MODE)
|
|
124
|
+
except OSError:
|
|
125
|
+
# Another user's, or a read-only, install: not ours to tighten, as long as it runs.
|
|
126
|
+
if not os.access(path, os.X_OK):
|
|
127
|
+
raise
|
|
128
|
+
os.execv(path, command)
|
|
129
|
+
return 0 # pragma: no cover - execv does not return
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def main(argv: Sequence[str] | None = None) -> int:
|
|
133
|
+
if argv is None:
|
|
134
|
+
argv = sys.argv[1:]
|
|
135
|
+
try:
|
|
136
|
+
if is_kernel_invocation(argv):
|
|
137
|
+
return launch(argv)
|
|
138
|
+
args = build_parser().parse_args(argv)
|
|
139
|
+
if args.command == "install":
|
|
140
|
+
prefix = args.prefix
|
|
141
|
+
if args.sys_prefix:
|
|
142
|
+
prefix = sys.prefix
|
|
143
|
+
user = args.user
|
|
144
|
+
if args.system:
|
|
145
|
+
prefix = "/usr/local" if sys.platform != "win32" else sys.prefix
|
|
146
|
+
path = kernelspec.install(
|
|
147
|
+
binary=args.binary,
|
|
148
|
+
version=args.release,
|
|
149
|
+
user=user,
|
|
150
|
+
prefix=prefix,
|
|
151
|
+
name=args.name,
|
|
152
|
+
display_name=args.display_name,
|
|
153
|
+
)
|
|
154
|
+
print(f"Installed kernelspec {args.name} in {path}")
|
|
155
|
+
elif args.command == "uninstall":
|
|
156
|
+
path = kernelspec.uninstall(args.name)
|
|
157
|
+
print(f"Removed kernelspec {args.name} from {path}")
|
|
158
|
+
else:
|
|
159
|
+
json.dump(kernelspec.kernel_json(binary_name()), sys.stdout, indent=2, sort_keys=True)
|
|
160
|
+
print()
|
|
161
|
+
except (KernelBinaryError, kernelspec.InvalidKernelNameError) as e:
|
|
162
|
+
print(f"error: {e}", file=sys.stderr)
|
|
163
|
+
return 1
|
|
164
|
+
return 0
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
if __name__ == "__main__":
|
|
168
|
+
sys.exit(main())
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""The one place the jupyter-opensysml-kernel version is written.
|
|
2
|
+
|
|
3
|
+
The package is released in lockstep with the core and the opensysml client:
|
|
4
|
+
`client/python/scripts/check_version.py --jupyter-kernel` compares this value
|
|
5
|
+
with the tag and with client/python/opensysml/_version.py before a release.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
VERSION = "0.9.3.dev20261008"
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
"""Fetching the kernel binary of a release, verified against a pinned digest.
|
|
2
|
+
|
|
3
|
+
A release publishes `sysml-jupyter-kernel-<os>-<arch>[.exe]` for each supported
|
|
4
|
+
platform beside a `.sha256` sidecar. The sidecar comes from whoever served the
|
|
5
|
+
binary, so it is only a consistency check; what the download is held to is the
|
|
6
|
+
digest this package shipped with for the release it was built against, which
|
|
7
|
+
is independent of the serving origin. Nothing unpinned is ever installed.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import hashlib
|
|
13
|
+
import json
|
|
14
|
+
import os
|
|
15
|
+
import platform
|
|
16
|
+
import re
|
|
17
|
+
import tempfile
|
|
18
|
+
import urllib.error
|
|
19
|
+
import urllib.request
|
|
20
|
+
|
|
21
|
+
from ._version import VERSION
|
|
22
|
+
|
|
23
|
+
# Permissions of an installed kernel binary: its owner writes it, everyone
|
|
24
|
+
# runs it, as a system-wide kernelspec needs.
|
|
25
|
+
BINARY_MODE = 0o755
|
|
26
|
+
|
|
27
|
+
DEFAULT_GITHUB_REPO = "Open-MBEE/OpenSysML"
|
|
28
|
+
GITHUB_REPO_ENV = "OPENSYSML_GITHUB_REPO"
|
|
29
|
+
|
|
30
|
+
#: The kernel binary, as every release publishes and installs it.
|
|
31
|
+
BINARY_NAME = "sysml-jupyter-kernel"
|
|
32
|
+
ASSET_PREFIX = BINARY_NAME + "-"
|
|
33
|
+
SIDECAR_SUFFIX = ".sha256"
|
|
34
|
+
|
|
35
|
+
#: The moving alias of the newest nightly snapshot; per-night releases are tagged
|
|
36
|
+
#: `nightly-<yyyymmdd>-<commit>`, and a snapshot of this package pins its own.
|
|
37
|
+
SNAPSHOT_TAG = "nightly"
|
|
38
|
+
|
|
39
|
+
NETWORK_TIMEOUT = 30
|
|
40
|
+
#: Bounds on what is read from the network, so a misbehaving origin cannot fill memory.
|
|
41
|
+
MAX_BINARY_BYTES = 512 * 1024 * 1024
|
|
42
|
+
MAX_SIDECAR_BYTES = 4096
|
|
43
|
+
|
|
44
|
+
PINNED_DIGESTS_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "release-digests.json")
|
|
45
|
+
|
|
46
|
+
_SHA256 = re.compile(r"[0-9a-f]{64}\Z")
|
|
47
|
+
_VERSION_FORM = re.compile(
|
|
48
|
+
r"^(?P<release>\d+\.\d+\.\d+)(?:(?P<phase>a|b|rc)(?P<number>\d+))?(?:\.dev(?P<snapshot>\d+))?$"
|
|
49
|
+
)
|
|
50
|
+
_SEMVER_PHASE = {"a": "alpha", "b": "beta", "rc": "rc"}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class KernelBinaryError(Exception):
|
|
54
|
+
"""The kernel binary could not be obtained."""
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class UnsupportedPlatformError(KernelBinaryError):
|
|
58
|
+
"""No release publishes a kernel for this operating system or architecture."""
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class UnpinnedReleaseError(KernelBinaryError):
|
|
62
|
+
"""This package pins no digest for the asset, so it cannot be verified."""
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class ChecksumMismatchError(KernelBinaryError):
|
|
66
|
+
"""What was downloaded does not hash to the pinned digest."""
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class DownloadError(KernelBinaryError):
|
|
70
|
+
"""The release could not be reached, or served something malformed."""
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _load_pinned_digests() -> dict[str, dict[str, dict[str, str]]]:
|
|
74
|
+
with open(PINNED_DIGESTS_FILE, encoding="utf-8") as f:
|
|
75
|
+
table = json.load(f)
|
|
76
|
+
if not isinstance(table, dict):
|
|
77
|
+
raise KernelBinaryError(f"{PINNED_DIGESTS_FILE} is not a digest table")
|
|
78
|
+
return table
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
#: repo -> release tag -> asset name -> SHA-256 hex digest.
|
|
82
|
+
PINNED_SHA256 = _load_pinned_digests()
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def default_github_repo() -> str:
|
|
86
|
+
"""The repository releases are downloaded from: $OPENSYSML_GITHUB_REPO or the default."""
|
|
87
|
+
return os.environ.get(GITHUB_REPO_ENV) or DEFAULT_GITHUB_REPO
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def detect_platform() -> tuple[str, str]:
|
|
91
|
+
"""This machine as the (GOOS, GOARCH) pair a release names its builds by.
|
|
92
|
+
|
|
93
|
+
Raises:
|
|
94
|
+
UnsupportedPlatformError: If no release is published for the machine
|
|
95
|
+
"""
|
|
96
|
+
system = platform.system().lower()
|
|
97
|
+
goos = {"linux": "linux", "darwin": "darwin", "windows": "windows"}.get(system)
|
|
98
|
+
if goos is None:
|
|
99
|
+
raise UnsupportedPlatformError(
|
|
100
|
+
f"unsupported operating system {platform.system()!r}: releases are built for "
|
|
101
|
+
"Linux, macOS and Windows; `go build ./cmd/sysml-jupyter-kernel` builds one "
|
|
102
|
+
"here, to install with --binary"
|
|
103
|
+
)
|
|
104
|
+
machine = platform.machine().lower()
|
|
105
|
+
goarch = {"x86_64": "amd64", "amd64": "amd64", "aarch64": "arm64", "arm64": "arm64"}.get(machine)
|
|
106
|
+
if goarch is None or (goos == "windows" and goarch != "amd64"):
|
|
107
|
+
raise UnsupportedPlatformError(
|
|
108
|
+
f"unsupported architecture {platform.machine()!r} on {goos}: releases are built "
|
|
109
|
+
"for amd64 and arm64 (amd64 alone on Windows); `go build ./cmd/sysml-jupyter-kernel` "
|
|
110
|
+
"builds one here, to install with --binary"
|
|
111
|
+
)
|
|
112
|
+
return goos, goarch
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def binary_name(goos: str | None = None) -> str:
|
|
116
|
+
"""The file the kernel is installed as: `sysml-jupyter-kernel`, `.exe` on Windows."""
|
|
117
|
+
if goos is None:
|
|
118
|
+
goos = platform.system().lower()
|
|
119
|
+
return BINARY_NAME + ".exe" if goos == "windows" else BINARY_NAME
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def release_asset_name(goos: str | None = None, goarch: str | None = None) -> str:
|
|
123
|
+
"""The asset a release publishes the kernel for a platform under."""
|
|
124
|
+
if goos is None or goarch is None:
|
|
125
|
+
detected_os, detected_arch = detect_platform()
|
|
126
|
+
goos = goos or detected_os
|
|
127
|
+
goarch = goarch or detected_arch
|
|
128
|
+
name = f"{ASSET_PREFIX}{goos}-{goarch}"
|
|
129
|
+
return name + ".exe" if goos == "windows" else name
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
BUNDLED_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "bin")
|
|
133
|
+
|
|
134
|
+
# The wheel tags a platform's build is published under. The Linux kernels are
|
|
135
|
+
# static, so one wheel serves glibc and musl systems; the macOS floor is Go's.
|
|
136
|
+
WHEEL_PLATFORM_TAGS = {
|
|
137
|
+
("linux", "amd64"): "manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_1_x86_64",
|
|
138
|
+
("linux", "arm64"): "manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64",
|
|
139
|
+
("darwin", "amd64"): "macosx_11_0_x86_64",
|
|
140
|
+
("darwin", "arm64"): "macosx_11_0_arm64",
|
|
141
|
+
("windows", "amd64"): "win_amd64",
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def bundled_binary() -> str | None:
|
|
146
|
+
"""The kernel a platform wheel carries, or None in an install from the sdist."""
|
|
147
|
+
path = os.path.join(BUNDLED_DIR, binary_name())
|
|
148
|
+
return path if os.path.isfile(path) else None
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def wheel_platform_tag(goos: str, goarch: str) -> str:
|
|
152
|
+
"""The platform tag of the wheel that bundles the kernel built for (GOOS, GOARCH).
|
|
153
|
+
|
|
154
|
+
Raises:
|
|
155
|
+
UnsupportedPlatformError: If no release is built for the pair
|
|
156
|
+
"""
|
|
157
|
+
try:
|
|
158
|
+
return WHEEL_PLATFORM_TAGS[(goos, goarch)]
|
|
159
|
+
except KeyError:
|
|
160
|
+
raise UnsupportedPlatformError(f"no kernel is released for {goos}-{goarch}") from None
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def built_against_releases(version: str | None = None, github_repo: str | None = None) -> list[str]:
|
|
164
|
+
"""The release tags a version of this package (by default, this one) was built against.
|
|
165
|
+
|
|
166
|
+
A release version names its tag; a pre-release both spellings the tag may
|
|
167
|
+
use; a snapshot (`.dev<yyyymmdd>`) the per-night releases its table pins for
|
|
168
|
+
that date, else the moving alias.
|
|
169
|
+
"""
|
|
170
|
+
if version is None:
|
|
171
|
+
version = VERSION
|
|
172
|
+
match = _VERSION_FORM.fullmatch(version)
|
|
173
|
+
if match is None:
|
|
174
|
+
return [f"v{version}"]
|
|
175
|
+
if match["snapshot"] is not None:
|
|
176
|
+
repo = github_repo or default_github_repo()
|
|
177
|
+
prefix = f"{SNAPSHOT_TAG}-{match['snapshot']}-"
|
|
178
|
+
pinned = sorted(tag for tag in PINNED_SHA256.get(repo, {}) if tag.startswith(prefix))
|
|
179
|
+
return pinned or [SNAPSHOT_TAG]
|
|
180
|
+
if match["phase"] is None:
|
|
181
|
+
return [f"v{match['release']}"]
|
|
182
|
+
suffix = _SEMVER_PHASE[match["phase"]]
|
|
183
|
+
return [
|
|
184
|
+
f"v{match['release']}-{suffix}{match['number']}",
|
|
185
|
+
f"v{match['release']}-{suffix}.{match['number']}",
|
|
186
|
+
]
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def pinned_digest(version: str, asset: str, github_repo: str | None = None) -> str | None:
|
|
190
|
+
"""The digest this package pins for an asset of a release, or None."""
|
|
191
|
+
repo = github_repo or default_github_repo()
|
|
192
|
+
return PINNED_SHA256.get(repo, {}).get(version, {}).get(asset)
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def pinned_release(asset: str | None = None, github_repo: str | None = None) -> str:
|
|
196
|
+
"""The release this package installs by default: the one it was built
|
|
197
|
+
against that pins the asset for this machine.
|
|
198
|
+
|
|
199
|
+
Raises:
|
|
200
|
+
UnpinnedReleaseError: If none of them pins it
|
|
201
|
+
"""
|
|
202
|
+
asset = asset or release_asset_name()
|
|
203
|
+
candidates = built_against_releases(github_repo=github_repo)
|
|
204
|
+
for tag in candidates:
|
|
205
|
+
if pinned_digest(tag, asset, github_repo) is not None:
|
|
206
|
+
return tag
|
|
207
|
+
raise UnpinnedReleaseError(
|
|
208
|
+
f"jupyter-opensysml-kernel {VERSION} pins no digest for {asset} of "
|
|
209
|
+
f"{' or '.join(candidates)}, so it cannot verify a download of it. "
|
|
210
|
+
"Pass --version with a release this package pins, or --binary with a "
|
|
211
|
+
"sysml-jupyter-kernel built or downloaded and verified by hand."
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def release_download_url(version: str, asset: str, github_repo: str | None = None) -> str:
|
|
216
|
+
"""The URL a release publishes an asset at."""
|
|
217
|
+
repo = github_repo or default_github_repo()
|
|
218
|
+
return f"https://github.com/{repo}/releases/download/{version}/{asset}"
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def fetch(url: str, limit: int) -> bytes:
|
|
222
|
+
"""What a URL serves, up to a size bound.
|
|
223
|
+
|
|
224
|
+
Raises:
|
|
225
|
+
DownloadError: If the URL cannot be read or serves more than the bound
|
|
226
|
+
"""
|
|
227
|
+
try:
|
|
228
|
+
with urllib.request.urlopen(url, timeout=NETWORK_TIMEOUT) as response:
|
|
229
|
+
data: bytes = response.read(limit + 1)
|
|
230
|
+
except (urllib.error.URLError, OSError, ValueError) as e:
|
|
231
|
+
raise DownloadError(f"cannot download {url}: {e}") from e
|
|
232
|
+
if len(data) > limit:
|
|
233
|
+
raise DownloadError(f"{url} serves more than the {limit} bytes allowed for it")
|
|
234
|
+
return data
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def sidecar_digest(url: str) -> str:
|
|
238
|
+
"""The digest a `.sha256` sidecar serves, in `sha256sum` form or bare.
|
|
239
|
+
|
|
240
|
+
Raises:
|
|
241
|
+
DownloadError: If the sidecar is missing or malformed
|
|
242
|
+
"""
|
|
243
|
+
text = fetch(url, MAX_SIDECAR_BYTES).decode("ascii", errors="replace")
|
|
244
|
+
fields = text.split()
|
|
245
|
+
if not fields or _SHA256.fullmatch(fields[0]) is None:
|
|
246
|
+
raise DownloadError(f"{url} does not serve a SHA-256 digest")
|
|
247
|
+
return fields[0]
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def download_binary(
|
|
251
|
+
dest_dir: str,
|
|
252
|
+
version: str | None = None,
|
|
253
|
+
github_repo: str | None = None,
|
|
254
|
+
) -> str:
|
|
255
|
+
"""Download the kernel for this machine into a directory, verified.
|
|
256
|
+
|
|
257
|
+
The download is hashed and compared with the digest this package pins for
|
|
258
|
+
the release before anything is written; the served sidecar must agree too,
|
|
259
|
+
so an inconsistent release is refused rather than trusted on one side.
|
|
260
|
+
|
|
261
|
+
Args:
|
|
262
|
+
dest_dir: Directory the binary is written into, under its installed name
|
|
263
|
+
version: Release tag; the package's own pinned release when omitted
|
|
264
|
+
github_repo: GitHub repository (owner/repo)
|
|
265
|
+
|
|
266
|
+
Returns:
|
|
267
|
+
The path of the verified binary
|
|
268
|
+
|
|
269
|
+
Raises:
|
|
270
|
+
UnpinnedReleaseError: If this package pins no digest for the asset
|
|
271
|
+
ChecksumMismatchError: If the download or the sidecar disagrees with the pin
|
|
272
|
+
DownloadError: If the release cannot be reached
|
|
273
|
+
"""
|
|
274
|
+
asset = release_asset_name()
|
|
275
|
+
if version is None:
|
|
276
|
+
version = pinned_release(asset, github_repo)
|
|
277
|
+
expected = pinned_digest(version, asset, github_repo)
|
|
278
|
+
if expected is None:
|
|
279
|
+
raise UnpinnedReleaseError(
|
|
280
|
+
f"jupyter-opensysml-kernel {VERSION} pins no digest for {asset} of {version}, "
|
|
281
|
+
"so it cannot verify a download of it. Install the package released with "
|
|
282
|
+
f"{version}, or pass --binary with a sysml-jupyter-kernel verified by hand."
|
|
283
|
+
)
|
|
284
|
+
url = release_download_url(version, asset, github_repo)
|
|
285
|
+
served = sidecar_digest(url + SIDECAR_SUFFIX)
|
|
286
|
+
if served != expected:
|
|
287
|
+
raise ChecksumMismatchError(
|
|
288
|
+
f"{asset}{SIDECAR_SUFFIX} of {version} serves {served}, but this package pins "
|
|
289
|
+
f"{expected}; the release is not the one this package was built against"
|
|
290
|
+
)
|
|
291
|
+
data = fetch(url, MAX_BINARY_BYTES)
|
|
292
|
+
actual = hashlib.sha256(data).hexdigest()
|
|
293
|
+
if actual != expected:
|
|
294
|
+
raise ChecksumMismatchError(
|
|
295
|
+
f"{asset} of {version} hashes to {actual}, not the pinned {expected}; "
|
|
296
|
+
"the download is corrupt or tampered with, and was not installed"
|
|
297
|
+
)
|
|
298
|
+
return write_binary(data, os.path.join(dest_dir, binary_name()))
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def write_binary(data: bytes, path: str) -> str:
|
|
302
|
+
"""Write verified bytes to a path atomically, executable."""
|
|
303
|
+
os.makedirs(os.path.dirname(path) or ".", exist_ok=True)
|
|
304
|
+
fd, tmp = tempfile.mkstemp(prefix=".kernel-", dir=os.path.dirname(path) or ".")
|
|
305
|
+
try:
|
|
306
|
+
with os.fdopen(fd, "wb") as f:
|
|
307
|
+
f.write(data)
|
|
308
|
+
os.chmod(tmp, BINARY_MODE)
|
|
309
|
+
os.replace(tmp, path)
|
|
310
|
+
except BaseException:
|
|
311
|
+
try:
|
|
312
|
+
os.unlink(tmp)
|
|
313
|
+
except OSError:
|
|
314
|
+
pass
|
|
315
|
+
raise
|
|
316
|
+
return path
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"""The `sysml` kernelspec, and installing it where Jupyter looks.
|
|
2
|
+
|
|
3
|
+
A kernelspec is a directory holding a `kernel.json` and, here, the logos front
|
|
4
|
+
ends show for the kernel. A platform wheel installs one under
|
|
5
|
+
`<prefix>/share/jupyter/kernels/sysml` as package data, whose command line is
|
|
6
|
+
`python -m jupyter_opensysml_kernel`, which starts the kernel bundled in the
|
|
7
|
+
wheel; `pip install` alone registers the kernel. `install` writes a kernelspec
|
|
8
|
+
holding the kernel binary itself, named through the `{resource_dir}`
|
|
9
|
+
placeholder Jupyter substitutes with the directory the spec was found in, so
|
|
10
|
+
that spec can be installed per user, into a prefix, or copied, and
|
|
11
|
+
`jupyter kernelspec remove sysml` removes everything it wrote.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import os
|
|
18
|
+
import re
|
|
19
|
+
from importlib import resources
|
|
20
|
+
import shutil
|
|
21
|
+
import stat
|
|
22
|
+
import sys
|
|
23
|
+
import tempfile
|
|
24
|
+
from typing import Any
|
|
25
|
+
|
|
26
|
+
from ._version import VERSION
|
|
27
|
+
from .binary import BINARY_MODE, KernelBinaryError, binary_name, bundled_binary, download_binary
|
|
28
|
+
|
|
29
|
+
KERNEL_NAME = "sysml"
|
|
30
|
+
DISPLAY_NAME = "SysML v2 (OpenSysML)"
|
|
31
|
+
LANGUAGE = "sysml"
|
|
32
|
+
IMPLEMENTATION = "sysml-jupyter-kernel"
|
|
33
|
+
PACKAGE = "jupyter-opensysml-kernel"
|
|
34
|
+
SPEC_FILE = "kernel.json"
|
|
35
|
+
# Permissions of kernel.json and the logos: owner writes, everyone reads.
|
|
36
|
+
SPEC_MODE = 0o644
|
|
37
|
+
LOGO_FILES = ("logo-32x32.png", "logo-64x64.png")
|
|
38
|
+
|
|
39
|
+
# One directory name under the kernels directory: no path, and no name beginning
|
|
40
|
+
# with a dot, `..` above all, which jupyter_client's own check lets through.
|
|
41
|
+
KERNEL_NAME_PATTERN = re.compile(r"[a-z0-9][a-z0-9._-]*", re.IGNORECASE)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class InvalidKernelNameError(ValueError):
|
|
45
|
+
"""A kernelspec name that is not one directory name."""
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def validate_name(name: str) -> str:
|
|
49
|
+
"""The kernelspec name, if it is one that stays inside the kernels directory.
|
|
50
|
+
|
|
51
|
+
Raises:
|
|
52
|
+
InvalidKernelNameError: For a path, an empty name, or one beginning with a dot
|
|
53
|
+
"""
|
|
54
|
+
if KERNEL_NAME_PATTERN.fullmatch(name) is None:
|
|
55
|
+
raise InvalidKernelNameError(
|
|
56
|
+
f"kernelspec name {name!r} must be letters, digits, '.', '_' or '-', "
|
|
57
|
+
"beginning with a letter or digit"
|
|
58
|
+
)
|
|
59
|
+
return name
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _spec(argv: list[str], display_name: str) -> dict[str, Any]:
|
|
63
|
+
return {
|
|
64
|
+
"argv": argv,
|
|
65
|
+
"display_name": display_name,
|
|
66
|
+
"language": LANGUAGE,
|
|
67
|
+
"interrupt_mode": "message",
|
|
68
|
+
"metadata": {"implementation": IMPLEMENTATION, "package": PACKAGE, "package_version": VERSION},
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def kernel_json(binary_file: str, display_name: str = DISPLAY_NAME) -> dict[str, Any]:
|
|
73
|
+
"""The `kernel.json` for a kernel binary installed beside it."""
|
|
74
|
+
return _spec(["{resource_dir}/" + binary_file, "-connection-file", "{connection_file}"], display_name)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def launcher_kernel_json(display_name: str = DISPLAY_NAME) -> dict[str, Any]:
|
|
78
|
+
"""The `kernel.json` a platform wheel installs: the kernel it bundles, started
|
|
79
|
+
through the `python` of the environment Jupyter runs in, as ipykernel's is."""
|
|
80
|
+
return _spec(["python", "-m", __package__, "-connection-file", "{connection_file}"], display_name)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def stage_binary(binary: str, staging_dir: str) -> str:
|
|
84
|
+
"""Copy a kernel binary supplied by hand into the spec being built.
|
|
85
|
+
|
|
86
|
+
Raises:
|
|
87
|
+
KernelBinaryError: If the path is not an executable file
|
|
88
|
+
"""
|
|
89
|
+
if not os.path.isfile(binary):
|
|
90
|
+
raise KernelBinaryError(f"{binary} is not a file")
|
|
91
|
+
if sys.platform != "win32" and not os.access(binary, os.X_OK):
|
|
92
|
+
raise KernelBinaryError(f"{binary} is not executable")
|
|
93
|
+
dest = os.path.join(staging_dir, binary_name())
|
|
94
|
+
shutil.copyfile(binary, dest)
|
|
95
|
+
os.chmod(dest, BINARY_MODE)
|
|
96
|
+
return dest
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def _write_json(spec: dict[str, Any], staging_dir: str) -> str:
|
|
100
|
+
path = os.path.join(staging_dir, SPEC_FILE)
|
|
101
|
+
with open(path, "w", encoding="utf-8") as f:
|
|
102
|
+
json.dump(spec, f, indent=2, sort_keys=True)
|
|
103
|
+
f.write("\n")
|
|
104
|
+
os.chmod(path, SPEC_MODE)
|
|
105
|
+
return path
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def write_spec(staging_dir: str, binary_path: str, display_name: str = DISPLAY_NAME) -> str:
|
|
109
|
+
"""Write `kernel.json` beside a staged binary."""
|
|
110
|
+
return _write_json(kernel_json(os.path.basename(binary_path), display_name), staging_dir)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def write_launcher_spec(staging_dir: str) -> list[str]:
|
|
114
|
+
"""Write the kernelspec a platform wheel ships as data: `kernel.json` and the logos."""
|
|
115
|
+
return [_write_json(launcher_kernel_json(), staging_dir), *write_logos(staging_dir)]
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def write_logos(staging_dir: str) -> list[str]:
|
|
119
|
+
"""Put the OpenSysML mark beside `kernel.json`, at the sizes front ends read."""
|
|
120
|
+
written = []
|
|
121
|
+
for name in LOGO_FILES:
|
|
122
|
+
path = os.path.join(staging_dir, name)
|
|
123
|
+
with open(path, "wb") as f:
|
|
124
|
+
f.write(resources.files(__package__).joinpath(name).read_bytes())
|
|
125
|
+
written.append(path)
|
|
126
|
+
return written
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def default_location() -> dict[str, Any]:
|
|
130
|
+
"""Where an install goes when no location is asked for.
|
|
131
|
+
|
|
132
|
+
Inside a virtual environment or a conda environment the kernel belongs to
|
|
133
|
+
that environment (`--sys-prefix`); elsewhere it is installed for the user.
|
|
134
|
+
"""
|
|
135
|
+
in_env = sys.prefix != getattr(sys, "base_prefix", sys.prefix) or "CONDA_PREFIX" in os.environ
|
|
136
|
+
return {"prefix": sys.prefix} if in_env else {"user": True}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def install(
|
|
140
|
+
binary: str | None = None,
|
|
141
|
+
version: str | None = None,
|
|
142
|
+
user: bool = False,
|
|
143
|
+
prefix: str | None = None,
|
|
144
|
+
name: str = KERNEL_NAME,
|
|
145
|
+
display_name: str = DISPLAY_NAME,
|
|
146
|
+
github_repo: str | None = None,
|
|
147
|
+
) -> str:
|
|
148
|
+
"""Install the kernelspec, with the kernel binary inside it.
|
|
149
|
+
|
|
150
|
+
The binary is the one bundled in this package when it was installed from a
|
|
151
|
+
platform wheel; otherwise it is downloaded and verified.
|
|
152
|
+
|
|
153
|
+
Args:
|
|
154
|
+
binary: A `sysml-jupyter-kernel` to install instead of the bundled or downloaded one
|
|
155
|
+
version: The release to download, instead of the bundled kernel; the package's
|
|
156
|
+
pinned release when omitted
|
|
157
|
+
user: Install for the current user (`~/.local/share/jupyter`, or $JUPYTER_DATA_DIR)
|
|
158
|
+
prefix: Install under `<prefix>/share/jupyter`
|
|
159
|
+
name: The kernelspec's directory name, which notebooks bind to
|
|
160
|
+
display_name: The name front ends list the kernel under
|
|
161
|
+
github_repo: GitHub repository (owner/repo) the release is downloaded from
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
The directory the kernelspec was installed into
|
|
165
|
+
|
|
166
|
+
Raises:
|
|
167
|
+
KernelBinaryError: If no verified binary could be obtained
|
|
168
|
+
InvalidKernelNameError: If name is not one directory name
|
|
169
|
+
"""
|
|
170
|
+
from jupyter_client.kernelspec import KernelSpecManager
|
|
171
|
+
|
|
172
|
+
validate_name(name)
|
|
173
|
+
if binary is not None and version is not None:
|
|
174
|
+
raise KernelBinaryError("--binary names the kernel to install; --version chooses one to download")
|
|
175
|
+
if binary is None and version is None:
|
|
176
|
+
binary = bundled_binary()
|
|
177
|
+
if not user and prefix is None:
|
|
178
|
+
location = default_location()
|
|
179
|
+
user = bool(location.get("user"))
|
|
180
|
+
prefix = location.get("prefix")
|
|
181
|
+
with tempfile.TemporaryDirectory(prefix="jupyter-opensysml-kernel-") as staging:
|
|
182
|
+
if binary is not None:
|
|
183
|
+
staged = stage_binary(binary, staging)
|
|
184
|
+
else:
|
|
185
|
+
staged = download_binary(staging, version=version, github_repo=github_repo)
|
|
186
|
+
write_spec(staging, staged, display_name)
|
|
187
|
+
write_logos(staging)
|
|
188
|
+
destination: str = KernelSpecManager().install_kernel_spec(
|
|
189
|
+
staging, kernel_name=name, user=user, prefix=prefix
|
|
190
|
+
)
|
|
191
|
+
return destination
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def uninstall(name: str = KERNEL_NAME) -> str:
|
|
195
|
+
"""Remove the installed kernelspec and the binary inside it.
|
|
196
|
+
|
|
197
|
+
Returns:
|
|
198
|
+
The directory that was removed
|
|
199
|
+
|
|
200
|
+
Raises:
|
|
201
|
+
KernelBinaryError: If no kernelspec of that name is installed
|
|
202
|
+
InvalidKernelNameError: If name is not one directory name
|
|
203
|
+
"""
|
|
204
|
+
from jupyter_client.kernelspec import KernelSpecManager, NoSuchKernel
|
|
205
|
+
|
|
206
|
+
validate_name(name)
|
|
207
|
+
manager = KernelSpecManager()
|
|
208
|
+
try:
|
|
209
|
+
removed: str = manager.remove_kernel_spec(name)
|
|
210
|
+
except (NoSuchKernel, KeyError) as e:
|
|
211
|
+
raise KernelBinaryError(f"no kernelspec named {name!r} is installed") from e
|
|
212
|
+
return removed
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Open-MBEE/OpenSysML": {
|
|
3
|
+
"nightly-20261008-9bb631957": {
|
|
4
|
+
"sysml-jupyter-kernel-darwin-amd64": "f99371a2ad4aad87653d853bd04011a4ecb4144e69c5cec78f7a8ef361852a97",
|
|
5
|
+
"sysml-jupyter-kernel-darwin-arm64": "0689b94a71f7a915305e5516889620a8385f2eda4df0b8420a4bc6b2ad3a2b2f",
|
|
6
|
+
"sysml-jupyter-kernel-linux-amd64": "0c4eed2827b96b4cf9a05af5f6f67f70ec2001bda8ca282ec4b53f9188b5a816",
|
|
7
|
+
"sysml-jupyter-kernel-linux-arm64": "ca8fb5cae84a43893398f8dadaaf70fdd90c0b005d5d3c286fde14e36c1909ea",
|
|
8
|
+
"sysml-jupyter-kernel-windows-amd64.exe": "e0db31ccddd5af405c4e6f30bc6f8e549f983b03124f31ddfe68933328d5e409"
|
|
9
|
+
},
|
|
10
|
+
"v0.0.5": {
|
|
11
|
+
"sysml-grpc-darwin-amd64": "ab2933f168341bed3157bac0026d2c5a51bdb1c4629618178123f7ca8e071e72",
|
|
12
|
+
"sysml-grpc-darwin-arm64": "6e839899c93954671d39ebc91a751302d8329864e9671fc38f7549aa52bddde9",
|
|
13
|
+
"sysml-grpc-linux-amd64": "9bc8203f05a3dfa3d5c4b784f87e38d70f0db416732a73ddf56aaa4c57c2a566",
|
|
14
|
+
"sysml-grpc-linux-arm64": "fd6addc9cb717787d12225c3092d653708e6f5aac19d987582228180b529ca13",
|
|
15
|
+
"sysml-grpc-windows-amd64.exe": "0033248b904e0d10f83a5e033953372108ccad024ae530092431325339bc1179"
|
|
16
|
+
},
|
|
17
|
+
"v0.0.6": {
|
|
18
|
+
"sysml-grpc-darwin-amd64": "5954ae0838858ea585943c7a986a049ac9109874047310e9612b292259c07937",
|
|
19
|
+
"sysml-grpc-darwin-arm64": "a46792146388f0ed8b736754c6f675d287769bb026a8dd5503f1abc8ed9036c3",
|
|
20
|
+
"sysml-grpc-linux-amd64": "cb6a4a6152b79321c1d432cdc895acd4d0c4d8e43dd72d38ce6b07d7ce427dd6",
|
|
21
|
+
"sysml-grpc-linux-arm64": "8133f113c07b6f9f2772077add61c3c7e4ba3065000e8405d2c01bc67f3ec17d",
|
|
22
|
+
"sysml-grpc-windows-amd64.exe": "ae01081af3acc467fad7dbbfce10ec15c9307995a98a30773885622ba2e467db"
|
|
23
|
+
},
|
|
24
|
+
"v0.0.7": {
|
|
25
|
+
"sysml-grpc-darwin-amd64": "f83bc05ca77137e142e682f8b5e3858d223dc4be5637755b989d19094d6c9cf0",
|
|
26
|
+
"sysml-grpc-darwin-arm64": "84d6e87ae7af59cad17d1e41b0a5234a78a2c1495c298ba9184e856d5582b9f5",
|
|
27
|
+
"sysml-grpc-linux-amd64": "00ede1e52851ac9cf52e6a69d090ff81a0b188cd7b08ca83d75e27e708bddb58",
|
|
28
|
+
"sysml-grpc-linux-arm64": "54a92ccd80868c3c02fb95f90d3714d0d517d68e9d42dbe5d0d1421ee6b52951",
|
|
29
|
+
"sysml-grpc-windows-amd64.exe": "0bee1545673423dcad761e3d02453d6736ee56989aa17ee82c9a26553bb5bae6"
|
|
30
|
+
},
|
|
31
|
+
"v0.0.8": {
|
|
32
|
+
"sysml-grpc-darwin-amd64": "ac0b8f3d24ffe5250d1c375c90425014eed87a786bb977b848f274b2eaeb2ced",
|
|
33
|
+
"sysml-grpc-darwin-arm64": "0e15230e8636f19a0c145652296faa7f4a18279755f201b396f23d49ba159a6e",
|
|
34
|
+
"sysml-grpc-linux-amd64": "3afc97748c206cd9e52cb55d3e5918fe456f577a121f2fd67800e7383d4ec139",
|
|
35
|
+
"sysml-grpc-linux-arm64": "31e3b10edc8e0cc53537f3be0d56e1a78ea703899afaec76875b502b9919c438",
|
|
36
|
+
"sysml-grpc-windows-amd64.exe": "6bf92438d139e21f1005c41c3fcca5693bad3abf9c5fd8ca6dd18a041d20b101"
|
|
37
|
+
},
|
|
38
|
+
"v0.1.0": {
|
|
39
|
+
"sysml-grpc-darwin-amd64": "60a05614a278c5c17fd27717416fdf957c7f90ba69f31d9a14d531013861601e",
|
|
40
|
+
"sysml-grpc-darwin-arm64": "a31a96d6de5e43ae5071ba0cc469be7f5854b8458aad9d8cd20e5a14c64eb48b",
|
|
41
|
+
"sysml-grpc-linux-amd64": "6bf718f8ade6c67a86cad39fcbc335ae019916b50e10530608bd832986e5b1fa",
|
|
42
|
+
"sysml-grpc-linux-arm64": "09db2db4490fc07efd371ee114b395f9a7650fa9d1dc3de7ad0d2855e5958be5",
|
|
43
|
+
"sysml-grpc-windows-amd64.exe": "7367261c2f82f4dd2d473d580d4410eaf0f8c22532ba94890e33482e509b2d8c"
|
|
44
|
+
},
|
|
45
|
+
"v0.2.0": {
|
|
46
|
+
"sysml-grpc-darwin-amd64": "52c34a3048e5fa03f45189264b85fbd21523ac45d91a65b1dff8fbe0187b5541",
|
|
47
|
+
"sysml-grpc-darwin-arm64": "7caf5d8539c15cde8a076cd217b1f0581049436c092574ddcbf0f5a5af5c9a99",
|
|
48
|
+
"sysml-grpc-linux-amd64": "bc2a1aa124bbb9205953d256c1348ca38a4f57c5723fb09e6f4464a065dc6088",
|
|
49
|
+
"sysml-grpc-linux-arm64": "6f370241e327dd1277e2b8f35bed4388bae1e4172ff4d2a213c24dee2452536d",
|
|
50
|
+
"sysml-grpc-windows-amd64.exe": "1464a3aca63dd2c4d6cb8639f9958b6d887035cb7a7edd197aaa039fb5ab19f2"
|
|
51
|
+
},
|
|
52
|
+
"v0.2.1": {
|
|
53
|
+
"sysml-grpc-darwin-amd64": "589c6e248f69bc373c536d05379b9339d0c77443e67682aa06fc045dadc0606a",
|
|
54
|
+
"sysml-grpc-darwin-arm64": "f0397b0b1b9219470a1346d4e4a9135a3e2c3e480951e5aa54a55e593adb7214",
|
|
55
|
+
"sysml-grpc-linux-amd64": "b1885a0c956a69201f7d00d6d1a4f19f9df12831cedcee8ad4682a9918ffd8a6",
|
|
56
|
+
"sysml-grpc-linux-arm64": "3451bb569c1c2993a5c648df27cadcec900d46e6e1d957f87aac979c8a16c9e5",
|
|
57
|
+
"sysml-grpc-windows-amd64.exe": "3a630d38c2691a27c8f6e3b781f48e05b727c559b219b9c2e7bd8651c222628d"
|
|
58
|
+
},
|
|
59
|
+
"v0.3.0": {
|
|
60
|
+
"sysml-grpc-darwin-amd64": "8c034172f604ec78c6c045b8eef0ddb2fdebac4f22852480ad3289a3e940cf14",
|
|
61
|
+
"sysml-grpc-darwin-arm64": "c9f8fb0a424277cc83ab3f388e11e54fcc9328b9a2cb86a911e7b96fb6cb316a",
|
|
62
|
+
"sysml-grpc-linux-amd64": "b39b720e020c325020af95c33640ad3583c938d74c40d29a0741fab6c03412de",
|
|
63
|
+
"sysml-grpc-linux-arm64": "2faeacdbc3dcd20053b2dc79b559bbbf2f53b7470d982b9908c7665a53b37462",
|
|
64
|
+
"sysml-grpc-windows-amd64.exe": "f50f1b53008154c1a5fb39eb56f09464dedcf081037af765978304b2f33615c6"
|
|
65
|
+
},
|
|
66
|
+
"v0.3.1": {
|
|
67
|
+
"sysml-grpc-darwin-amd64": "9e320e71064d4fd4dfb721bc08e86f420c1dd39da6a6229a10d683f299f1b43c",
|
|
68
|
+
"sysml-grpc-darwin-arm64": "9dc40683594ff7f4c679d19ff6c1a4e220f74ad0b94b9e871293ede473bda112",
|
|
69
|
+
"sysml-grpc-linux-amd64": "f3e3e4bc6f7786437932db69148658dd0f64d9e291bec5957754b75b87630c6e",
|
|
70
|
+
"sysml-grpc-linux-arm64": "1b4009712c1f74c83fae35fa927393867844c983835f2663af85a5c0373df6c7",
|
|
71
|
+
"sysml-grpc-windows-amd64.exe": "a14aa294a096e7eed54145b867ed19dfb604e1e77be4bbd8dc5dd0d84a1e4cf4"
|
|
72
|
+
},
|
|
73
|
+
"v0.4.0": {
|
|
74
|
+
"sysml-grpc-darwin-amd64": "fec8a8e647cfea68935f28c54691bd7c692685727cdf0052492aec3a440bac80",
|
|
75
|
+
"sysml-grpc-darwin-arm64": "1f3bf8caba84d60949add1426cb3be92d4e6ffe50ae6530ab3fea8dd9430a368",
|
|
76
|
+
"sysml-grpc-linux-amd64": "8b5d10b2f0f4175fd78936a7be3083668f0262c525a1ae7581d73b80a278a427",
|
|
77
|
+
"sysml-grpc-linux-arm64": "62718407f0606bad8673eb28a03dec37745bd7c30fbeea4c2e2d41bc2bb61b64",
|
|
78
|
+
"sysml-grpc-windows-amd64.exe": "72a532175348d73f23b208fc638715c6f9020b1a626517a04ca500afd2831ef2"
|
|
79
|
+
},
|
|
80
|
+
"v0.4.1": {
|
|
81
|
+
"sysml-grpc-darwin-amd64": "e7a03ea3e9f5d6681656d9f8fb9419b5a54e04b0ce64b465ec0fdc6abc8d6a3f",
|
|
82
|
+
"sysml-grpc-darwin-arm64": "ad6aa276842ee4e60fa18e158421b5a3e0adda605cfb166a3a0588eb7aef712b",
|
|
83
|
+
"sysml-grpc-linux-amd64": "125dadd7ee27738d62461cef12766a622494d9c69e18ddc5c12d51957abcf68b",
|
|
84
|
+
"sysml-grpc-linux-arm64": "9d7c835e2b61ed3357afa47dbd210f5c7d4afa8ec6a254f24f3f6909e3c4796c",
|
|
85
|
+
"sysml-grpc-windows-amd64.exe": "222a4ec5b8f535a654b53f684dc01da8004114e7944e5ea3bf2b65adfdca6966"
|
|
86
|
+
},
|
|
87
|
+
"v0.4.2": {
|
|
88
|
+
"sysml-grpc-darwin-amd64": "e137c8b41efedda4f2dd511e4bd98443bbcb40373c0b034ca19bed8594bc7773",
|
|
89
|
+
"sysml-grpc-darwin-arm64": "b931eafa0b56f3319e221b5524a6315fa44f3b5660db9f9ce98b2df8af9d683f",
|
|
90
|
+
"sysml-grpc-linux-amd64": "4719bc621befa5d5d9b1eb588393f0cee05f7329f9eee5a517016bfd56383923",
|
|
91
|
+
"sysml-grpc-linux-arm64": "a48fc6f29556b5aa1d0dd7ca3eb62362160e21fb6baa676336d35162a882ef7c",
|
|
92
|
+
"sysml-grpc-windows-amd64.exe": "08a931bc7c0af9df2f9a4bd03cd51f597974bb176467f8b1da71cd50d4ccbdbf"
|
|
93
|
+
},
|
|
94
|
+
"v0.4.3": {
|
|
95
|
+
"sysml-grpc-darwin-amd64": "12dcf12c09083261480db3f0533e455015f36a598fcf57f898071f5d0a38f55f",
|
|
96
|
+
"sysml-grpc-darwin-arm64": "f25f3f1a6b2e766f6355b6cb2fa9872102184eacee059bb784213b3cd550709f",
|
|
97
|
+
"sysml-grpc-linux-amd64": "24132eeafa93e23cb01e8759b469ea62bdb99e53834cc684995a5c7305675bcc",
|
|
98
|
+
"sysml-grpc-linux-arm64": "f54dff9572c625d415b527e81515dfed4cdd9075bb9d3b822b463f79c9e803dd",
|
|
99
|
+
"sysml-grpc-windows-amd64.exe": "0b188ec140872c0f93618602d5aa880daa864a84c00d4a8806cf97c80e8333fe"
|
|
100
|
+
},
|
|
101
|
+
"v0.5.0": {
|
|
102
|
+
"sysml-grpc-darwin-amd64": "8da7071431f7dec63bbab7465c9e9766ec45cc602ee55a5bcecc2df150132bf2",
|
|
103
|
+
"sysml-grpc-darwin-arm64": "17363e6aa06b1e83122e9b68bd9e1942333ec2eccd7ffc53b804585c5e672227",
|
|
104
|
+
"sysml-grpc-linux-amd64": "119b15545dea975e45636682cab075de551395536a4d42c4666776d71b70e990",
|
|
105
|
+
"sysml-grpc-linux-arm64": "8a6ef48a998e21b6a34cd3cce68d202135d8f9285ffe0f022a27550b5b93048a",
|
|
106
|
+
"sysml-grpc-windows-amd64.exe": "053de029407b1255e312a9836d2972a69826c98f64fe425866dfe81a931d154c"
|
|
107
|
+
},
|
|
108
|
+
"v0.5.1": {
|
|
109
|
+
"sysml-grpc-darwin-amd64": "32e11b447b221bad34c477afffb1b05c00eebfede5ba33da6864feddd74e8e3b",
|
|
110
|
+
"sysml-grpc-darwin-arm64": "3149379869d2f8f753053dae06e86dd0a22ac2ce04c410973b84523e592bbb48",
|
|
111
|
+
"sysml-grpc-linux-amd64": "9b1d33ae570f83eaf8deb1626f920d3bcbf65eff5a5b3c4b2ada53606ac9dd01",
|
|
112
|
+
"sysml-grpc-linux-arm64": "b4824822e36115474871658907fec6e311dee6db954c2ee12d8f43b5aca9795a",
|
|
113
|
+
"sysml-grpc-windows-amd64.exe": "5bc8de29420af2906da9aa2aa578ccd0eb3ebf56482d31e97b2df1fa53275f8f"
|
|
114
|
+
},
|
|
115
|
+
"v0.6.0": {
|
|
116
|
+
"sysml-grpc-darwin-amd64": "6195c3127ebb258032bc3e6a2478c67149e9718c6540995c796c4b4bcf3b0a0e",
|
|
117
|
+
"sysml-grpc-darwin-arm64": "e6489a5e2ba77ef6c3c906feaef83bc342c014b5943487d59eba037bfd83ec31",
|
|
118
|
+
"sysml-grpc-linux-amd64": "9368097f9e6ee9bec6cc2155403c3b0ff80202dba33eda0fc7938fb4b41d1168",
|
|
119
|
+
"sysml-grpc-linux-arm64": "b77852e30015a1bdde72da889a712174447dcd53696400980b0c0717f34daf91",
|
|
120
|
+
"sysml-grpc-windows-amd64.exe": "16447e3ff1e16bad36b2419f73f70b4b5f73bb8ad609f3a288412eef9fa54a62"
|
|
121
|
+
},
|
|
122
|
+
"v0.7.0": {
|
|
123
|
+
"sysml-grpc-darwin-amd64": "2e125afec790b674ac85c4445acc6b591d69a4eecfe49a390115644084e6ccb9",
|
|
124
|
+
"sysml-grpc-darwin-arm64": "223596d1990eedbfc091e30a7e469f411574f5adb3b3149ee63ed6ff134edb29",
|
|
125
|
+
"sysml-grpc-linux-amd64": "bd953bb9462fd99c588e6111bb22d235b863c2cb81d3afa8c2a116aa3589b534",
|
|
126
|
+
"sysml-grpc-linux-arm64": "806250c40ccb5ba84d84d92e39ffffdda0e2fc878af88574524f6728d205d51f",
|
|
127
|
+
"sysml-grpc-windows-amd64.exe": "ce5a795c5bb680eba6d22dbe555ca16c4cbb0fcf79f4611da62f83b3104c5753"
|
|
128
|
+
},
|
|
129
|
+
"v0.8.0": {
|
|
130
|
+
"sysml-grpc-darwin-amd64": "9b66402e3e6483c2b6e8c983fbea68463a1f51603b0f1246ba932a13af1e528c",
|
|
131
|
+
"sysml-grpc-darwin-arm64": "7a18e07bc3994bcc5965667ef7abee18efe015923b480e658a89644918b3af51",
|
|
132
|
+
"sysml-grpc-linux-amd64": "229d129b0051e008aab3bd077fd3087b82f322f15ad91135effdd3f65aae197c",
|
|
133
|
+
"sysml-grpc-linux-arm64": "4e844d0a415307507e88e6e2de40314207eb83bafa960e9b5a374ef8a942b3a6",
|
|
134
|
+
"sysml-grpc-windows-amd64.exe": "fbbc8c8cf35c0a5a6d4802dbe14980a8df89871ddd955341b0913e23d9da7625"
|
|
135
|
+
},
|
|
136
|
+
"v0.8.1": {
|
|
137
|
+
"sysml-grpc-darwin-amd64": "277df0b768c58709d99b3301fe954d3478ef69c44173b04e82359ad49b00dd56",
|
|
138
|
+
"sysml-grpc-darwin-arm64": "0c4d896ec61ca19085a0f67a7c5f28be4fef84f46ebc6df5e25c519a4fee5cff",
|
|
139
|
+
"sysml-grpc-linux-amd64": "c928b5e3a8bb6374b18a2a8de0d5694d9727d3a863f35dbb7b91cf2b1f85cc3a",
|
|
140
|
+
"sysml-grpc-linux-arm64": "b75ef2f1f3c3fe76932e84f94ac1cac3c4628f77e22eaaab439219b07c7d2a2d",
|
|
141
|
+
"sysml-grpc-windows-amd64.exe": "2f21bb9471ce913450e65d077f9f4ce1995ee5215f7b281cbf7c461e6b93c218"
|
|
142
|
+
},
|
|
143
|
+
"v0.9.0": {
|
|
144
|
+
"sysml-grpc-darwin-amd64": "0b707d2ad04f1e4ad074ebc529be32792f083a05edf8fad72a8bd5aee450dd89",
|
|
145
|
+
"sysml-grpc-darwin-arm64": "d2c0a5eeca4ffb8309712ae0f6da29e1a15dfdc3b2a201fa30920a76e863b166",
|
|
146
|
+
"sysml-grpc-linux-amd64": "930c85cc74a4da0ff9761b80688d30da5aade04d1f6ecf2c0c8235bad10e5449",
|
|
147
|
+
"sysml-grpc-linux-arm64": "3664264060fe1b59c9da278c2f10b6d57bec0f7ee9cc8fa2784d565916a74dcf",
|
|
148
|
+
"sysml-grpc-windows-amd64.exe": "b5268560bcff72ed3a64f93342cf3b3ff72b0145bf2c14ae3ffc6a4b5ab3f2b6"
|
|
149
|
+
},
|
|
150
|
+
"v0.9.1": {
|
|
151
|
+
"sysml-grpc-darwin-amd64": "ade96cc53eeb7bfbfd44db76a5c67f4566ccc2c4d36fc3d82e28759cd27745df",
|
|
152
|
+
"sysml-grpc-darwin-arm64": "1579ce333281cdf0ba83d76907850d628214331f319cc546b2215e6173a851c0",
|
|
153
|
+
"sysml-grpc-linux-amd64": "07cf2bca89531328b0f5ad3e21533f62ef6c9b1605ceaf308b951b44361ef463",
|
|
154
|
+
"sysml-grpc-linux-arm64": "6cde66836b884171650fcb246cbc976f66fc564bebb233a82a2ff1a0cb58e377",
|
|
155
|
+
"sysml-grpc-windows-amd64.exe": "74c55402c86b27fba749275750bb3ffd769c25428eaf4cad7cacaf843596a9ce"
|
|
156
|
+
},
|
|
157
|
+
"v0.9.2": {
|
|
158
|
+
"sysml-grpc-darwin-amd64": "e0a899530c03dfc4364c472d04e3f8748338ae72132f75f9351b9d162c8cb2cc",
|
|
159
|
+
"sysml-grpc-darwin-arm64": "f216818f2b37767d1aa7531a692612c7235e64ae9a21efe6b4de13d6832422f4",
|
|
160
|
+
"sysml-grpc-linux-amd64": "8577dacafa512416942639a3b2a7e38dc4a0bd89e64abce2e5e4faca581ee7c3",
|
|
161
|
+
"sysml-grpc-linux-arm64": "289f3fdff259f1a49960abbdead31a9cd7bb4d3789430303d1823beffda1b3cf",
|
|
162
|
+
"sysml-grpc-windows-amd64.exe": "d58a5b3ace4a627e59988b85d94d1b753ba7403b1477860f3ae2e8d83b3c3e99"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"argv": [
|
|
3
|
+
"python",
|
|
4
|
+
"-m",
|
|
5
|
+
"jupyter_opensysml_kernel",
|
|
6
|
+
"-connection-file",
|
|
7
|
+
"{connection_file}"
|
|
8
|
+
],
|
|
9
|
+
"display_name": "SysML v2 (OpenSysML)",
|
|
10
|
+
"interrupt_mode": "message",
|
|
11
|
+
"language": "sysml",
|
|
12
|
+
"metadata": {
|
|
13
|
+
"implementation": "sysml-jupyter-kernel",
|
|
14
|
+
"package": "jupyter-opensysml-kernel",
|
|
15
|
+
"package_version": "0.9.3.dev20261008"
|
|
16
|
+
}
|
|
17
|
+
}
|
jupyter_opensysml_kernel-0.9.3.dev20261008.data/data/share/jupyter/kernels/sysml/logo-32x32.png
ADDED
|
Binary file
|
jupyter_opensysml_kernel-0.9.3.dev20261008.data/data/share/jupyter/kernels/sysml/logo-64x64.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: jupyter-opensysml-kernel
|
|
3
|
+
Version: 0.9.3.dev20261008
|
|
4
|
+
Summary: Jupyter kernel for SysML v2, backed by the OpenSysML REPL
|
|
5
|
+
Author: Open-MBEE
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/Open-MBEE/OpenSysML
|
|
8
|
+
Project-URL: Repository, https://github.com/Open-MBEE/OpenSysML
|
|
9
|
+
Project-URL: Documentation, https://opensysml.org/guide/12-jupyter/
|
|
10
|
+
Project-URL: Changelog, https://github.com/Open-MBEE/OpenSysML/blob/main/CHANGELOG.md
|
|
11
|
+
Project-URL: Issues, https://github.com/Open-MBEE/OpenSysML/issues
|
|
12
|
+
Keywords: jupyter,kernel,sysml,sysmlv2,kerml,mbse,systems-engineering
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Framework :: Jupyter
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Operating System :: MacOS
|
|
18
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
19
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: jupyter_client>=7.0
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: mypy>=1.8.0; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# jupyter-opensysml-kernel
|
|
36
|
+
|
|
37
|
+
A [Jupyter](https://jupyter.org) kernel for SysML v2, backed by the
|
|
38
|
+
[OpenSysML](https://github.com/Open-MBEE/OpenSysML) REPL. A notebook cell is a
|
|
39
|
+
REPL submission: declarations accumulate into one model across cells, a bare
|
|
40
|
+
expression is evaluated, and every `%` command of the `sysml` REPL — `%eval`,
|
|
41
|
+
`%instantiate`, `%action`, `%render`, `%render-document`, `%load`, … — works as
|
|
42
|
+
it does at the prompt. Views render as Mermaid, Graphviz (SVG), Markdown, CSV
|
|
43
|
+
and JSON; documents as Markdown and HTML.
|
|
44
|
+
|
|
45
|
+
## Install
|
|
46
|
+
|
|
47
|
+
Python 3.10 or later and a Jupyter front end (JupyterLab, Notebook, VS Code,
|
|
48
|
+
`nbconvert`, …) are required.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install jupyter-opensysml-kernel
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The wheel for your platform (Linux x64 and arm64, macOS Intel and Apple
|
|
55
|
+
Silicon, Windows x64) bundles the `sysml-jupyter-kernel` binary of the OpenSysML
|
|
56
|
+
release this package was built for and registers the `sysml` kernelspec under
|
|
57
|
+
the Python environment it is installed into, so that is the whole install:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
jupyter kernelspec list # shows: sysml …/share/jupyter/kernels/sysml
|
|
61
|
+
jupyter lab # pick "SysML v2 (OpenSysML)"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Install with the Python that runs your notebook server (or in its environment);
|
|
65
|
+
`pip uninstall` removes the kernel and its kernelspec together.
|
|
66
|
+
|
|
67
|
+
Where no wheel applies, `pip` installs the sdist, which bundles no binary. Then
|
|
68
|
+
one more command downloads the release's binary, verifies it against the SHA-256
|
|
69
|
+
digest the package ships for that release, and registers the kernelspec with the
|
|
70
|
+
binary inside it:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
python -m jupyter_opensysml_kernel install
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Nothing unverified is installed: a download that does not hash to the pinned
|
|
77
|
+
digest is refused, and so is a release the package pins no digest for. The same
|
|
78
|
+
command registers the kernel for the user (`--user`) or under another prefix
|
|
79
|
+
(`--prefix DIR`, `--system`) when the notebook server does not run in the
|
|
80
|
+
environment the package is in, copying the bundled binary when there is one. To
|
|
81
|
+
use a kernel built from source (`go build ./cmd/sysml-jupyter-kernel`) or
|
|
82
|
+
installed another way, pass it explicitly:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
python -m jupyter_opensysml_kernel install --binary ./sysml-jupyter-kernel
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`python -m jupyter_opensysml_kernel uninstall` removes a kernelspec `install`
|
|
89
|
+
wrote and the binary in it; `jupyter kernelspec remove sysml` does the same.
|
|
90
|
+
|
|
91
|
+
The conda-forge recipe for this package is kept in the OpenSysML repository
|
|
92
|
+
under `packaging/conda`; once it is accepted there,
|
|
93
|
+
`conda install -c conda-forge jupyter-opensysml-kernel` installs the kernel and
|
|
94
|
+
its kernelspec into the environment directly. Until then, `pip install` inside
|
|
95
|
+
the conda environment registers the kernel under that environment's prefix the
|
|
96
|
+
same way.
|
|
97
|
+
|
|
98
|
+
A development snapshot of this package is published every night as
|
|
99
|
+
`jupyter-opensysml-kernel==<next release>.dev<yyyymmdd>`, which `pip install`
|
|
100
|
+
never picks up on its own; it carries the kernel of the same night's snapshot.
|
|
101
|
+
|
|
102
|
+
## Documentation
|
|
103
|
+
|
|
104
|
+
- [Using SysML in Jupyter](https://opensysml.org/guide/12-jupyter/) — the guide
|
|
105
|
+
chapter: cells, `%` commands, rich output, interrupts.
|
|
106
|
+
- [REPL commands](https://opensysml.org/reference/repl-commands/) — every `%`
|
|
107
|
+
command the kernel serves.
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
pip install -e '.[dev]'
|
|
113
|
+
pytest
|
|
114
|
+
mypy jupyter_opensysml_kernel
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The tests need no network: downloads are served from fixtures, and the wheel
|
|
118
|
+
tests build from a staged stand-in binary (`python -m build` is required). The
|
|
119
|
+
package's copy of `release-digests.json` is synced from
|
|
120
|
+
`client/release-digests.json` by `scripts/sync-release-digests.py`; the release
|
|
121
|
+
pipeline stamps the digests of the kernel binaries it built into the copy, then
|
|
122
|
+
`scripts/build-jupyter-kernel-dist.sh` builds the sdist and, with each binary
|
|
123
|
+
staged under `jupyter_opensysml_kernel/bin/` and
|
|
124
|
+
`JUPYTER_OPENSYSML_KERNEL_PLATFORM=<goos>-<goarch>` set, one wheel per platform
|
|
125
|
+
(`setup.py` tags the wheel and adds the kernelspec as shared data).
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
Apache-2.0.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
jupyter_opensysml_kernel/__init__.py,sha256=GGl3udR4wfVRFNfLdRk8iVEAMZ60KwSx98PisgCL4hY,578
|
|
2
|
+
jupyter_opensysml_kernel/__main__.py,sha256=LT5aRaKEPKyopRhxK6DQeSGWxPfyjQpNUF7s-vurtYQ,7041
|
|
3
|
+
jupyter_opensysml_kernel/_version.py,sha256=IR9XeCmRCdZriEY71Vob4hvemiUcck0DrdegPkqg4Pw,332
|
|
4
|
+
jupyter_opensysml_kernel/binary.py,sha256=JkXi6qFPs8dzAL4R8TbKuuOfU0J4kic0Q98AZYfy_Cg,12257
|
|
5
|
+
jupyter_opensysml_kernel/kernelspec.py,sha256=GaE5XA15KvQQA4JbViTPRXeFmB_8YoTiQY1d1trCAQg,8185
|
|
6
|
+
jupyter_opensysml_kernel/logo-32x32.png,sha256=arrl5G1Lw0ER1Npb8nXIOpaUkQGkjhI8ii0HTKGOvIg,2488
|
|
7
|
+
jupyter_opensysml_kernel/logo-64x64.png,sha256=0o2drGjR4SArJjkxsiwlZCQ3rV3_jQgo2oJlLO7pGLg,6673
|
|
8
|
+
jupyter_opensysml_kernel/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
jupyter_opensysml_kernel/release-digests.json,sha256=LAwC-jj99i37V8P_TOYQcRGhW8hJIjsUhvvkxXV7kFk,12294
|
|
10
|
+
jupyter_opensysml_kernel/bin/sysml-jupyter-kernel,sha256=Bom5SnH3qRUwXlUWiJYgqDhfLtpN8LhCCkvGsq06Ky8,42670002
|
|
11
|
+
jupyter_opensysml_kernel/bin/sysml-jupyter-kernel.exe,sha256=4NsxzN3Vr0BcTm8wvG-OVJ-YOwMSTzHd_miTMyjV5Ak,46546432
|
|
12
|
+
jupyter_opensysml_kernel-0.9.3.dev20261008.data/data/share/jupyter/kernels/sysml/kernel.json,sha256=2wzQjDwmW2iXr2uch1Q5jefGDOjGBRtmhYu1Nsd6b2Q,373
|
|
13
|
+
jupyter_opensysml_kernel-0.9.3.dev20261008.data/data/share/jupyter/kernels/sysml/logo-32x32.png,sha256=arrl5G1Lw0ER1Npb8nXIOpaUkQGkjhI8ii0HTKGOvIg,2488
|
|
14
|
+
jupyter_opensysml_kernel-0.9.3.dev20261008.data/data/share/jupyter/kernels/sysml/logo-64x64.png,sha256=0o2drGjR4SArJjkxsiwlZCQ3rV3_jQgo2oJlLO7pGLg,6673
|
|
15
|
+
jupyter_opensysml_kernel-0.9.3.dev20261008.dist-info/licenses/LICENSE,sha256=iLtmNdAW7Fw_0eAPVZMPW3EMwJLnUD5_NWGI7NJSa9Y,11340
|
|
16
|
+
jupyter_opensysml_kernel-0.9.3.dev20261008.dist-info/METADATA,sha256=fAKTB5rDNP3HV7rdcBizIPqIlLUDTCNM6cint6NyUA8,5490
|
|
17
|
+
jupyter_opensysml_kernel-0.9.3.dev20261008.dist-info/WHEEL,sha256=Zx98gwb_dQKckJK3HEOVKnxxD52EfU_PXDG_usMJ2ng,98
|
|
18
|
+
jupyter_opensysml_kernel-0.9.3.dev20261008.dist-info/entry_points.txt,sha256=jvrw7325lHzjFfRd5trPGPemDZJVngdNZQRRYcZbhOM,84
|
|
19
|
+
jupyter_opensysml_kernel-0.9.3.dev20261008.dist-info/top_level.txt,sha256=_8rtYZqoq8Tf1OdFn-zhpNFLMQa8o2pJFPqDMbhOpFM,25
|
|
20
|
+
jupyter_opensysml_kernel-0.9.3.dev20261008.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Open-MBEE
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
jupyter_opensysml_kernel
|