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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dodona/papyros

v4.0.7

Published

Scratchpad for multiple programming languages in the browser.

Downloads

761

Readme

Papyros

Papyros is a programming scratchpad in the browser. It allows running code directly in your browser, no installation required. Right now, the focus is on providing a great experience for Python, while also supporting JavaScript. By taking away obstacles between students and coding, the learning experience becomes smoother and less error-prone.

Currently, Papyros provides support for the following programming languages:

  • Python, powered by Pyodide
  • JavaScript, powered by your browser

Try it Online

Start coding directly in your browser.


Use papyros in your project

Installation

Install via npm or yarn:

npm install @dodona/papyros
# or
yarn add @dodona/papyros

Setup input handling

Running interactive programs in the browser requires special handling of synchronous input. Papyros supports two approaches (via sync-message):

COOP/COEP headers

Add the following HTTP headers to your server responses:

{
  "Cross-Origin-Opener-Policy": "same-origin",
  "Cross-Origin-Embedder-Policy": "require-corp"
}

These headers are required to enable SharedArrayBuffer, which is the preferred way to handle synchronous input. They need to be set on all assets that are loaded, including scripts, images, fonts, etc.

Service Worker

If you cannot set these headers, you can use a service worker to handle input. We provide a compiled and minified version of the InputServiceWorker in the dist folder. You need to serve this file from the root of your domain (i.e. /input-sw.js). You can then register the service worker in your application before launching: papyros.serviceWorkerName = 'input-sw.js';.


Usage

Minimal setup

If you only want to use the state and runner logic without UI components:

import { papyros } from "@dodona/papyros";

papyros.launch(); // heavy operation, loads workers and Pyodide
papyros.runner.code = "print(input())";

papyros.io.subscribe(
  () => (papyros.io.awaitingInput ? papyros.io.provideInput("foo") : ""),
  "awaitingInput"
);

await papyros.runner.start();
console.log(papyros.runner.io.output[0].content);

Minimal setup with components

Papyros provides four web components for visualization. Each expects a papyros state instance, but defaults to the global papyros.

<script type="module">
  import { papyros } from "@dodona/papyros";

  papyros.launch();
</script>

<p-code-runner></p-code-runner>
<p-debugger></p-debugger>
<p-input></p-input>
<p-output></p-output>

Theming

Papyros uses Material Web Components for buttons, inputs, sliders, etc. All styling is driven by Material color system CSS variables (--md-sys-color-...). Generate your own theme using the Material Theme Builder.

  • Three example themes (light + dark) are provided via papyros.constants.themes.
  • A theme picker component is available out of the box.

Structure

The codebase organized into clear layers:

  • backend: code execution functionality (runs in Web Workers)
  • communication: helpers to connect frontend and backend
  • frontend: all browser-side code
    • state: state management (e.g. execution state, debugger, input/output)
    • components: visualization of that state, as Lit web components

Components

<p-code-runner>

A CodeMirror 6 editor to edit, run, and debug code. Additional buttons can be added via the .buttons slot.

<p-input>

Lets users provide input (batch or interactive), passed to papyros.io.

<p-output>

Visualizes program output: stdout, stderr, and images.

<p-debugger>

Displays execution traces using @dodona/json-tracer.

State API

A Papyros instance contains multiple logical parts:

  • papyros.constants: general settings, constants, and themes (can be overridden).
  • papyros.debugger: debug frames and currently active frame.
  • papyros.examples: available code examples.
  • papyros.i18n: translations (extend or override as needed).
  • papyros.io: input/output handling. Subscribe to awaitingInput to supply input when needed.
  • papyros.runner: code, execution state, programming language. Run code with papyros.runner.start().
  • papyros.test: test code (appended to the code document).

Development

# Clone the repository:
git clone [email protected]:dodona-edu/papyros.git
cd papyros
# Install dependencies:
yarn install
# Build the python packages:
yarn setup
# Start a local server with live reload:
yarn start

Publishing

# Build as library
yarn build:lib
# Publish to npm
yarn publish