You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
152 lines
3.0 KiB
152 lines
3.0 KiB
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Binderlite Demo\n",
|
|
"\n",
|
|
"\n",
|
|
"\n",
|
|
"Project source code: [binderlite-demo](https://git.sr.ht/~jgart/binderlite-demo).\n",
|
|
"\n",
|
|
"Example Binderlite Repository: [binderlite-example](https://github.com/jgarte/binderlite-example)."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"---\n",
|
|
"\n",
|
|
"## Using IPython\n",
|
|
"\n",
|
|
"### Create an environment with IPython"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
";;guix environment my-ipython <- python-ipython python-ipykernel"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"---\n",
|
|
"\n",
|
|
"### Run code in the IPython kernel"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
";;guix environment my-ipython\n",
|
|
"# This is python lang !\n",
|
|
"def hello ():\n",
|
|
" print (\"Hello Jupyter !\")\n",
|
|
" \n",
|
|
"hello ()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
";;guix environment my-ipython\n",
|
|
"import os\n",
|
|
"os.getcwd()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"os.getuid()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"os.getpid()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"os.listdir('/')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## A Matplotlib environment"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
";;guix environment matplotlib-env <- python-ipython python-ipykernel python-ipywidgets python-matplotlib"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
";;guix environment matplotlib-env\n",
|
|
"%matplotlib inline\n",
|
|
"from matplotlib import pyplot as plt\n",
|
|
"from matplotlib import style\n",
|
|
"import random\n",
|
|
"x = random.sample(range(1, 5000), 1000)\n",
|
|
"num_bins = 100\n",
|
|
"n, bins, patches = plt.hist(x, num_bins, facecolor='green', alpha=0.5)\n",
|
|
"\n",
|
|
"plt.title('Histogram Example')\n",
|
|
"plt.xlabel('Values')\n",
|
|
"plt.xlabel('Counts')\n",
|
|
"plt.show() "
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Guix",
|
|
"language": "scheme",
|
|
"name": "guix"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": "scheme",
|
|
"file_extension": ".scm",
|
|
"mimetype": "application/x-scheme",
|
|
"name": "guile",
|
|
"pygments_lexer": "scheme",
|
|
"version": "3.0"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|