0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

pyproject.toml を汚さずに marimo を使う

Posted at

Python を書くときはだいたい以下の流れで書いています。世の人はREPL駆動開発とか言うらしい。

  • REPLで試行錯誤しながらロジックを積み上げる
  • ロジックが固まったら関数に清書して、ライブラリ (src/) に入れる
  • REPLから import して動くか確認する
  • テスト (tests/) に移動する
  • カバレッジを眺めて足りなければテストを追加

この試行錯誤と動作確認に ipython や marimo などの REPL が欲しいところです。
ここで pyproject.toml + uv による仮想環境の管理とどう両立するかが問題になります。

  • × uv pip install: uv sync で消えるので却下
  • × dependency-groups.dev: 個人の好みを書く場所ではない
  • × uv tool: REPLが入っている仮想環境とライブラリの仮想環境は同じでないとダメ
  • uvx --with-editable: これでいいじゃん
uvx --with-editable . marimo edit

なにこれ

  • uvx が一時的な仮想環境を作る
  • marimo と カレントディレクトリのライブラリを editable インストールする
  • その環境で marimo edit を実行する

扱うライブラリや marimo の optional-dependencies が必要であれば [...] を追加してください。

uvx --with-editable .[all] marimo[recommended,lsp,sql] edit
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?