I found these two things save me some time while developing,
bash kernel for notebooks
To install,
git clone git@github.com:takluyver/bash_kernel.git
cd bash_kernel
source activate fastai
python -m bash_kernel.install --sys-prefix
This is handy because I often find bash easiest for certain tasks, and building a script in a notebook is easier than running commands in the shell and copying them into an editor
The benefit over python notebook + shell is the syntax becomes simpler when saving or passing variables, and the syntax highlighting is better. Of course, if someone else has a better way, Iām all ears.
ctag vim navigation
Also, unrelated, I found this guide useful for explaining how to do the navigation Jeremy did in Vim with Ctrl+] to move around source code via ātagsā
Basically, something like this,
sudo apt-get install exuberant-ctags
ctags -R -o ~/ctags ~/fastai-pytorch/fastai/ ~/anaconda3/envs/fastai/lib/python3.6/
echo --python-kinds=-i > ~/.ctags
Add to crontab (might need to change ~ to full path),
1 * * * * ~/ctags ~/fastai-pytorch/fastai/ ~/anaconda3/envs/fastai/lib/python3.6/ 2>/dev/null
notes
-
-i in the ~/.ctags file means āignore importsā as discussed here. You might also add -v
-
this doesnāt seem to work for python core libraries, for example, if I put the cursor on
join
inos.path.join
it takes me to the definition ofjoin
inasyncio/queues.py
instead ofntpath.py
(which has the code for os.path), but at least it works for jumping around fastai code. Perhaps better still is to use an IDE like Pycharm
Again, if there is an easier or more correct way to set this up, Iām happy to hear it.