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

@platformatic/python-node

v2.0.0

Published

Run ASGI-compatible Python apps in Node.js

Downloads

251

Readme

@platformatic/python-node

A high-performance Node.js native addon that enables running ASGI-compatible Python applications directly within Node.js environments. The Node.js host can communicate directly with the Python guest app without any network involved, allowing near-zero communcation overhead.

This module provides a bridge between Node.js and Python, allowing you to:

  • Run Python ASGI applications (FastAPI, Starlette, Django ASGI, etc.) inside Node.js processes
  • Handle HTTP requests with ASGI 3.0 protocol support
  • Process requests concurrently using async Python code execution
  • Integrate Python services into existing Node.js applications seamlessly
  • Support virtual environments automatically for proper Python dependency isolation

The module implements an ASGI server that translates between Node.js HTTP requests and Python ASGI applications, enabling you to leverage Python's rich ecosystem within Node.js applications.

Key Features

  • ASGI 3.0 Support: HTTP and Lifespan protocols (WebSocket support planned)
  • Async/Sync Methods: Both handleRequest() and handleRequestSync()
  • Virtual Environment Detection: Automatic Python environment discovery
  • Cross-Platform: Native binaries for macOS and Linux
  • High Performance: Rust-based implementation with minimal overhead

Requirements

  • Node.js: ≥ 20.0.0
  • Python: ≥ 3.8 with asyncio support
  • System: macOS (arm64, x64) or Linux (x64-gnu)

The module automatically detects and uses Python virtual environments via the VIRTUAL_ENV environment variable.

Installation

npm install @platformatic/python-node

API Reference

For complete API documentation, see REFERENCE.md.

Basic Usage

# fastapi_app.py
from fastapi import FastAPI
from pydantic import BaseModel

app = FastAPI()

class Item(BaseModel):
    name: str
    price: float

@app.post("/items/")
async def create_item(item: Item):
    return {"name": item.name, "price": item.price}
import { Python, Request } from '@platformatic/python-node'

const python = new Python({
  docroot: './python-apps',
  appTarget: 'fastapi_app:app'
})

// POST with JSON body
const response = await python.handleRequest(new Request({
  method: 'POST',
  url: '/items/',
  headers: {
    'Content-Type': 'application/json'
  },
  body: Buffer.from(JSON.stringify({
    name: 'Widget',
    price: 29.99
  }))
}))

const result = JSON.parse(response.body.toString())
console.log(result) // { name: 'Widget', price: 29.99 }