1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

パッケージ管理「uv」を使ってみた

Posted at

パッケージ管理「uv」を使ってみた

Xで、最近何かと目にするパッケージ管理「uv」について、個人的な勉強がてらブログにまとめていきます。
※技術ブログを書くことに慣れていないので、お手柔らかにお願いします。

基本コマンド

各コマンドについてまとめます。

インストール手順

pipの場合

pip install uv
※今回私は、こちらの方法でインストールしました。

curlの場合

curl -LsSf https://astral.sh/uv/install.sh | sh

仮想環境関連

仮想環境作成

uv venv

仮想環境起動

source .venv/Scripts/activate

仮想環境終了

deactivate
※この辺は仮想環境のコマンドと同じ

依存関係の管理

requirements.txtの生成

uv pip compile pyproject.toml > requirements.txt

出力内容の例

$ uv pip compile pyproject.toml
Resolved 4 packages in 7ms
# This file was autogenerated by uv via the following command:       
#    uv pip compile pyproject.toml
asgiref==3.8.1
    # via django
django==5.1
    # via my-project (pyproject.toml)
sqlparse==0.5.1
    # via django
tzdata==2024.1
    # via django

requirements.txtを基にインストール

uv pip sync requirements.txtコマンドで依存関係を仮想環境にインストール

感想

今回は基本的なコマンドだけまとめました。
自分もこれまでしかまだ使えていないので...
とりあえずdjangoでアプリでも作ってみようかと思います!!!
これからもボチボチ記事を書いて個人的に整理していきたいと思います。
誤った情報がございましたら、ご指摘いただければと幸いです。
現在絶賛転職活動中なので、ご連絡はXのDMまでご連絡ください。
またシステムエンジニア志望の未経験の方々もお気軽にご連絡ください。
答えられる範囲でご回答したいと思います。

1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?