All Projects → jtpio → Jupyterlab Python Bytecode

jtpio / Jupyterlab Python Bytecode

Licence: bsd-3-clause
JupyterLab extension to explore CPython Bytecode

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Jupyterlab Python Bytecode

jupyterlab-sparkmonitor
JupyterLab extension that enables monitoring launched Apache Spark jobs from within a notebook
Stars: ✭ 78 (+36.84%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
jupyterlab-theme-solarized-dark
JupyterLab 2/3 Solarized Dark extension
Stars: ✭ 61 (+7.02%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
ipydagred3
ipywidgets library for drawing directed acyclic graphs in jupyterlab using dagre-d3
Stars: ✭ 38 (-33.33%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
Jupyterlab Dash
An Extension for the Interactive development of Dash apps in JupyterLab
Stars: ✭ 342 (+500%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
jupyterlab-python-file
JupyterLab extension to create Python files
Stars: ✭ 50 (-12.28%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
Jupyterlab templates
Support for jupyter notebook templates in jupyterlab
Stars: ✭ 223 (+291.23%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
Debugger
A visual debugger for Jupyter notebooks, consoles, and source files
Stars: ✭ 476 (+735.09%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
Jupyterlab Hub
Deprecated: JupyterLab extension for running JupyterLab with JupyterHub
Stars: ✭ 181 (+217.54%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
Jupyterlab Lsp
Coding assistance for JupyterLab (code navigation + hover suggestions + linters + autocompletion + rename) using Language Server Protocol
Stars: ✭ 796 (+1296.49%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
theme-darcula
A handsome Darcula theme for Jupyterlab. The first jlab theme to include dark scrollbars
Stars: ✭ 136 (+138.6%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
Best Of Jupyter
🏆 A ranked list of awesome Jupyter Notebook, Hub and Lab projects (extensions, kernels, tools). Updated weekly.
Stars: ✭ 200 (+250.88%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
Lantern
Data exploration glue
Stars: ✭ 292 (+412.28%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
Awesome Jupyterlab Extension
😎 A curated list of awesome Jupyterlab extension projects. 🌠 Detailed introduction with images.
Stars: ✭ 198 (+247.37%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
ipyp5
p5.js Jupyter Widget
Stars: ✭ 33 (-42.11%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
Awesome Jupyter
A curated list of awesome Jupyter projects, libraries and resources
Stars: ✭ 2,523 (+4326.32%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
jupyterlab-heroku
JupyterLab extension to deploy applications to Heroku
Stars: ✭ 20 (-64.91%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
Jupyterlab Topbar
JupyterLab Top Bar extension
Stars: ✭ 86 (+50.88%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
Jupyterlab System Monitor
JupyterLab extension to display system metrics
Stars: ✭ 154 (+170.18%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
ipylab
Control JupyterLab from Python Notebooks with Jupyter Widgets 🧪 ☢️ 🐍
Stars: ✭ 101 (+77.19%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension
jupyterlab-topbar
JupyterLab Top Bar extension
Stars: ✭ 95 (+66.67%)
Mutual labels:  jupyter, jupyterlab, jupyterlab-extension

jupyterlab-python-bytecode

Github Actions Status Binder npm code style: prettier

JupyterLab extension to inspect Python Bytecode.

screencast

Try it online

Try the extension in your browser with Binder:

Binder

Prerequisites

  • JupyterLab 1.0+
  • ipykernel or xeus-python

To install JupyterLab:

conda install -c conda-forge jupyterlab

Installation

jupyter labextension install jupyterlab-python-bytecode

Features

  • Live Bytecode preview
  • Choose the kernel for a file (if not already started). This allows comparing the bytecode output for different versions of Python.
  • Check the Avanced Settings Editor to tweak some of the settings

Contributing

See CONTRIBUTING.md to know how to contribute and setup a development environment.

How it works

Disassembling the Python code is done by connecting to a kernel, and sending the following code for evaluation from the lab extension:

import dis
dis.dis(code_to_evaluate)

As mentioned in the documentation, there is not guarantee on the stability of the bytecode across Python versions:

Bytecode is an implementation detail of the CPython interpreter. No guarantees are made that bytecode will not be added, removed, or changed between versions of Python. Use of this module should not be considered to work across Python VMs or Python releases.

Example

For example, if the Python file contains the following lines:

import math

print(math.pi)

The following code will be sent to the kernel for evaluation:

import dis
dis.dis("""
import math

print(math.pi)
""")

Which will return (example for CPython 3.6.6):

  1           0 LOAD_CONST               0 (0)
              2 LOAD_CONST               1 (None)
              4 IMPORT_NAME              0 (math)
              6 STORE_NAME               0 (math)

  3           8 LOAD_NAME                1 (print)
             10 LOAD_NAME                0 (math)
             12 LOAD_ATTR                2 (pi)
             14 CALL_FUNCTION            1
             16 POP_TOP
             18 LOAD_CONST               1 (None)
             20 RETURN_VALUE

Comparing versions of CPython

If you have several versions of Python installed on your machine (let's say in different conda environments), you can use the extension to check how the bytecode might differ.

The following example illustrates the introduction of the new CALL_METHOD opcode introduced in CPython 3.7:

python_comparison

Comparing for and while loops

Original example from Disassembling Python Bytecode, by Peter Goldsborough

for_while

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].