• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ebanner/pynt: Bridging the gap between jupyter notebooks and text editors/IDEs.

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

ebanner/pynt

开源软件地址:

https://github.com/ebanner/pynt

开源编程语言:

Python 65.0%

开源软件介绍:

PYNT (PYthon iNTeractive)

Get your code into a jupyter notebook. Anytime. Anywhere.

Check out my SciPy 2018 talk for the motivation and a feature tour of pynt.

MELPA PyPI version Built with Spacemacs

Features

Generate jupyter notebooks on the fly

No more copy and pasting code into jupyter notebooks. Each line of code gets its own cell.

Alt Text

Attach a jupyter notebook to a running process

Run a command which hits the code in the notebook. Restart the notebook kernel to attach to that process.

Alt Text

Syntax transformations

Unroll the first pass of loops for increased interactivity.

Alt Text

Scroll the resulting jupyter notebook with the code buffer

Never forget which cell a code line corresponds to.

Alt Text

Quick Start

Disclaimer: pynt is in beta. Make sure to back-up your code before using it!

Install the codebook module with pip.

$ pip install git+https://github.com/ebanner/pynt # latest version of codebook in github

Then install pynt in emacs through MELPA.

M-x package-install RET pynt

The next time you visit a python file pynt mode will be active.

What is pynt?

pynt is an emacs minor mode for getting source code into jupyter notebooks so you can hack on it there. If you have access to source code and a command to call it with then you can get your code into a jupyter notebook.

However, just pasting your code into one big jupyter notebook cell is not particularly useful. pynt also

  • splits up code into cells so it's easy to evaluate small bits
  • sets up the state required to run code (by allowing you to attach notebooks to external processes)
  • takes code previously buried in various namespaces (e.g. functions and loops) and exposes them to the global namespace so you can interact with them

Using pynt

It is highly recommended that you familiarize yourself with Emacs IPython Notebook (EIN) first as pynt, at its core, is a tool to make working with EIN easier.

Once you have opened a python file and pynt mode is active, cursor over to the region of code you would like to dump into a notebook and hit C-c C-s. If you need to "re-dump" the code into the notebook then hit C-c C-e.

If you want to attach a jupyter notebook to a running process, then run a command which hits the jupyter notebook code. Restart the jupyter notebook kernel with C-c C-r (ein:notebook-restart-kernel-command). When you see the message ein: [info] Starting channels WS: ... your notebook is attached!

How pynt works

pynt uses a custom kernel manager for attaching to jupyter notebook kernels started via third-party processes. When pynt generates a jupyter notebook from a code region that code region is replaced with a IPython kernel breakpoint so that subsequent commands that hit it will start a jupyter kernel for the notebook to attach to. See here for more information.

pynt also makes heavy use of the ast module to parse your code into chunks which are then dumped into notebook cells.

Related Projects

pynt is a tool that truly stands on the shoulders of giants. Here are some projects where if they had not existed, then pynt would not have been possible.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap