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

pythonlib

v2.0.4

Published

Python standard library for TypeScript - itertools, functools, collections, datetime, re, and more. Zero dependencies. Full TypeScript support.

Readme

pythonlib

Python's Beloved Standard Library — Now in TypeScript

npm version npm downloads Zero Dependencies TypeScript Node.js Bun License


Miss itertools.combinations? Love collections.Counter? Wish you had functools.lru_cache in JavaScript?

pythonlib brings Python's most powerful utilities to TypeScript — zero dependencies, full type safety, tree-shakeable.

Install

npm install pythonlib

Why pythonlib?

| What You Get | Why It Matters | | --------------------------- | ------------------------------------------------- | | Zero dependencies | No supply chain bloat, minimal attack surface | | Full TypeScript support | Generics, type inference, autocomplete everywhere | | Tree-shakeable | Bundle only what you use | | camelCase API | Feels native in TypeScript | | Works everywhere | Browsers, Node.js, Deno, Bun, Workers |

Quick Examples

itertools — Combinatorics Made Easy

import { combinations, permutations, product } from "pythonlib/itertools"

// All 2-element combinations
[...combinations([1, 2, 3], 2)]
// → [[1, 2], [1, 3], [2, 3]]

// Cartesian product
[...product(["a", "b"], [1, 2])]
// → [["a", 1], ["a", 2], ["b", 1], ["b", 2]]

collections — Data Structures That Just Work

import { Counter, defaultdict, deque } from "pythonlib/collections"

// Count anything
const votes = new Counter(["alice", "bob", "alice", "alice"])
votes.mostCommon(1) // → [["alice", 3]]

// No more "undefined" checks
const graph = defaultdict(() => [])
graph.get("node1").push("node2") // Just works!

// Double-ended queue with O(1) operations
const dq = new deque([1, 2, 3])
dq.appendLeft(0) // [0, 1, 2, 3]
dq.pop() // [0, 1, 2]

functools — Functional Programming Utilities

import { lruCache, partial, reduce } from "pythonlib/functools"

// Memoization with one line
const fib = lruCache((n: number): number => (n <= 1 ? n : fib(n - 1) + fib(n - 2)))
fib(100) // Instant, even for large values

// Partial application
const greet = (greeting: string, name: string) => `${greeting}, ${name}!`
const sayHello = partial(greet, "Hello")
sayHello("World") // → "Hello, World!"

Builtins — Python's Greatest Hits

import { range, enumerate, zip, sorted, reversed } from "pythonlib"

// Python-style range
for (const i of range(5)) {
} // 0, 1, 2, 3, 4
for (const i of range(1, 10, 2)) {
} // 1, 3, 5, 7, 9

// Enumerate with index
for (const [i, item] of enumerate(["a", "b", "c"])) {
  console.log(i, item) // 0 "a", 1 "b", 2 "c"
}

// Zip multiple iterables
;[...zip([1, 2, 3], ["a", "b", "c"])]
// → [[1, "a"], [2, "b"], [3, "c"]]

Available Modules

| Module | Highlights | Docs | | ----------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------ | | pythonlib | range, enumerate, zip, sorted, len, min, max | | | pythonlib/itertools | chain, combinations, permutations, product, cycle | | | pythonlib/functools | lruCache, partial, reduce, pipe, compose | | | pythonlib/collections | Counter, defaultdict, deque, OrderedDict | | | pythonlib/math | sqrt, floor, ceil, factorial, gcd, pi | | | pythonlib/random | randInt, choice, shuffle, sample, random | | | pythonlib/datetime | datetime, date, time, timedelta | | | pythonlib/re | search, match, findAll, sub, compile | | | pythonlib/json | loads, dumps with Python semantics | | | pythonlib/string | Template, capWords, ascii_lowercase | | | pythonlib/os | path.join, environ, getcwd | | | pythonlib/pathlib | Path class for filesystem operations | | | pythonlib/glob | File pattern matching | | | pythonlib/hashlib | md5, sha256, sha512 hashing | | | pythonlib/base64 | Base64 encoding/decoding | | | pythonlib/uuid | UUID generation | |

Runtime Support

Works everywhere JavaScript runs:

  • Node.js (v22, v24)
  • Bun
  • Deno
  • Browsers (Chrome, Firefox, Safari)
  • Edge (Cloudflare Workers, Vercel, AWS Lambda)

Documentation

| Resource | Description | | ---------------------------------------------------------------------------- | ------------------------------------------ | | Homepage | Project overview and quick start | | Runtime Guide | Detailed usage guide | | API Reference | Complete API documentation for all modules |

Related

  • python2ts — Transpile Python to TypeScript automatically
  • GitHub — Source code, issues, contributions welcome

License

MIT © Sebastian Software GmbH