You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.1 KiB
Markdown

# Magma Jupyter Kernel
A simple Jupyter kernel for the Magma computer algebra system.
## Requirements
- Magma must be installed and runnable using the standard path, i.e., typing the command `magma`
will run Magma.
- Jupyter running on Python 3.
## Installation
If `pip` and `python` point to their Python 3 versions, you can install the kernel as a user with
the commands:
```sh
pip install git+https://git.phc.dm.unipi.it/phc/magma_kernel
python -m magma_kernel.install
```
On some systems, you may need to use `pip3` and `python3` instead.
### Using a remote magma installation
3 months ago
If the magma instance is on a remote machine, you can add an ssh key to the remote machine and
create a script like the following (e.g., in `~/.local/bin/magma`, ensuring that the directory is in
your `PATH`):
```sh
3 months ago
#!/bin/sh
exec ssh -qt user@remote "magma $*"
```
3 months ago
Then run `chmod +x ~/.local/bin/magma` to make it executable. Now, if you install the kernel as
above you can use it "locally" by running `magma` as if it were installed on your machine.
## Usage
3 months ago
You need the local `magma` executable to be in your `PATH` to use the kernel, you can also use the
remote magma installation as described above. Now to use the kernel, run one of the following
commands
```sh
# Select "New" -> "Notebook" and then in the new tab select "Magma" as the kernel
jupyter notebook
# Or run the console with the Magma kernel (still better than pure magma)
jupyter console --kernel magma
```
## Development
To install the kernel in development mode, clone the repository and run
```sh
# Create a virtual environment
python -m venv venv
source venv/bin/activate
# Locally install the kernel
pip install -r requirements.txt
python -m magma_kernel.install
```
## Credits
This code is based on a Magma kernel for IPython written by [@nbruin](https://github.com/nbruin),
3 months ago
which was in turn based on [@cgranade/magma_kernel](https://github.com/cgranade/magma_kernel) which
in turn was based on the Bash example kernel by Thomas Kluyver. Improvements made in the current
version include:
- Removed some deprecated function usages
- Added a `requirements.txt` file