[FEAT:DEV] Adding pixi to manage developer system deps (#4406)
Some checks are pending
Publish dev release of marimo-base / 📤 Publish dev release (push) Waiting to run
Build and Deploy Docs / deploy (push) Waiting to run
playwright / changes (push) Waiting to run
playwright / test (push) Blocked by required conditions
Test BE / changes (push) Waiting to run
Test BE / Test docs (push) Blocked by required conditions
Test BE / ${{ matrix.os }} / Py ${{ matrix.python-version }} / ${{ matrix.dependencies }} deps (core, macos-latest, 3.9) (push) Blocked by required conditions
Test BE / ${{ matrix.os }} / Py ${{ matrix.python-version }} / ${{ matrix.dependencies }} deps (core, ubuntu-latest, 3.10) (push) Blocked by required conditions
Test BE / ${{ matrix.os }} / Py ${{ matrix.python-version }} / ${{ matrix.dependencies }} deps (core, ubuntu-latest, 3.11) (push) Blocked by required conditions
Test BE / ${{ matrix.os }} / Py ${{ matrix.python-version }} / ${{ matrix.dependencies }} deps (core, ubuntu-latest, 3.12) (push) Blocked by required conditions
Test BE / ${{ matrix.os }} / Py ${{ matrix.python-version }} / ${{ matrix.dependencies }} deps (core, ubuntu-latest, 3.13) (push) Blocked by required conditions
Test BE / ${{ matrix.os }} / Py ${{ matrix.python-version }} / ${{ matrix.dependencies }} deps (core, ubuntu-latest, 3.9) (push) Blocked by required conditions
Test BE / ${{ matrix.os }} / Py ${{ matrix.python-version }} / ${{ matrix.dependencies }} deps (core, windows-latest, 3.9) (push) Blocked by required conditions
Test BE / ${{ matrix.os }} / Py ${{ matrix.python-version }} / ${{ matrix.dependencies }} deps (core,optional, macos-latest, 3.9) (push) Blocked by required conditions
Test BE / ${{ matrix.os }} / Py ${{ matrix.python-version }} / ${{ matrix.dependencies }} deps (core,optional, ubuntu-latest, 3.10) (push) Blocked by required conditions
Test BE / ${{ matrix.os }} / Py ${{ matrix.python-version }} / ${{ matrix.dependencies }} deps (core,optional, ubuntu-latest, 3.11) (push) Blocked by required conditions
Test BE / ${{ matrix.os }} / Py ${{ matrix.python-version }} / ${{ matrix.dependencies }} deps (core,optional, ubuntu-latest, 3.12) (push) Blocked by required conditions
Test BE / ${{ matrix.os }} / Py ${{ matrix.python-version }} / ${{ matrix.dependencies }} deps (core,optional, ubuntu-latest, 3.13) (push) Blocked by required conditions
Test BE / ${{ matrix.os }} / Py ${{ matrix.python-version }} / ${{ matrix.dependencies }} deps (core,optional, ubuntu-latest, 3.9) (push) Blocked by required conditions
Test BE / ${{ matrix.os }} / Py ${{ matrix.python-version }} / ${{ matrix.dependencies }} deps (core,optional, windows-latest, 3.9) (push) Blocked by required conditions
Test BE / Test coverage (push) Blocked by required conditions
Test FE / changes (push) Waiting to run
Test FE / 🖥️ Lint, test, build frontend (push) Blocked by required conditions

Commits: 
- **original pixi setup**
- **added docs and make dev and pip as a pixi dependency**

## 📝 Summary & 🔍 Description of Changes

Adds support for [pixi](https://github.com/prefix-dev) (what uv is to
pip, pixi is to conda) + docs in contributing.md
to make the developer environment (node, pnpm, python, pip, hatch,
pre-commit) containerised and reproducible

I added this because issues I encountered when working with my
`brew`-installed node and pnpm (which often was running node 23)
and to improve developer experiences for those who want to contribute to
marimo.

I also added `make dev` to launch both the frontend (port 3000) and
"backend" (marimo edit after `pip install -e '.[dev]'` in a single
command by running the marimo command as a background job and killing it
automatically after completion. The only downside is that the marimo job
runs in the background and you can't access the terminal logs unless you
"connect" to the background job - also only works in linux/macos

**Notes:**

Things right now are a bit confusing between Pixi/hatch and Pip/UV. I
think a separate PR could explore the pip-> UV migration.
For now, I think it's ok to keep pixi and hatch as lots of flows rely on
hatch, and they solve different problems (pixi to manage dev
system dependencies) and hatch to manage marimo-dev/python dependencies
once the system dependencies are installed

to try locally, run the commands as outlined in contributing.md after
running `brew install pixi`

```sh
pixi shell
make fe && make py
hatch shell
make dev
```

## 📋 Checklist

- [x] I have read the [contributor
guidelines](https://github.com/marimo-team/marimo/blob/main/CONTRIBUTING.md).
- [x] For large changes, or changes that affect the public API: this
change was discussed or approved through an issue, on
[Discord](https://marimo.io/discord?ref=pr), or the community
[discussions](https://github.com/marimo-team/marimo/discussions) (Please
provide a link if applicable).
- [ ] I have added tests for the changes made.
- [x] I have run the code and verified that it works as expected.

## 📜 Reviewers

<!--
Tag potential reviewers from the community or maintainers who might be
interested in reviewing this pull request.

Your PR will be reviewed more quickly if you can figure out the right
person to tag with @ -->

@mscolnick @Light2Dark

---------

Co-authored-by: Luis Chaves <lc5415@ic.ac.uk>
Co-authored-by: Myles Scolnick <myles@marimo.io>
This commit is contained in:
Luis Chaves Rodriguez
2025-04-28 15:29:00 +01:00
committed by GitHub
parent b9273e8018
commit 8536dc97c8
6 changed files with 1346 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
# SCM syntax highlighting & preventing 3-way merges
pixi.lock merge=binary linguist-language=YAML linguist-generated=true

4
.gitignore vendored
View File

@@ -120,3 +120,7 @@ marimo/_lsp/
.mypy_cache/
__marimo__
.aider*
# pixi environments
.pixi
*.egg-info

View File

@@ -52,6 +52,35 @@ when making a commit:
pre-commit install
```
You can conveniently create a [pixi](https://github.com/prefix-dev/pixi) environment with all your development dependencies.
These accomplish the next 3 things respectively:
- Install and activate your development environment (`node`, `pnpm`, `make`, `python`, `uv`, `hatch`, `pre-commit`, `pip`)
- Set up your front end and python environment
- Start up your python environment using `hatch`
You can simply run:
```sh
pixi shell
make fe && make py
hatch shell
```
After doing this, you can instantiate your marimo dev environment by running the following command:
```sh
make dev
```
Under the hood this runs the following 2 commands as 2 separate processes:
```sh
# in one terminal
marimo edit --no-token --headless /tmp/nb.py # port 2718
# in another terminal
cd frontend; pnpm dev # this will open at port 3000
```
> [!NOTE]
>
> As an alternative to building from source, you can try developing

View File

@@ -53,6 +53,14 @@ marimo/_static: $(shell find frontend/src) $(wildcard frontend/*)
# 🔧 Install/build lsp if anything in lsp/ has changed
marimo/_lsp: $(shell find lsp)
cd lsp; pnpm install; cd ..; ./scripts/buildlsp.sh
.PHONY: dev
dev:
@echo "Starting development servers..."
@# Start both processes, with marimo in background
@(trap 'kill %1; exit' INT; \
marimo edit --no-token --headless /tmp & \
cd frontend && pnpm dev && cd ..)
#############
# Testing #

1289
pixi.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -524,3 +524,17 @@ dotenv = [".env"]
[tool.marimo.keymap]
vimrc = "configs/.vimrc"
[tool.pixi.workspace]
channels = ["conda-forge"]
platforms = ["osx-arm64"]
[tool.pixi.dependencies]
nodejs = "20.*"
pnpm = "9.*"
hatch = ">=1.14.0,<2"
make = ">=4.4.1,<5"
pre_commit = ">=4.2.0,<5"
uv = ">=0.6.12,<0.7"
python = "3.12.*"
pip = ">=25.0.1,<26"