Python/uv: Difference between revisions

From Fundamental Ramen
Jump to navigation Jump to search
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Setup project ==
=== Initialize ===
<syntaxhighlight lang="bash">
uv init --python 3.10
uv run python --version
uv python list
</syntaxhighlight>
=== Run ===
<syntaxhighlight lang="bash">
uv run <project-name>
</syntaxhighlight>
=== Upgrade python ===
<syntaxhighlight lang="bash">
uv python install 3.12
# .python-version will be changed to 3.12
uv python pin 3.12
# rebuild .venv/*
uv sync
</syntaxhighlight>
== Install ==
== Install ==


Line 16: Line 45:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Check and upgrade new version
uv self update
uv self update
# Upgrade if uv self update failed.
curl -LsSf https://astral.sh/uv/install.sh | sh
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 06:51, 27 October 2026

Setup project

Initialize

uv init --python 3.10

uv run python --version
uv python list

Run

uv run <project-name>

Upgrade python

uv python install 3.12

# .python-version will be changed to 3.12
uv python pin 3.12

# rebuild .venv/*
uv sync

Install

curl -LsSf https://astral.sh/uv/install.sh | sh
downloading uv 0.13.6 x86_64-unknown-linux-gnu
installing to /home/xxx/.local/bin
  uv
  uvx
everything's installed!

Upgrade

# Check and upgrade new version
uv self update

# Upgrade if uv self update failed.
curl -LsSf https://astral.sh/uv/install.sh | sh