|
| 1 | +# ISysML |
| 2 | + |
| 3 | +A [Jupyter](http://jupyter.org/) kernel for executing SysML v2 models. The kernel executes models via the new SysML textual language. Some of the additional commands should be supported as needed via a syntax similar to the IPython magics. |
| 4 | + |
| 5 | +Built on top of [jupyter-jvm-basekernel](https://github.com/SpencerPark/jupyter-jvm-basekernel). |
| 6 | + |
| 7 | +### Requirements |
| 8 | + |
| 9 | +1. [Java >= 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html). Java 11 is the latest LTS release and should be considered if selecting a version, but if a Java 8, 9, 10, or 12 build is installed everything _should_ still be working fine. |
| 10 | + |
| 11 | +2. Some Jupyter-like environment to use the kernel in. |
| 12 | + |
| 13 | + A non-exhaustive list of options: |
| 14 | + |
| 15 | + * [Jupyter](http://jupyter.org/install) |
| 16 | + * [JupyterLab](http://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html) |
| 17 | + * [nteract](https://nteract.io/desktop) |
| 18 | + |
| 19 | +### Installing |
| 20 | + |
| 21 | +After meeting the [requirements](#requirements), the kernel can be installed locally. Any time you wish to remove a kernel you may use `jupyter kernelspec remove sysml`. If you have installed the kernel to multiple directories, this command may need to be run multiple times as it might only remove 1 installation at a time. |
| 22 | + |
| 23 | + |
| 24 | +#### (Coming Soon) Install pre-built binary |
| 25 | + |
| 26 | +Get the latest _release_ of the software with no compilation needed. See [Install from source](#install-from-source) for building the latest commit. |
| 27 | + |
| 28 | +**Note:** if you have an old installation or a debug one from running `gradlew installKernel` it is suggested that it is first removed via `jupyter kernelspec remove sysml`. |
| 29 | + |
| 30 | +1. Download the release from the [releases tab](.). A prepackaged distribution will be in an artifact named `isysml-$version.zip`. |
| 31 | + |
| 32 | +2. Unzip it into a temporary location. It should have at least the `install.py` and `sysml` folder extracted in there. |
| 33 | + |
| 34 | +3. Run the installer with the same python command used to install jupyter. The installer is a python script and has the same options as `jupyter kernelspec install` but additionally supports configuring some of the kernel properties mentioned further below in the README. |
| 35 | + |
| 36 | + ```bash |
| 37 | + # Pass the -h option to see the help page |
| 38 | + > python3 install.py -h |
| 39 | + |
| 40 | + # Otherwise a common install command is |
| 41 | + > python3 install.py --sys-prefix |
| 42 | + ``` |
| 43 | + |
| 44 | +4. Check that it installed with `jupyter kernelspec list` which should contain `sysml`. |
| 45 | + |
| 46 | +#### Install from source |
| 47 | + |
| 48 | +Get the latest version of the kernel but possibly run into some issues with installing. This is also the route to take if you wish to contribute to the kernel. |
| 49 | + |
| 50 | +On *nix `chmod u+x gradlew && ./gradlew installKernel` |
| 51 | + |
| 52 | +On Windows `gradlew installKernel` |
| 53 | + |
| 54 | +See all available options for configuring the install path with `gradlew -q help --task installKernel`. Pass the `--default`, `--user`, `--sys-prefix`, `--prefix`, `--path`, or `--legacy` options to change the install location. Also use the `--param` flag (repeatedly) to set (or add) parameter values with the parameter names (not environment variable) specified in the configuration section below. For example `--param classpath:/my/classpath/root` to append to the classpath list. |
| 55 | + |
| 56 | +### Configuring |
| 57 | + |
| 58 | +Configuring the kernel can be done via environment variables. These can be set on the system or inside the `kernel.json`. The configuration can be done at install time, which may be repeated as often as desired. The parameters are listed with `python3 install.py -h` as well as below in the list of options. Configuration done via the installer (or `gradlew installKernel --param ...:...`) should use the names in the _Parameter name_ column. |
| 59 | + |
| 60 | +#### List of options |
| 61 | + |
| 62 | +| Environment variable | Parameter name | Default | Description | |
| 63 | +|----------------------|----------------|---------|-------------| |
| 64 | +| `ISYSML_LIBRARY_PATH` | `library-path` | `""` | A file path separator delimited list of library path entries that should be available to the user code. **Important:** no matter what OS, this should use forward slash "/" as the file separator. |
| 65 | + |
| 66 | +#### Changing VM options |
| 67 | + |
| 68 | +The kernel VM parameters must currently be assigned in the `kernel.json` by adding/editing a JSON dictionary at the `env` key and changing the `argv` list. To find where the kernel is installed run |
| 69 | + |
| 70 | +```bash |
| 71 | +> jupyter kernelspec list |
| 72 | +Available kernels: |
| 73 | + sysml .../kernels/sysml |
| 74 | + python3 .../kernels/python3 |
| 75 | +``` |
| 76 | + |
| 77 | +and the `kernel.json` file will be in the given directory. |
| 78 | + |
| 79 | +For example to set the heap size to `128m`: |
| 80 | + |
| 81 | +```diff |
| 82 | +{ |
| 83 | +- "argv": [ "java", "-jar", "{connection_file}"], |
| 84 | ++ "argv": [ "java", "-Xmx128m", "-jar", "{connection_file}"], |
| 85 | + "display_name": "SysML", |
| 86 | + "language": "sysml", |
| 87 | + "interrupt_mode": "message", |
| 88 | + "env": { |
| 89 | + } |
| 90 | +} |
| 91 | +``` |
| 92 | + |
| 93 | +### Run |
| 94 | + |
| 95 | +This is where the documentation diverges as each environment has its own way of selecting a kernel. To test from command line with Jupyter's console application run: |
| 96 | +
|
| 97 | +```bash |
| 98 | +jupyter console --kernel=sysml |
| 99 | +``` |
| 100 | +
|
| 101 | +Then at the prompt try: |
| 102 | +``` |
| 103 | +In [1]: package test{} |
| 104 | +``` |
0 commit comments