Port of nbdev to write SCALA / chisel library entirely in notebooks
Project description
chisel-nbdev
The goal of this repo is to provide a seamless way to develop Chisel code in a Jupyter Notebook environment.
Requirements (mac)
- setup some virtualenv (im using python3.8.2)
pip install virtualenv
- find your python3 binary:
which python3
which for me is/usr/local/bin/python3
- create virtualenv:
python3 -m virtualenv --python=/usr/local/bin/python3 chisel_nb_env
- activate it:
source chisel_nb_env/bin/activate
- install jupyterlab (which includes jupyter notebook):
pip install jupyterlab
## Requirements (mac) - setup some virtualenv (im using python3.8.2)
pip install virtualenv
- find your python3 binary:
which python3
which for me is/usr/local/bin/python3
- create virtualenv:
python3 -m virtualenv --python=/usr/local/bin/python3 chisel_nb_env
- activate it:
source chisel_nb_env/bin/activate
- install jupyterlab (which includes jupyter notebook):
pip install jupyterlab
Setup the Jupyter Scala kernel Almond (https://almond.sh)
- Borrowed from the Chisel-Bootcamp install guide: https://github.com/freechipsproject/chisel-bootcamp/blob/master/Install.md
- If you experience errors or issues with this section, try running rm -rf ~/.local/share/jupyter/kernels/scala/ first.
- Next, download coursier (our dependency manager) and use it to install almond (our kernel wrapped around Ammonite) (see here for the source for these instructions):
curl -L -o coursier https://git.io/coursier-cli && chmod +x coursier
SCALA_VERSION=2.12.10 ALMOND_VERSION=0.9.1
./coursier bootstrap -r jitpack \
-i user -I user:sh.almond:scala-kernel-api_$SCALA_VERSION:$ALMOND_VERSION \
sh.almond:scala-kernel_$SCALA_VERSION:$ALMOND_VERSION \
--sources --default=true \
-o almond
./almond --install
- You can delete coursier and almond files if you so desire.
Start JupyterLab
- Making sure you are in your virtualenv then run:
jupyter lab
Project Structure
- By default, notebook source files (.ipynb) will live in the
nbs
folder. - Upon running
notebook2script()
the notebooks innbs
will export code to.sc
files in thenbdev
folder. These are auto-generated files that can be imported back into notebooks via Ammonite: For exampleimport $file.MyMod, MyMod._
imports the contents of the fileMyMod.sc
.
Testing Notebooks
- Currently can run
nbdev_test_nbs('MyMod.ipynb')
to run all of the tests contained in theMyMod.ipynb
notebook. - Tests are identified by either omitting any export flags (
//export
) or by including special flags defined insettings.ini
(i.e//slowtest
orchiseltest
).
settings.ini
- Configurations belong in this file.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
chisel_nbdev-0.1.1.tar.gz
(33.9 kB
view details)
Built Distribution
File details
Details for the file chisel_nbdev-0.1.1.tar.gz
.
File metadata
- Download URL: chisel_nbdev-0.1.1.tar.gz
- Upload date:
- Size: 33.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94092cd917de04805245d5cb54312abad657c3e47881b1fd8bdcd9ca3cee99e2 |
|
MD5 | 5a476ea0bb5c1dec3187b4c64c15c1d6 |
|
BLAKE2b-256 | 55a67b3d96dbab7fafa3b7df0cd09e420fde49e6ee9144d13246dce5c796f36f |
File details
Details for the file chisel_nbdev-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: chisel_nbdev-0.1.1-py3-none-any.whl
- Upload date:
- Size: 36.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3509492506098644d5111e345e43d05f8fc5e508f41df05aa71896a37cc7dbe6 |
|
MD5 | 3c157b94bd074e9a708dfbf2456ffd91 |
|
BLAKE2b-256 | ccfeeaae84064e20b3fbc3a9b4d3cc2eccf6fc2831a2d3f1872a86beb9868228 |