A magma kernel for Jupyter, based on bash_kernel
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.
Antonio De Lucreziis b3e9bbb9a1 updated references 1 month ago
examples updated references 1 month ago
magma_kernel added an example, updated readme, fixed deprecations 1 month ago
.gitignore added an example, updated readme, fixed deprecations 1 month ago
LICENSE Major rewrite 7 years ago
MANIFEST.in Major rewrite 7 years ago
README.md updated readme 1 month ago
requirements.txt added an example, updated readme, fixed deprecations 1 month ago
setup.py added an example, updated readme, fixed deprecations 1 month ago

README.md

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:

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

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):

#!/bin/sh
exec ssh -qt user@remote "magma $*"

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

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

# 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

# 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, which was in turn based on @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