npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@deepnote/blocks

v1.3.6

Published

The blocks package defines the Deepnote Blocks.

Readme

@deepnote/blocks

The blocks package defines the Deepnote Blocks.

Overview

This package provides TypeScript types and utilities for working with Deepnote notebook blocks, including:

  • Block Types: Code, SQL, Text, Markdown, Input, Visualization, Button, Big Number, Image, Separator
  • Python Code Generation: Convert blocks to executable Python code
  • Markdown Conversion: Convert text blocks to/from markdown format

Supported Block Types

Code & Data Blocks

  • code: Python code execution
  • sql: SQL query execution with variable assignment

Input Blocks

  • input-text: Single-line text input
  • input-textarea: Multi-line text input
  • input-checkbox: Boolean checkbox
  • input-select: Single or multi-select dropdown
  • input-slider: Numeric slider
  • input-file: File path selector
  • input-date: Date picker
  • input-date-range: Date range with presets (past 7 days, past month, etc.)

Display Blocks

  • visualization: Interactive charts using Vega-Lite
  • big-number: KPI display with Jinja2 templates
  • button: Interactive button with variable control

Text & Markdown Blocks

  • text-cell-h1/h2/h3: Headings
  • text-cell-p: Paragraphs
  • text-cell-bullet: Bullet lists
  • text-cell-todo: Checkboxes
  • text-cell-callout: Highlighted notes
  • separator: Horizontal rule (<hr>)
  • image: Embedded images with alignment and sizing

Usage

Python Code Generation

import { createPythonCode } from "@deepnote/blocks";

// Code block
const codeBlock = {
  type: "code",
  content: 'print("Hello, world!")',
  // ...
};
createPythonCode(codeBlock); // 'print("Hello, world!")'

// SQL block
const sqlBlock = {
  type: "sql",
  content: "SELECT * FROM users",
  metadata: {
    deepnote_variable_name: "df_users",
    sql_integration_id: "abc-123",
  },
  // ...
};
createPythonCode(sqlBlock);
// df_users = _dntk.execute_sql('SELECT * FROM users', 'SQL_ABC_123', ...)

// Input checkbox
const checkboxBlock = {
  type: "input-checkbox",
  metadata: {
    deepnote_variable_name: "is_enabled",
    deepnote_variable_value: true,
  },
  // ...
};
createPythonCode(checkboxBlock); // is_enabled = True

// Input date range
const dateRangeBlock = {
  type: "input-date-range",
  metadata: {
    deepnote_variable_name: "date_range",
    deepnote_variable_value: "past7days",
  },
  // ...
};
createPythonCode(dateRangeBlock);
// from datetime import datetime as _deepnote_datetime, timedelta as _deepnote_timedelta
// date_range = [_deepnote_datetime.now().date() - _deepnote_timedelta(days=7), ...]

Markdown Conversion

import { createMarkdown, stripMarkdown } from "@deepnote/blocks";

const headingBlock = {
  type: "text-cell-h1",
  content: "Main Title",
  // ...
};

const markdown = createMarkdown(headingBlock); // "# Main Title"
const plainText = stripMarkdown(headingBlock); // "Main Title"

const todoBlock = {
  type: "text-cell-todo",
  content: "Complete task",
  metadata: { checked: true },
  // ...
};

createMarkdown(todoBlock); // "- [x] Complete task"

const separatorBlock = {
  type: "separator",
  content: "",
  // ...
};

createMarkdown(separatorBlock); // "<hr>"

const imageBlock = {
  type: "image",
  content: "",
  metadata: {
    deepnote_img_src: "https://example.com/image.png",
    deepnote_img_width: "500",
    deepnote_img_alignment: "center",
  },
  // ...
};

createMarkdown(imageBlock); // '<img src="https://example.com/image.png" width="500" align="center" />'