A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
docs: package management (#5051)
Akshay Agrawalc05af137217e
diff --git a/README.md b/README.mdindex b55108a280..5214b5f371 100644--- a/README.md+++ b/README.md@@ -43,7 +43,7 @@ and deployable as apps.- 🖐️ **interactive:** [bind sliders, tables, plots, and more](https://docs.marimo.io/guides/interactivity.html) to Python — no callbacks required- 🐍 **git-friendly:** stored as `.py` files- 🛢️ **designed for data**: query dataframes, databases, warehouses, or lakehouses [with SQL](https://docs.marimo.io/guides/working_with_data/sql.html), filter and search [dataframes](https://docs.marimo.io/guides/working_with_data/dataframes.html)-- 🔬 **reproducible:** [no hidden state](https://docs.marimo.io/guides/reactivity.html#no-hidden-state), deterministic execution, [built-in package management](https://docs.marimo.io/guides/editor_features/package_management.html)+- 🔬 **reproducible:** [no hidden state](https://docs.marimo.io/guides/reactivity.html#no-hidden-state), deterministic execution, [built-in package management](https://docs.marimo.io/guides/package_management/)- 🏃 **executable:** [execute as a Python script](https://docs.marimo.io/guides/scripts.html), parameterized by CLI args- 🛜 **shareable**: [deploy as an interactive web app](https://docs.marimo.io/guides/apps.html) or [slides](https://docs.marimo.io/guides/apps.html#slides-layout), [run in the browser via WASM](https://docs.marimo.io/guides/wasm.html)- 🧩 **reusable:** [import functions and classes](https://docs.marimo.io/guides/reusing_functions/) from one notebook to another@@ -114,7 +114,7 @@ Organize your notebooks to best fit the stories you'd like to tell.**Built-in package management.** marimo has built-in support for all majorpackage managers, letting you [install packages on import](https://docs.marimo.io/guides/editor_features/package_management.html). marimo can even[serialize package-requirements](https://docs.marimo.io/guides/package_reproducibility.html)+requirements](https://docs.marimo.io/guides/package_management/inlining_dependencies/)in notebook files, and auto install them inisolated venv sandboxes.diff --git a/README_Chinese.md b/README_Chinese.mdindex a4db4eae6d..7f0b5c018c 100644--- a/README_Chinese.md+++ b/README_Chinese.md@@ -85,7 +85,7 @@ Marimo 确保了您的代码、输出和程序的状态始的一致性,解决**确定性执行顺序**。笔记本按照基于变量引用而非单元格页面位置的确定性顺序执行。您可以根据想要讲述的故事组织笔记本。-**内置包管理**。marimo内置支持所有主要的包管理器,允许您[在导入时安装包](https://docs.marimo.io/guides/editor_features/package_management.html)。marimo甚至可以[序列化包依赖](https://docs.marimo.io/guides/package_reproducibility.html)到笔记本文件中,并在隔离的venv沙箱中自动安装它们。+**内置包管理**。marimo内置支持所有主要的包管理器,允许您[在导入时安装包](https://docs.marimo.io/guides/editor_features/package_management.html)。marimo甚至可以[序列化包依赖](https://docs.marimo.io/guides/package_management/inlining_dependencies/)到笔记本文件中,并在隔离的venv沙箱中自动安装它们。**功能齐全**。marimo集成了GitHub Copilot、AI助手、Ruff代码格式化、HTML导出、快速代码补全、[VS Code扩展](https://marketplace.visualstudio.com/items?itemName=marimo-team.vscode-marimo)、交互式数据框查看器和[更多](https://docs.marimo.io/guides/editor_features/index.html)便捷功能。diff --git a/README_Japanese.md b/README_Japanese.mdindex 31d177d523..f68574f9d3 100644--- a/README_Japanese.md+++ b/README_Japanese.md@@ -85,7 +85,7 @@ marimoはノートブックのコード、出力、プログラムの状態の**決定論的な実行順序** ノートブックは、セルのページ上の位置ではなく、変数の参照に基づいて決定論的な順序で実行されます。伝えたいストーリーに最適な方法でノートブックを整理できます。-**組み込みパッケージ管理** marimoには主要なパッケージマネージャーのサポートが組み込まれており、[インポート時にパッケージをインストール](https://docs.marimo.io/guides/editor_features/package_management.html)できます。marimoは[パッケージの要件をシリアル化](https://docs.marimo.io/guides/package_reproducibility.html)してノートブックファイルに保存し、隔離されたvenv環境に自動的にインストールすることもできます。+**組み込みパッケージ管理** marimoには主要なパッケージマネージャーのサポートが組み込まれており、[インポート時にパッケージをインストール](https://docs.marimo.io/guides/editor_features/package_management.html)できます。marimoは[パッケージの要件をシリアル化](https://docs.marimo.io/guides/package_management/inlining_dependencies/)してノートブックファイルに保存し、隔離されたvenv環境に自動的にインストールすることもできます。**必要な機能がすべて揃っている** marimoにはGitHub Copilot、AIアシスタント、Ruffコードフォーマット、HTML出力、高速コード補完、[VS Code拡張機能](https://marketplace.visualstudio.com/items?itemName=marimo-team.vscode-marimo)、インタラクティブなデータフレームビューワー、[その他多くの](https://docs.marimo.io/guides/editor_features/index.html)便利な機能が含まれています。diff --git a/README_Spanish.md b/README_Spanish.mdindex f88a7d80c0..3ae442ce12 100644--- a/README_Spanish.md+++ b/README_Spanish.md@@ -108,7 +108,7 @@ Organize your notebooks to best fit the stories you'd like to tell.**Gestión de paquetes integrado.** marimo has built-in support for all majorpackage managers, letting you [install packages on import](https://docs.marimo.io/guides/editor_features/package_management.html). marimo can even[serialize package-requirements](https://docs.marimo.io/guides/package_reproducibility.html)+requirements](https://docs.marimo.io/guides/package_management/inlining_dependencies/)in notebook files, and auto install them inisolated venv sandboxes.diff --git a/docs/guides/editor_features/package_management.md b/docs/guides/editor_features/package_management.mdindex 53e2a5347c..de475ce38d 100644--- a/docs/guides/editor_features/package_management.md+++ b/docs/guides/editor_features/package_management.md@@ -1,6 +1,8 @@# Package management-marimo supports package management for `pip, rye, uv, poetry, pixi`. When marimo comes across a module that is not installed, you will be prompted to install it using your preferred package manager.+marimo supports package management for `pip`, `uv`, `poetry`, `pixi`, and+`rye`. When marimo comes across a module that is not installed, you will be+prompted to install it using your preferred package manager.Once the module is installed, all cells that depend on the module will be rerun.@@ -15,4 +17,4 @@ they use. This makes it possible to share standalone notebooks without shipping`requirements.txt` files alongside them, and guarantees your notebooks willwork weeks, months, even years into the future.-To learn more, see the [Package Reproducibility Guide](../package_reproducibility.md).+To learn more, see the [package reproducibility guide](../package_management/inlining_dependencies.md).diff --git a/docs/guides/editor_features/watching.md b/docs/guides/editor_features/watching.mdindex 47009d3d9f..5801762eb7 100644--- a/docs/guides/editor_features/watching.md+++ b/docs/guides/editor_features/watching.md@@ -145,7 +145,7 @@ at the command-line, or rename your file to have an `.md` extension in the notebmarimo conforms to standard markdown document format, and will render mostplaces like Github. Metadata in this file format is saved in the frontmatter,which marimo may use for information like-[sandboxing](../package_reproducibility.md), and the marimo version. All other+[sandboxing](../package_management/inlining_dependencies.md), and the marimo version. All otherfields are kept, but ignored.For execution, marimo extracts code fences that contain `marimo` in braces. Fordiff --git a/docs/guides/index.md b/docs/guides/index.mdindex ec39c3f56b..e6abdf5ede 100644--- a/docs/guides/index.md+++ b/docs/guides/index.md@@ -16,7 +16,7 @@ These guides cover marimo's core concepts.| [Expensive notebooks](expensive_notebooks.md) | Tips for working with expensive notebooks || [Understanding errors](understanding_errors/index.md) | Understanding marimo's constraints on notebook code || [Working with data](working_with_data/index.md) | Using SQL cells, no-code dataframe, and reactive plots |-| [Package reproducibility](package_reproducibility.md) | Making notebooks reproducible down to the packages |+| [Package management](package_management/index.md) | Inlining dependencies in notebook files and other package management guides || [Generate with AI](generate_with_ai/index.md) | Generate notebooks with AI || [Editor features](editor_features/index.md) | View variables, dataframe schemas, docstrings, and more || [Using your own editor](editor_features/watching.md) | Edit notebooks in your own editor and stream changes back to the browser |diff --git a/docs/guides/package_management/importing_packages.md b/docs/guides/package_management/importing_packages.mdnew file mode 100644index 0000000000..a70e8bd4fe--- /dev/null+++ b/docs/guides/package_management/importing_packages.md@@ -0,0 +1,187 @@+# Importing packages++By default, marimo searches for packages in the [virtual+environment](https://docs.python.org/3/tutorial/venv.html) it was started in.+For example, if you run++```console+source /path/to/venv/bin/activate+marimo edit my_notebook.py+```++you'll be able to import packages installed in the environment you just+activated. You'll also be able to install packages into this environment using+the marimo editor's [package management UI](installing_packages.md).++!!! question "Using uv?"++ See our [uv guide](using_uv.md) for details on how to use marimo as part of+ uv projects or as self-contained scripts.++## Inlining dependencies++As an alternative to manually creating and managing a virtual environment,+you can let marimo manage virtual environments for you, on a per-notebook+basis.++If you create a notebook with the `--sandbox` flag —++```console+marimo edit --sandbox my_notebook.py+```++— marimo will start your notebook in an isolated environment and keep track of+the dependencies you install from the editor. These dependencies are inlined in+the notebook file, so that the next time you run the notebook,+marimo will run it in an isolated environment with just those dependencies.++See our guide on [inlining dependencies](inlining_dependencies.md)+to learn more.++!!! question "What about kernels?"++ Unlike Jupyter, marimo does not have a concept of "kernels"; notebooks simply+ use the active virtual environment.++ The main feature of kernels is to allow different notebooks to depend on+ different packages, even within the same project. marimo's package sandbox+ provides this functionality, while also being far simpler to use than+ custom kernels.+++## Importing local modules++marimo resolves imports just as Python does: by searching for packages+in the directories listed in `sys.path`. That means that in addition to the+virtual environment, marimo will search for modules in the directory in which+the notebook lives. For example, when you run++```console+marimo edit /path/to/notebook_dir/notebook.py+```++marimo will look for modules in `/path/to/notebook_dir`. However, this means+that you may need to take additional steps to import modules that live outside+this directory. What steps you take depends on whether your code is organized+as a Python package.++!!! tip "Remember: notebooks are just Python programs"++ In the examples below, notebooks are stored in a separate notebooks+ directory, which is traditional. However, since marimo notebooks are just+ Python modules, you can just as well include them in your `src/` directory+ alongside other Python modules.+++### From non-package projects++You can configure the Python path to accommodate directory structures that look like this:++```+.+├── notebooks+│ └── my_notebook.py+├── pyproject.toml+└── src+ └── my_module.py+```++In particular, to make `import my_module` work when running++/// tab | edit++```console+marimo edit notebooks/my_notebook.py+```++///++/// tab | run++```console+marimo run notebooks/my_notebook.py+```++///++/// tab | script++```console+python notebooks/my_notebook.py+```++///++add the following configuration to your `pyproject.toml`:++```toml title="pyproject.toml"+[tool.marimo.runtime]+pythonpath = ["src"]+```++### From packages++!!! question "New to Python packages?"++ A [Python package](https://docs.python.org/3/tutorial/modules.html#packages) is a+ way of structuring Python source files so that the collection of files can+ be installed in an environment, imported using "dot" notation like+ `from my_package.my_module import my_function`, and optionally uploaded+ to package registries like PyPI.++ If you are new to packages, and find you need to create one, we recommend+ using [uv](https://docs.astral.sh/uv/) (`uv init --package`).++A package has a directory structure like this:++```+.+├── notebooks+│ └── my_notebook.py+├── pyproject.toml+└── src+ └── my_package+ ├── __init__.py+ └── my_module.py+```++Say `my_notebook` has a cell with++```python+from my_package import my_module+```++Provided that++/// tab | edit++```console+marimo edit notebooks/my_notebook.py+```++///++/// tab | run++```console+marimo run notebooks/my_notebook.py+```++///++/// tab | script++```console+python notebooks/my_notebook.py+```++///++is run from an environment in which your package is installed, marimo+will import `my_module` without issue.++For example, if you are using `uv`, simply run++```console+uv run --with marimo marimo edit notebooks/my_notebook.py+```diff --git a/docs/guides/package_management/index.md b/docs/guides/package_management/index.mdnew file mode 100644index 0000000000..07da857b60--- /dev/null+++ b/docs/guides/package_management/index.md@@ -0,0 +1,11 @@+# Package management++The following guides cover how to import, install, and otherwise manage+the Python dependencies of your notebooks.++| Guide | Description |+| ----------------------------------------------------- | ------------------------------------------------------------ |+| [Importing packages](importing_packages.md) | How marimo finds packages on import |+| [Installing packages](installing_packages.md) | Installing packages with marimo's UI |+| [Inlining dependencies](inlining_dependencies.md) | Create self-contained notebooks by inlining dependencies in notebook files |+| [Using uv](using_uv.md) | A guide to using the uv package manager with marimo |diff --git a/docs/guides/package_reproducibility.md b/docs/guides/package_management/inlining_dependencies.mdsimilarity index 66%rename from docs/guides/package_reproducibility.mdrename to docs/guides/package_management/inlining_dependencies.mdindex 7187532870..37e3361558 100644--- a/docs/guides/package_reproducibility.md+++ b/docs/guides/package_management/inlining_dependencies.md@@ -1,12 +1,12 @@-# Package Reproducibility+# Inlining dependenciesmarimo is the only Python notebook that is reproducible down to the packages,-serializing requirements in notebook files and running notebooks in-sandboxed venvs. This lets you share standalone notebooks without shipping-`requirements.txt` files alongside them, and guarantees your notebooks will-work weeks, months, even years into the future.+letting you inline Python dependencies in notebook files and running notebooks+in isolated or "sandboxed" venvs. This lets you share standalone notebooks+without shipping `requirements.txt` files alongside them, and guarantees your+notebooks will work weeks, months, even years into the future.-To opt-in to package reproducibility, use the `sandbox` flag:+To opt-in to dependency inlining, use the `sandbox` flag:=== "edit"@@ -37,6 +37,12 @@ marimo's sandbox provides two key benefits. (1) Notebooks that carry their owndependencies are easy to share — just send the `.py` file. (2) Isolating anotebook from other installed packages prevents obscure bugs.+You can also run sandboxed notebooks as scripts:++```console+uv run notebook.py+```+!!! note "Requires uv"Sandboxed notebooks require the uv package manager@@ -81,17 +87,28 @@ notebook's dependencies and Python version, and looks something like this:### Adding and removing packages-When you import a module, if marimo detects that it is a third-party-package, it will automatically be added to the script metadata. Removing-an import does _not_ remove it from the script metadata (since library-code may still use the package).+**Using the marimo editor.** When you import a module in the marimo editor, if+marimo detects that it is a third-party package, it will automatically be added+to the script metadata. Removing an import does _not_ remove it from the script+metadata (since library code may still use the package).Adding packages via the package manager panel will also add packages to scriptmetadata, and removing packages from the panel will in turn remove them fromthe script metadata.-You can also edit the script metadata manually in an editor like VS Code or-neovim.+**Adding packages manually.** You can manually manage your notebook's+requirements:++* edit the script metadata manually in an editor like VS Code or neovim.+* use `uv` from the command-line:++```console+uv add --script notebook.py numpy+```++```console+uv remove --script notebook.py numpy+```### Package locations@@ -103,7 +120,8 @@ for more information.### Local development with editable installs-When developing a local package, you can install it in editable mode using the `[tool.uv.sources]` section in the script metadata. For example:+When developing a local package, you can install it in editable mode using the+`[tool.uv.sources]` section in the script metadata. For example:```python# /// script@@ -117,11 +135,17 @@ When developing a local package, you can install it in editable mode using the `# ///```-This is particularly useful when you want to test changes to your package without reinstalling it. The package will be installed in "editable" mode, meaning changes to the source code will be reflected immediately in your notebook.+This is particularly useful when you want to test changes to your package+without reinstalling it. The package will be installed in "editable" mode,+meaning changes to the source code will be reflected immediately in your+notebook.### Specifying alternative package indexes-When you need to use packages from a custom PyPI server or alternative index, you can specify these in your script metadata using the `[[tool.uv.index]]` section. This is useful for private packages or when you want to use packages from a specific source.+When you need to use packages from a custom PyPI server or alternative index,+you can specify these in your script metadata using the `[[tool.uv.index]]`+section. This is useful for private packages or when you want to use packages+from a specific source.```python# /// script@@ -151,33 +175,13 @@ In this example:This approach ensures that specific packages are always fetched from your designated custom index, while other packages continue to be fetched from the default PyPI repository.-## Markdown file support--Sandboxing support is also provided in [marimo's markdown file format](./editor_features/watching.md#as-markdown) under the-`pyproject` entry of your frontmatter.--```markdown-----title: My Notebook-marimo-version: 0.0.0-pyproject: |- requires-python: ">=3.11"- dependencies:- - pandas==<version>- - altair==<version>-----```--Note, that sandboxing will still work in the `header` entry of markdown-frontmatter.-## ConfigurationRunning marimo in a sandbox environment uses `uv` to create an isolated virtualenvironment. You can use any of `uv`'s [supported environmentvariables](https://docs.astral.sh/uv/configuration/environment/).-#### Choosing the Python version+### Choosing the Python versionFor example, you can specify the Python version using the `UV_PYTHON` environment variable:@@ -185,10 +189,50 @@ For example, you can specify the Python version using the `UV_PYTHON` environmenUV_PYTHON=3.13 marimo edit --sandbox notebook.py```-#### Other common configuration+### Other common configurationAnother common configuration is `uv`'s link mode:```bashUV_LINK_MODE="copy" marimo edit --sandbox notebook.py```++## Sharing on the web++You can also upload sandboxed notebooks to the web, such as on GitHub, and have+others run them locally with a single command:++```+uvx marimo edit --sandbox https://gist.githubusercontent.com/kolibril13/a59135dd0973b97d488ba21c650667fe/raw/5f98021b5d3c024d5827fa9464787517495178b4/marimo_minimal_numpy_example.py+```++**Note:**++1. This command will run code from a URL. Make sure you trust the source before proceeding.+2. Upon execution, you’ll be prompted:+ ```+ Would you like to run it in a secure docker container? [Y/n]:+ ```+ To proceed securely, ensure you have [Docker](https://www.docker.com/) installed and running, then press `Y`.++++## Specifying dependencies in Markdown files++Sandboxing support is also provided in [marimo's markdown file+format](../editor_features/watching.md#as-markdown) under the+`pyproject` entry of your frontmatter.++```markdown+---+title: My Notebook+marimo-version: 0.0.0+pyproject: |+ requires-python: ">=3.11"+ dependencies:+ - pandas==<version>+ - altair==<version>+---+```++diff --git a/docs/guides/package_management/installing_packages.md b/docs/guides/package_management/installing_packages.mdnew file mode 100644index 0000000000..ec28acacd8--- /dev/null+++ b/docs/guides/package_management/installing_packages.md@@ -0,0 +1,22 @@+# Installing packages++marimo supports package management for `pip`, `uv`, `poetry`, `pixi`, and+`rye`. When marimo comes across a module that is not installed, you will be+prompted to install it using your preferred package manager. Once the module is+installed, all cells that depend on the module will be rerun+(or marked as stale).++You can also install (and remove) packages using the package manager sidebar panel.++!!! note "Resolving package names"++ We use a heuristic for guessing the package name in your registry (e.g. PyPI) from the module name. It is possible that the package name is different from the module name. If you encounter an error, please [file an issue](https://github.com/marimo-team/marimo/issues) or help us by adding your mapping [directly to the codebase](https://github.com/marimo-team/marimo/blob/main/marimo/_runtime/packages/module_name_to_pypi_name.py).++**Notes.**++* When using imperative style package managers like `pip`, packages are installed directly+in the active virtual environment.+* When using `uv`, marimo will decide whether to add it to your `pyproject.toml`+(if running as part of a uv project), or whether to install it imperatively with `uv pip` (otherwise).+* When running in a [package sandbox](inlining_dependencies.md), package installation+and removal also updates the notebook's inline dependencies.diff --git a/docs/guides/package_management/using_uv.md b/docs/guides/package_management/using_uv.mdnew file mode 100644index 0000000000..ccffc79e48--- /dev/null+++ b/docs/guides/package_management/using_uv.md@@ -0,0 +1,183 @@+# Using uv++[uv](https://docs.astral.sh/uv/) is an extremely fast Python package and+project manager: you can use it to install packages, manage the dependencies+of Python projects, and run scripts. While marimo supports all major package+managers, it integrates especially tightly with uv. In particular, marimo's+package sandbox feature, which lets you [inline+dependencies](inlining_dependencies.md) in notebook files, requires uv.++!!! note "No prior knowledge required"++ This guide teaches you the basics of using `uv` with marimo. It assumes zero+ familiarity with `uv`.++You can manage your notebooks' dependencies in three different ways:++1. inline dependencies: [inlining dependencies](inlining_dependencies.md) in notebook files, using `marimo edit --sandbox notebook.py`+2. projects: using a `uv` project , which define dependencies declaratively in a `pyproject.toml`+ file;+3. non-project environment: dependencies are imperatively installed++We'll walk through each of these three ways in this guide.++## Using inline dependencies++The easiest way to get started is to use marimo's [package sandbox+feature](inlining_dependencies.md), which manages your dependencies for you.+Create or edit your notebook with [`uvx`+command](https://docs.astral.sh/uv/concepts/tools/#the-uv-tool-interface),+making sure to include the `--sandbox` flag:++<!-- TODO propagating marimo version into the script metadata -->++```console+uvx marimo edit --sandbox my_notebook.py+```++This command installs marimo in a temporary environment, activates it, then+runs your marimo notebook. The `--sandbox` flag what tells marimo to keep+track of your dependencies and store them in the notebook file. If there are+any dependencies already tracked in the file, this command will download+them and install them in the environment.++Run sandboxed notebooks as scripts with++```console+uv run my_notebook.py+```++### From URLs++You can also upload sandboxed notebooks to the web, such as on GitHub, and have others run+them locally with a single command:++```+uvx marimo edit --sandbox https://gist.githubusercontent.com/kolibril13/a59135dd0973b97d488ba21c650667fe/raw/5f98021b5d3c024d5827fa9464787517495178b4/marimo_minimal_numpy_example.py+```++**Note:**++1. This command will run code from a URL. Make sure you trust the source before proceeding.+2. Upon execution, you’ll be prompted:+ ```+ Would you like to run it in a secure docker container? [Y/n]:+ ```+ To proceed securely, ensure you have [Docker](https://www.docker.com/) installed and running, then press `Y`.+++To learn more, read our full guide on using [inline dependencies](inlining_dependencies.md).++## Using uv projects++A [`uv` project](https://docs.astral.sh/uv/guides/projects/) is a directory in which you can store Python code, including+notebooks, alongside a pyproject.toml file that declares the project's+dependencies.++### Creating a project++Create a project with `uv init`:++```console+uv init hello-world+cd hello-world+```++!!! tip "Starter template"++ Get started quickly by cloning our [starter template](https://github.com/marimo-team/marimo-uv-starter-template).+++This creates a pyproject.toml and some starter code.++Next, add marimo to your project:++```console+uv add marimo+```++??? note "Omitting marimo from your project"++ Adding marimo to your project is optional. Instead, you can+ run marimo in a temporary environment that has access to+ your project's dependencies using `uv run --with marimo marimo edit`.++### Running marimo++Once you've added marimo, use the `uv run` command+to run the version of marimo installed in your project:++```console+uv run marimo edit my_notebook.py+```++Starting marimo in this way will let marimo import any of the packages+installed in your project.++**Scripts.** Run marimo notebooks as scripts with++```console+uv run my_notebook.py+```++which will run your notebook in an environment containing your project dependencies.++### Adding and removing dependencies++#### Using the uv command-line++Use `uv add` to add dependencies:++```console+uv add numpy+```++You can also specify a version++```console+uv add numpy==2.26+```++Remove packages with `uv remove`:++```console+uv remove numpy+```++#### Using the marimo editor++If you started marimo with `uv run marimo edit`, the marimo editor's [package+management features](installing_packages.md) will add and remove packages from+your pyproject.toml, so there's no need to use the `uv` command-line if you+don't want to.++## Using marimo in a non-project environment++If you are used to a venv and pip based workflow, you can use the `uv venv` and+`uv pip` commands for a similar but more performant experience:++* `uv venv` creates a virtual environment in the current directory, at `.venv`+* `uv pip` lets you install and uninstall packages in the venv++### Example++=== "macOS and Linux"++ ```console+ $ uv venv+ $ uv pip install numpy+ $ uv pip install marimo+ $ .venv/bin/marimo edit+ ```++=== "Windows"++ ```pwsh-session+ PS> uv venv+ PS> uv pip install numpy+ PS> uv pip install marimo+ PS> .venv\Scripts\marimo edit+ ```++From here, `import numpy` will work within the notebook, and marimo's UI installer will add+packages to the environment with `uv pip install` on your behalf.diff --git a/docs/index.md b/docs/index.mdindex 725f5fab1a..2533b0c3a1 100644--- a/docs/index.md+++ b/docs/index.md@@ -131,7 +131,7 @@ Organize your notebooks to best fit the stories you'd like to tell.**Built-in package management.** marimo has built-in support for all majorpackage managers, letting you [install packages on import](guides/editor_features/package_management.md). marimo can even[serialize package-requirements](guides/package_reproducibility.md)+requirements](guides/package_management/inlining_dependencies.md)in notebook files, and auto install them inisolated venv sandboxes.diff --git a/docs/vercel.json b/docs/vercel.jsonindex aacb41ee3e..42c768c45d 100644--- a/docs/vercel.json+++ b/docs/vercel.json@@ -1,5 +1,10 @@{"redirects": [+ {+ "source": "/guides/package_reproducibility/",+ "destination": "/guides/package_management/inlining_dependencies/",+ "permanent": true+ },{"source": "/guides/sql.html","destination": "/guides/working_with_data/sql.html",diff --git a/mkdocs.yml b/mkdocs.ymlindex cec2c6b5e9..3b517d54c6 100644--- a/mkdocs.yml+++ b/mkdocs.yml@@ -98,7 +98,12 @@ nav:- DataFrames: guides/working_with_data/dataframes.md- SQL: guides/working_with_data/sql.md- Plotting: guides/working_with_data/plotting.md- - Package reproducibility: guides/package_reproducibility.md+ - Package management:+ - Package management: guides/package_management/index.md+ - Importing packages: guides/package_management/importing_packages.md+ - Installing packages: guides/package_management/installing_packages.md+ - Inlining dependencies: guides/package_management/inlining_dependencies.md+ - Using uv: guides/package_management/using_uv.md- Generate with AI:- Generate with AI: guides/generate_with_ai/index.md- Generate entire notebooks: guides/generate_with_ai/text_to_notebook.md