Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Replit 3 min read Announcement mediumAdept

Introducing the Python package cache

Replit pre-populates pip's cache with the most popular Python packages and pre-built wheels so UPM can skip most downloads and compilation when a repl starts. A read-only snapshot of the cache is bind-mounted into each repl and overlay-mounted onto ~/.cache/pip with a per-repl writable upper directory, giving copy-on-write isolation that prevents cross-repl cache poisoning while still letting users add packages. Because pip's cache is content-addressable, shared files can be found by hash and integrity-checked. The cache is rebuilt weekly from PyPI download stats and cut average install time by about 40% on Always On repls, with Maven and npm support planned next.

Assumes: pip package installationLinux mounts

Related posts

  • How we went from supporting 50 languages to all of them

    Replit easyNovice

    Replit replaced its ever-growing monolithic Docker OS image with Nix, giving every repl access to over 30,000 OS packages through a declarative `replit.nix` file. The packages are prebuilt into a roughly 1 TB shared Nix store disk image that is mounted at `/nix` in every repl, so nothing needs to be downloaded. Nix's content-addressed store lets many versions coexist without conflicts, and each environment exposes only the packages it declares. Planned work includes `.replit` configuration for things like LSP and caching nix-shell environments to remove rebuild delay on run, which an edit notes has since shipped.

  • Faster Nix Repl Startup

    Replit mediumAdept

    Replit removed the multi-second (sometimes tens of seconds) "Loading Nix environment" delay on repl startup by caching the environment variables exported by nix-shell after evaluating replit.nix. Because each repl gets a seeded Nix store containing most of nixpkgs, evaluation rarely adds new store paths, so the cached PATH and other variables can be persisted to the repl's filesystem and reused across restarts. The cache is invalidated whenever a cached variable references a Nix store path that no longer exists, falling back to full evaluation so correctness is preserved.

  • Improving machine learning iteration speed with faster application build and packaging

    Meta Engineering mediumAdept

    Meta cut ML engineers' build and packaging overhead by double-digit percentages by tackling build non-determinism, pruning dependencies, and replacing monolithic XAR executables with an incremental Content Addressable Filesystem (CAF). Non-determinism from compilers and build rules is mitigated inside the Remote Execution service that Buck2 sends nearly all build actions to, so stable warm revisions can reuse cached outputs. CAF describes each executable as a flat manifest of content digests, skips uploads already in CAS, and fetches only missing content via per-host CAS daemons that share data peer-to-peer over Owl. Btrfs compression and copy-on-write keep on-disk size close to XAR while sharing files across executables. Planned next steps are lazy on-demand fetching (LazyCAF) and putting all ML engineers on uniform revisions to raise cache hit rates.

  • Replit²

    Replit mediumAdept

    A Replit Nix repl can act as a code-execution backend: a Koa.js server spawns a Python child process and feeds user code through stdin, using code.InteractiveInterpreter, which avoids shell injection and keeps crashes from taking down the server. A second repl works as a proxy that load-balances across forked compute nodes, tracking per-node concurrent calls in Replit Database with a usage threshold and HTML-escaping input. A simple web component front end calls the cluster's API. A security section notes the limits of this sandboxing approach.

  • Package managers have an integrity problem

    Trail of Bits mediumAdept

    An experiment across 25 popular package managers tested whether each detects a compromised repository injecting malicious code into legitimate packages. Fewer than half verify lockfile hashes by default, only Go and vcpkg verify every download, and only Go checks signatures by default. The tests used a Docker and mitmproxy harness that simulated a malicious server. Several failures are documented design choices rather than bugs: Pub and older pnpm overwrite mismatched hashes, Conan and CocoaPods use MD5 or SHA-1 identifiers that are never rechecked, Composer trusts GitHub-served ZIPs, and cpanminus still uses plain HTTP. Lockfiles serve many purposes besides integrity, which helps explain the gaps.

The quest for software engineering knowledge.

Look:
Layout: