🎉 Back-to-school offer! Save 50% to kick off the academic year.

Code block

/code

Try me!
Python

A code editor block powered by CodeMirror. It's configured to have all default VSCode keybinds built-in by default.

The editor also supports running Python, JavaScript, and Tikz code directly inside of it. It also supports a variety of common Python libraries, such as matplotlib, pandas, scikit-learn, and more.

Learn (some of) the shortcuts:


  • With no text selected, copy current line.


  • With no text selected, cut current line.


  • Paste selected content. Supports pasting copied lines.


  • Swap current line with line directly above.


  • Swap current line with line directly below.


  • Swap current column with the column directly right of it.


  • Swap current column with the column directly left of it.


  • Create copy of current line directly above.


  • Create copy of current line directly below.

Supported packages:

  • aiohttp: Asynchronous HTTP client/server framework
  • aiosignal: Managed signals implementation on top of asyncio
  • altair: Declarative statistical visualization library
  • annotated-types: Typing annotations for runtime type checking
  • asciitree: ASCII trees for Python
  • astropy: Astronomy and astrophysics core library
  • astropy_iers_data: IERS data for Astropy
  • asttokens: Annotate AST trees with source code positions
  • async-timeout: Timeout context manager for asyncio programs
  • atomicwrites: Atomic file writes
  • attrs: Classes without boilerplate
  • autograd: Efficiently computes derivatives of numpy code
  • awkward-cpp: CPU kernels for Awkward Array
  • b2d: Box2D physics engine Python wrapper
  • bcrypt: Modern password hashing library
  • beautifulsoup4: Screen-scraping library
  • biopython: Tools for computational molecular biology
  • bitarray: Efficient array of booleans
  • bitstring: Simple construction, analysis, and modification of binary data
  • bleach: HTML sanitizing library
  • bokeh: Interactive visualization library
  • boost-histogram: Python bindings for the C++ Boost::Histogram library
  • brotli: Brotli compression algorithm
  • cachetools: Extensible memoizing collections and decorators
  • Cartopy: Cartographic tools for Python
  • cbor-diag: CBOR diagnostic notation tools
  • certifi: Collection of root certificates for SSL/TLS verification
  • cffi: Foreign Function Interface for Python calling C code
  • cffi_example: Example package for CFFI
  • cftime: Time-handling functionality from netcdf4-python
  • charset-normalizer: The Real First Universal Charset Detector
  • clarabel: Interior point solver for convex optimization problems
  • click: Composable command line interface toolkit
  • cligj: Click params for commmand line GIS applications
  • cloudpickle: Extended pickling support for Python objects
  • cmyt: Colormaps for YT
  • colorspacious: Powerful, accurate, and easy-to-use Python library for doing colorspace conversions
  • contourpy: Python library for calculating contours of 2D quadrilateral grids
  • coolprop: Thermophysical properties for the masses
  • coverage: Code coverage measurement for Python
  • cramjam: Thin Python bindings to de/compression algorithms in Rust
  • crc32c: Python wrapper for CRC32C algorithm
  • cryptography: Cryptographic recipes and primitives
  • cssselect: CSS Selectors for Python
  • cvxpy-base: A Python-embedded modeling language for convex optimization problems
  • cycler: Composable style cycles
  • cysignals: Interrupt and signal handling for Cython
  • cytoolz: Cython implementation of Toolz
  • decorator: Decorators for Humans
  • demes: A Python API for demes data
  • deprecation: A library to handle automated deprecations
  • distlib: Distribution utilities
  • docutils: Docutils -- Python Documentation Utilities
  • duckdb: DuckDB embedded database
  • ewah_bool_utils: Bit array compression using the Enhanced Word Aligned Hybrid (EWAH) scheme
  • exceptiongroup: Backport of PEP 654 (exception groups)
  • executing: Get the currently executing AST node of a frame, and other information
  • fastparquet: Python support for Parquet file format
  • fiona: Fiona reads and writes spatial data files
  • fonttools: Tools to manipulate font files
  • freesasa: Calculate solvent accessible surface areas of proteins
  • frozenlist: A list-like structure which implements collections.abc.MutableSequence
  • fsspec: File-system specification
  • future: Clean single-source support for Python 3 and 2
  • galpy: Galactic Dynamics in Python
  • gensim: Topic modelling, document indexing and similarity retrieval with large corpora
  • geopandas: Geographic pandas extensions
  • gmpy2: GMP/MPIR, MPFR, and MPC interface to Python 2.6+ and 3.x
  • gsw: Gibbs SeaWater Oceanographic Package of TEOS-10
  • h5py: Read and write HDF5 files from Python
  • html5lib: HTML parser based on the WHATWG HTML specification
  • idna: Internationalized Domain Names in Applications (IDNA)
  • igraph: High performance graph data structures and algorithms
  • imageio: Library for reading and writing a wide range of image, video, scientific, and volumetric data formats
  • iniconfig: Brain-dead simple config-ini parsing
  • ipython: IPython: Productive Interactive Computing
  • jedi: An autocompletion tool for Python that can be used for text editors
  • Jinja2: A very fast and expressive template engine
  • joblib: Lightweight pipelining: using Python functions as pipeline jobs
  • jsonschema: An implementation of JSON Schema validation for Python
  • jsonschema_specifications: The JSON Schema meta-schemas and vocabularies, exposed as a Registry
  • kiwisolver: A fast implementation of the Cassowary constraint solver
  • lakers-python: Python bindings for the LAKERS library
  • lazy-object-proxy: A fast and thorough lazy object proxy
  • lazy_loader: lazy_loader
  • libcst: A concrete syntax tree with AST-like properties for Python 3.5, 3.6, 3.7, 3.8, 3.9, and 3.10 programs
  • lightgbm: LightGBM Python Package
  • logbook: A logging replacement for Python
  • lxml: Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API
  • MarkupSafe: Safely add untrusted strings to HTML/XML markup
  • matplotlib: Python plotting package
  • matplotlib-inline: Inline Matplotlib backend for Jupyter
  • matplotlib-pyodide: Matplotlib for Pyodide
  • memory-allocator: A Python memory allocator for experimentation
  • micropip: A lightweight Python package installer for the web browser
  • mmh3: Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions
  • mne: MNE: Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python
  • more-itertools: More routines for operating on iterables, beyond itertools
  • mpmath: Python library for arbitrary-precision floating-point arithmetic
  • msgpack: MessagePack (de)serializer
  • msgspec: A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML
  • msprime: A fast and accurate coalescent simulator
  • multidict: multidict implementation
  • munch: A dot-accessible dictionary (a la JavaScript objects)
  • mypy: Optional static typing for Python
  • netcdf4: Provides an object-oriented python interface to the netCDF version 4 library
  • networkx: Python package for creating and manipulating graphs and networks
  • newick: A python module to read and write the Newick format
  • nh3: Ammonia: Python refactoring library
  • nlopt: Library for nonlinear optimization, wrapping many algorithms for global and local, constrained or unconstrained, optimization
  • nltk: Natural Language Toolkit
  • numcodecs: A Python package providing buffer compression and transformation codecs for use in data storage and communication applications
  • numpy: Fundamental package for array computing in Python
  • opencv-python: Wrapper package for OpenCV python bindings
  • optlang: Sympy based mathematical programming language
  • orjson: Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy
  • packaging: Core utilities for Python packages
  • pandas: Powerful data structures for data analysis, time series, and statistics
  • parso: A Python Parser
  • patsy: A Python package for describing statistical models and for building design matrices
  • peewee: A small, expressive ORM
  • Pillow: Python Imaging Library (Fork)
  • pillow_heif: Python Pillow High Efficiency Image Format (HEIF) plugin
  • pkgconfig: Interface Python with pkg-config
  • pluggy: Plugin and hook calling mechanisms for python
  • pplpy: Python interface to the Parma Polyhedra Library
  • primecountpy: Python bindings for Kim Walisch's primecount library
  • prompt_toolkit: Library for building powerful interactive command lines in Python
  • protobuf: Protocol Buffers
  • pure_eval: Safely evaluate AST nodes without side effects
  • py: Library with cross-python path, ini-parsing, io, code, log facilities
  • pyclipper: Cython wrapper for the C++ translation of the Angus Johnson's Clipper library
  • pycparser: C parser in Python
  • pycryptodome: Cryptographic library for Python
  • pydantic: Data validation and settings management using Python type hints
  • pydantic_core: Core functionality for pydantic
  • pyerfa: Python bindings for ERFA
  • pygame-ce: Python Game Development
  • Pygments: Syntax highlighting package written in Python
  • pyheif: Python 3 bindings for libheif library
  • pyiceberg: Python implementation of the Apache Iceberg table format
  • pyinstrument: Call stack profiler for Python. Shows you why your code is slow!
  • pynacl: Python binding to the Networking and Cryptography (NaCl) library
  • pyodide-http: A fork of the Python 'http' package for use with Pyodide
  • pyparsing: Python parsing module
  • pyproj: Python interface to PROJ (cartographic projections and coordinate transformations library)
  • pyrsistent: Persistent/Functional/Immutable data structures
  • pysam: Python module for reading and manipulating SAM/BAM/VCF/BCF files
  • pyshp: Pure Python read/write support for ESRI Shapefile format
  • pytest: pytest: simple powerful testing with Python
  • pytest-asyncio: Pytest support for asyncio
  • pytest-benchmark: A pytest fixture for benchmarking code
  • python-dateutil: Extensions to the standard Python datetime module
  • python-flint: Python bindings for FLINT and Arb
  • python-magic: File type identification using libmagic
  • python-sat: A Python library for prototyping with SAT oracles
  • python_solvespace: Python library for SolveSpace CAD software
  • pytz: World timezone definitions, modern and historical
  • pywavelets: PyWavelets, wavelet transform module
  • pyxel: A retro game engine for Python
  • pyxirr: Calculates xirr on irregular cashflows
  • pyyaml: YAML parser and emitter for Python
  • rebound: An open-source multi-purpose N-body code
  • reboundx: A library for including additional forces in REBOUND
  • referencing: JSON Referencing + Python
  • regex: Alternative regular expression module, to replace re
  • requests: Python HTTP for Humans
  • retrying: Retrying
  • rich: Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal
  • river: Online machine learning in Python
  • RobotRaconteur: Robot Raconteur: A communication framework for robotics, automation, and the Internet of Things
  • rpds-py: Python bindings to Rust's persistent data structures
  • ruamel.yaml: ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order
  • rust-panic-test: Test package for Rust panic handling
  • scikit-image: Image processing in Python
  • scikit-learn: A set of python modules for machine learning and data mining
  • scipy: SciPy: Scientific Library for Python
  • screed: A short read database
  • setuptools: Easily download, build, install, upgrade, and uninstall Python packages
  • shapely: Geometric objects, predicates, and operations
  • simplejson: Simple, fast, extensible JSON encoder/decoder for Python
  • sisl: Siesta Input/Output Library
  • six: Python 2 and 3 compatibility utilities
  • smart_open: Utils for streaming large files (S3, HDFS, GCS, Azure Blob Storage, gzip, bz2...)
  • sortedcontainers: Sorted Containers -- Sorted List, Sorted Dict, Sorted Set
  • soupsieve: A modern CSS selector implementation for Beautiful Soup
  • sourmash: Compute and compare MinHash signatures for DNA sequences
  • sparseqr: Sparse QR Decomposition
  • sqlalchemy: Database Abstraction Library
  • stack_data: Extract data from python stack frames and tracebacks for informative displays
  • statsmodels: Statistical computations and models for Python
  • strictyaml: Type-safe YAML parser and validator
  • svgwrite: A Python library to create SVG drawings
  • swiglpk: Swig-generated Python interface to GLPK (GNU Linear Programming Kit)
  • sympy: Computer algebra system (CAS) in Python
  • tblib: Traceback serialization library
  • termcolor: ANSI color formatting for output in terminal
  • texttable: Module for creating simple ASCII tables
  • threadpoolctl: ThreadPool Control
  • tomli: A lil' TOML parser
  • tomli-w: A lil' TOML writer
  • toolz: List processing tools and functional utilities
  • tqdm: Fast, Extensible Progress Meter
  • traitlets: Traitlets Python configuration system
  • traits: Observable typed attributes for Python classes
  • tskit: The tree sequence toolkit
  • typing-extensions: Backported and Experimental Type Hints for Python 3.5+
  • tzdata: Provider of IANA time zone data
  • uncertainties: Transparent calculations with uncertainties on the quantities involved
  • unyt: A package for handling numpy arrays with units
  • urllib3: HTTP library with thread-safe connection pooling, file post, and more
  • wcwidth: Measures the displayed width of unicode strings in a terminal
  • webencodings: Character encoding aliases for legacy web content
  • wordcloud: A little word cloud generator
  • wrapt: Module for decorators, wrappers and monkey patching
  • xarray: N-D labeled arrays and datasets in Python
  • xgboost: Gradient boosting library
  • xlrd: Library for developers to extract data from Microsoft Excel (tm) spreadsheet files
  • xxhash: Python binding for xxHash
  • xyzservices: Source of XYZ tiles providers
  • yarl: Yet another URL library
  • yt: An analysis and visualization toolkit for volumetric data
  • zarr: An implementation of chunked, compressed, N-dimensional arrays for Python
  • zengl: A Python library for portable graphics development
  • zstandard: Zstandard bindings for Python
Learn more
Get a full list of supported Python packages by visiting the Pyodide documentation.