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 python3which 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 python3which 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
nbsfolder. - Upon running
notebook2script()the notebooks innbswill export code to.scfiles in thenbdevfolder. 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.ipynbnotebook. - Tests are identified by either omitting any export flags (
//export) or by including special flags defined insettings.ini(i.e//slowtestorchiseltest).
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.5.tar.gz
(35.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chisel_nbdev-0.1.5.tar.gz.
File metadata
- Download URL: chisel_nbdev-0.1.5.tar.gz
- Upload date:
- Size: 35.2 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 |
c437aeab8ea58bbc59ae13d70801edaf1ee983f5fe3bbe5341a8a4f77198b832
|
|
| MD5 |
11c44115db59d30562aeddf2db61c093
|
|
| BLAKE2b-256 |
d55023045fff945ac03c02c5c368632f092d69f653c47a734d1cab2cb1fc6a06
|
File details
Details for the file chisel_nbdev-0.1.5-py3-none-any.whl.
File metadata
- Download URL: chisel_nbdev-0.1.5-py3-none-any.whl
- Upload date:
- Size: 39.1 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 |
0f7d308b5426af5d45e5914554fc7952483bb0a18b11ea4ea40230d4bfbcb556
|
|
| MD5 |
fe3ca61289ec6f5164c1345a864b21bb
|
|
| BLAKE2b-256 |
3a531fe672b1ab2928255805f7d16bb775e92fb5288a3b0e4ea9130d0a872aa8
|