# Building reproducible Python environments with XARs

DevFeed: [Building reproducible Python environments with XARs](<https://devfeed.tech/articles/building-reproducible-python-environments-with-xars-20155.md>)

Original publisher: [Read original article](<https://blog.janestreet.com/building-reproducible-python-environments-with-xars/>)

Author: Pavel Senchanka

Published: 2023-04-14T00:00:00Z

Content type: article

Language: en

Sources: [Jane Street](<https://devfeed.tech/sources/jane-street.md>)

Topics: [Nix](<https://devfeed.tech/topics/nix.md>), [versioning](<https://devfeed.tech/topics/versioning.md>), [Open Source](<https://devfeed.tech/topics/open-source.md>)

Tags: [build-system](<https://devfeed.tech/tags/build-system.md>), [building](<https://devfeed.tech/tags/building.md>), [conda](<https://devfeed.tech/tags/conda.md>), [decentralization](<https://devfeed.tech/tags/decentralization.md>), [declarative](<https://devfeed.tech/tags/declarative.md>), [deployment](<https://devfeed.tech/tags/deployment.md>), [docker](<https://devfeed.tech/tags/docker.md>), [documentation](<https://devfeed.tech/tags/documentation.md>), [environment](<https://devfeed.tech/tags/environment.md>), [environments](<https://devfeed.tech/tags/environments.md>), [files](<https://devfeed.tech/tags/files.md>), [format](<https://devfeed.tech/tags/format.md>), [integration](<https://devfeed.tech/tags/integration.md>), [js](<https://devfeed.tech/tags/js.md>), [libraries](<https://devfeed.tech/tags/libraries.md>), [machine-learning](<https://devfeed.tech/tags/machine-learning.md>), [monorepo](<https://devfeed.tech/tags/monorepo.md>), [ocaml](<https://devfeed.tech/tags/ocaml.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [python](<https://devfeed.tech/tags/python.md>)

## AI overview

Distributed notebooks depend on libraries in a central repository, so the organization needs a way to expose and release those libraries while letting notebook users upgrade environments at their own pace. It favors declarative, reproducible environments built centrally. Existing tools did not fit its requirements: builds must integrate with OCaml code, and Docker needs host privileges the organization is unwilling to grant. Its in-house js-python system uses the internal build system for OCaml integration and XAR for deployment; the authors say it makes environments easier to create and manage, enabling more decentralization and robustness. The excerpt begins describing problems with Conda environments stored as directories of files, but does not include the details.

## Source excerpt

Our traders and researchers love Python for its agility and for its huge open-source ecosystem, especially when it comes to machine learning. But the heavy use of notebooks can make it difficult to support. Notebooks have a very different lifecycle than regular code, and aren't always rigorously version controlled. And while most of our code (much of it written in OCaml) lives in a monorepo, putting all notebooks there is difficult; many notebooks end up being stored all over the place.