Trying out Rye
https://burakku.com/blog/rye-test-and-python-tools/
#2024/04/09_PyCoder's_Weekly_#624 #mitsuhiko/rye
https://twitter.com/ftnext/status/1778998274743239078 要約
All in all, I have mixed feelings about Rye. On one hand, many of the design ideas are good and I think I'd like to use a Cargo-but-for-Python to develop software, since I also like using Cargo. However, the insistence on using static Python builds leads to suffering and won't let me uninstall pyenv anyways.
rye testはpytestへのエイリアス(unittestのような他の選択肢の余地なし)
If you have a working Python development environment, no matter how rudimentary its feature set might be, it might not be worth it to try out Rye now.
「あなたがPython開発環境を持っているならば、いまRyeをトライアウトする価値はないかもしれない」
Its best value at the moment would probably rather be for newbs, who can benefit from its easy setup and sane defaults for many things (like not using the system Python if you've got one).
the only tools in my arsenal that I consider to be absolutely essential
2つ挙げている
#pipx
#pyenv
The number of different tools that I use and Rye would replace is actually rather long:
たくさん挙げている
Rye allows installing Python tools in isolated environments just like pipx
まずpipxを置き換えた
IMO:たしかにできると思うが、コマンドとしてはどうやっているんだろう?
--extra-requirement?
Rye automatically installs whatever Python version your project uses.
スクリプトからなる小さなプロジェクトに入れた例
ディレクトリ構成はRyeに合わせた
仮想環境を意識しない体験
.python-versionを編集して、rye sync
using Rye to develop a Django project.
And this is where the pain begins, and not (just) because I picked an example with an ancient Django 2.0 codebase.
Ryeのバーチャルパッケージとする
I just can't install uWSGI
uWSGI needs to compile C extensions, Rye uses static builds of Python, and static Python builds + compiling C extensions is a known house of pain.
RyeのFAQのworkaroundに沿う
register a non-static Python build that you've obtained from somewhere as a Rye toolchain.
non staticビルドとして、HomebrewのPython 3.9を指定する
rye toolchain register
pinする
しかし、RyeはstaticなPythonを管理しようとする
Obviously I would never recommend actually using Homebrew-supplied Python installations for any kind of development work, but I figured it'd be fine for testing.
Rye kinda sucks and is all sorts of broken if you ever need dependencies that compile C code.
Static Python builds are fine for some stuff but I feel like they're a bad idea to be the default and a truly awful idea to be the only option.
non staticなPythonを管理するpyenvもPCに必要と指摘している
also kinda miss the environment variable plugin that VirtualFish had, where it would set environment variables when you activated a virtualenv
As far as I can see, the way you're supposed to integrate environment variables as part of your Python development is by adding them to your Rye scripts.
環境変数(例:DJANGO_SETTINGS_MODULE)を.envに書いてRyeのscriptに指定することになる
テスト用の設定の環境変数を切り替えたいっぽい
callでmanage.pyを指定?rye run manage testと引数を渡せていそう