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
1.8 KiB
Markdown
76 lines
1.8 KiB
Markdown
3 months ago
|
# 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
|
||
|
|
||
|
If the magma instance is on a remote machine, you can add an ssh key to the remote machine and add
|
||
|
the following function in your `.bashrc` or `.zshrc`
|
||
|
|
||
|
```sh
|
||
|
function magma() {
|
||
|
ssh -qt user@remote "magma $*"
|
||
|
}
|
||
|
```
|
||
|
|
||
|
Then, you can use it "locally" with the following command:
|
||
|
|
||
|
```sh
|
||
|
$ magma
|
||
|
```
|
||
|
|
||
|
## Usage
|
||
|
|
||
|
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),
|
||
|
which was in turn based on [@cgranade/magma_kernel](https://github.com/cgranade/magma_kernel) the
|
||
|
Bash example kernel by Thomas Kluyver. Improvements made in the current version include:
|
||
|
|
||
|
- Removed some deprecated function usages
|
||
|
|
||
|
- Added a `requirements.txt` file
|