---
title: "Building reproducible Python environments with XARs"
description: "Jane Street replaced a shared, mutable Conda environment on NFS with js-python, a system that builds Python environments centrally and deploys them as XAR files: single squashfs-based, Zstd-compressed images that mount as a normal file tree."
url: "https://swe.quest/articles/building-reproducible-python-environments-with-xars-4bcb65b9387aa718"
canonical: "https://blog.janestreet.com/building-reproducible-python-environments-with-xars/"
source: "Jane Street Tech Blog"
published: "2023-04-14"
difficulty: "medium"
kind: "Case study"
reading_minutes: 8
tags: ["python","deployment","build-systems","ml-platform"]
---

# Building reproducible Python environments with XARs

A post on [Jane Street Tech Blog](https://swe.quest/sources/jane-street.md), published 2023-04-14, 8 min read, Case study. Original: [https://blog.janestreet.com/building-reproducible-python-environments-with-xars/](https://blog.janestreet.com/building-reproducible-python-environments-with-xars/)

## Summary

Jane Street replaced a shared, mutable Conda environment on NFS with js-python, a system that builds Python environments centrally and deploys them as XAR files: single squashfs-based, Zstd-compressed images that mount as a normal file tree. Packing the environment into one file fixed kernel startup, which had taken minutes on NFS because imports read tens of thousands of files. Statically bundling internal Python libraries and OCaml bindings into each XAR means one code revision fully describes an environment, so rollouts and rollbacks cover everything at once, with immutable "stable" tags alongside a continuously deployed "nightly". The tradeoff is slow hotfixes (10–20 minutes to rebuild), handled by splitting code into immutable "core" inside the environment and editable "leaf" notebooks and scripts outside it.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Python](https://swe.quest/tags/python.md) (Languages)
- [Deployment](https://swe.quest/tags/deployment.md) (Reliability & operations)
- [Build systems](https://swe.quest/tags/build-systems.md) (Engineering practices)
- [ML platforms](https://swe.quest/tags/ml-platform.md) (AI & ML)

## Prerequisites

- Python virtual environments ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))
- Jupyter notebooks
- static vs dynamic linking

## Keywords

XAR, js-python, Conda, squashfs, Zstd, NFS, OCaml

## Related posts

- [How to create reproducible ZIPs for AWS Lambda](https://swe.quest/articles/how-to-create-reproducible-zips-for-aws-lambda-0b8d5e6a7113fc44.md): ClickHouse · 2025-08-28 · Medium · 5 min read · Serverless, Build systems, Infrastructure as code, CI/CD, Python
  Deterministic ZIP artifacts for AWS Lambda let Terraform/OpenTofu skip redeploying unchanged functions on every \`tofu apply\`.
- [Improving machine learning iteration speed with faster application build and packaging](https://swe.quest/articles/improving-machine-learning-iteration-speed-with-faster-application-build-and-76fe5935fe0be272.md): Meta Engineering · 2024-01-29 · Medium · 5 min read · Build systems, Developer productivity, ML platforms, Storage systems, Python
  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).
- [Inside the Codex sandbox](https://swe.quest/articles/inside-the-codex-sandbox-f3a152d1a955ae56.md): OpenAI · 2026-11-18 · Medium · 23 min read · Sandboxing & isolation, AI agents, AI for coding, Security, Configuration management
  Codex sandboxes agent-run commands in the user's own environment by using each OS's native sandboxing facilities rather than VMs or containers, so native toolchains like Xcode and the iOS simulator keep working.
- [Advancing Our Chef Infrastructure: Safety Without Disruption](https://swe.quest/articles/advancing-our-chef-infrastructure-safety-without-disruption-fc96edfc3e0961ec.md): Slack Engineering · 2025-10-23 · Medium · 13 min read · Configuration management, Deployment, Infrastructure as code, Resilience, Cloud platforms
  Slack split its single production Chef environment into six AZ-mapped environments (prod-1 to prod-6) so newly provisioned nodes no longer pull a possibly bad config from one shared source during scale-outs. prod-1 acts as an hourly canary taking the latest cookbook artifact, while prod-2 through prod-6 advance on a release train where a new version starts only after the previous one reaches prod-6.
- [How two engineer side projects became the agent taking action inside Dropbox](https://swe.quest/articles/how-two-engineer-side-projects-became-the-agent-taking-action-inside-dropbox-2abfc90167ee3b16.md): Dropbox Tech · 2026-11-05 · Medium · 10 min read · AI agents, Sandboxing & isolation, Virtualization, Identity & auth, System design
  Dropbox's file-acting agent grew out of two engineer prototypes, a server-side sandbox with installed software and a desktop chat UI with permission controls, merged into one system.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
