• home
  • about
  • 全ての投稿
  • ソフトウェア・ハードウェアの設定のまとめ
  • 分析関連のまとめ
  • ヘルスケア関連のまとめ
  • 生涯学習関連のまとめ

mise

date: 2024-01-11 excerpt: miseの使い方

tag: misedirenvlinuxmacOS


miseの使い方

概要

  • asdfのようなバージョン管理ツール
  • プロジェクトルートの.mise.tomlに記述したソフトウェアを使用する
    • node, python, rust, ruby, deno, bunなどに対応
  • タスクランナーとしても使用可能
  • uv + python venvの組み合わせで高速にPython環境を構築可能

インストール

$ curl https://mise.jdx.dev/install.sh | sh

セットアップ

zsh

$ echo 'eval "$(~/.local/bin/mise activate zsh)"' >> ~/.zshrc

引数

  • use : 特定のバージョンのソフトウェアを使用する
  • run : タスクを実行する
  • ls : 使用しているソフトウェアの一覧を表示する
  • ls-remote <tool> : 使用可能なソフトウェアの一覧を表示する

.mise.toml の例

[tools]
uv = "latest"
python = "3.12"  # Pythonバージョンの指定
terraform = "1.6"
awscli = "latest"
gcloud = "latest"

[settings]
python.venv_auto_create = true   # mise管理下で自動的にvenvを作成・有効化
python.uv_venv_auto = true       # venv作成時にuvを使用する(高速化)

[tasks]
start = "uv run python app.py"
test = "uv run pytest"

[tasks.jupyter]
description = "Jupyter Labをsystemdスコープ内で起動"
usage = '''
flag "--port <port>" default="20000" help="起動するポート番号"
flag "--mem <mem>" default="16G" help="メモリ制限 (例: 16G, 8G)"
'''
# 実際の実行コマンド
run = '''
#!/usr/bin/env bash
echo "Starting Jupyter Lab on port ${usage_port} with max memory ${usage_mem}..."

systemd-run --user --scope -p MemoryMax="${usage_mem}" \
  uv run jupyter lab \
  --port "${usage_port}" \
  --ip '0.0.0.0' \
  --ServerApp.disable_check_xsrf=True
'''
  • mise run jupyter --port 30000 --mem 8G のように実行可能

参考

  • mise-en-place


misedirenvlinuxmacOS Share Tweet