UV使用
394 字
2 分钟
UV使用
从 micromamba 转 uv 了
UV 优势
- 🚀 A single tool to replace
pip,pip-tools,pipx,poetry,pyenv,twine,virtualenv, and more. - ⚡️ 10-100x faster than
pip. - 🗂️ Provides comprehensive project management, with a universal lockfile.
- ❇️ Runs scripts, with support for inline dependency metadata.
- 🐍 Installs and manages Python versions.
- 🛠️ Runs and installs tools published as Python packages.
- 🔩 Includes a pip-compatible interface for a performance boost with a familiar CLI.
- 🏢 Supports Cargo-style workspaces for scalable projects.
- 💾 Disk-space efficient, with a global cache for dependency deduplication.
- ⏬ Installable without Rust or Python via
curlorpip. - 🖥️ Supports macOS, Linux, and Windows.
安装
# 安装brew install uv# mise# mise use -g uv@latest配置镜像源
$XDG_CONFIG_HOME/uv/uv.toml
[[index]]url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/"default = true迁移micromanba
# 迁移 micromamba 到 uvmicromamba list -e > requirements.txtuv pip install -r requirements.txt使用
Python versions
uv python install: Install Python versions.uv python list: View available Python versions.uv python find: Find an installed Python version.uv python pin: Pin the current project to use a specific Python version.uv python uninstall: Uninstall a Python version.
Scripts
uv run: Run a script.uv add --script: Add a dependency to a scriptuv remove --script: Remove a dependency from a script
Projects
uv init: Create a new Python project.uv add: Add a dependency to the project.uv remove: Remove a dependency from the project.uv sync: Sync the project’s dependencies with the environment.uv lock: Create a lockfile for the project’s dependencies.uv run: Run a command in the project environment.uv tree: View the dependency tree for the project.uv build: Build the project into distribution archives.uv publish: Publish the project to a package index.
Tools
uvx/uv tool run: Run a tool in a temporary environment.uv tool install: Install a tool user-wide.uv tool uninstall: Uninstall a tool.uv tool list: List installed tools.uv tool update-shell: Update the shell to include tool executables.
The pip interface
uv venv: Create a new virtual environment.uv pip install: Install packages into the current environment.uv pip show: Show details about an installed package.uv pip freeze: List installed packages and their versions.uv pip check: Check that the current environment has compatible packages.uv pip list: List installed packages.uv pip uninstall: Uninstall packages.uv pip tree: View the dependency tree for the environment.uv pip compile: Compile requirements into a lockfile.uv pip sync: Sync an environment with a lockfile.
Utility
uv cache clean: Remove cache entries.uv cache prune: Remove outdated cache entries.uv cache dir: Show the uv cache directory path.uv tool dir: Show the uv tool directory path.uv python dir: Show the uv installed Python versions path.uv self update: Update uv to the latest version.
文章分享
如果这篇文章对你有帮助,欢迎分享给更多人!
相关文章智能推荐
1
micromamba 工作环境配置
技术分享2024-04-23
2
在 PVE 上给软路由虚拟机加一个网络 Watchdog
技术分享在 PVE 宿主机上用 Bash 和 systemd timer 实现一个网络 watchdog:先检测公网连通性,连续失败后重启软路由虚拟机,多次自愈无效再升级为重启 PVE 宿主机。
3
命令行自动登录 JumpServer:SSH、TOTP 与密码提示的自动化
技术分享把 JumpServer 登录流程拆成凭据读取和终端交互两层:zsh 从密码管理器安全读取 TOTP seed 与可选密码,expect 只负责响应 SSH 登录过程中的 password 和 Code 提示。
4
git 个人开发工作流
技术分享介绍个人 Git 分支协作流程:以基线分支(如 feature-a)+ 个人开发分支(feature-a-xxx)进行开发,开发分支定期 rebase 同步上游,最终通过 merge(必要时先 squash 整理提交)合回基线;并提供 grebase/gmergebase 等脚本,支持自动推导基线分支、预览计划、带 autostash 的安全 rebase,以及可选 squash/推送/删除分支的安全 merge-back。
5
使用 docker-atrust 连入深信服
技术分享使用 Docker 容器运行深信服 aTrust 客户端,通过 VNC 完成登录,并结合本机 mihomo 配置实现公司内网的 DNS 解析与按域名、IP 的精确代理分流;宿主机暴露 1080 与 8888 端口供 socks5 和 HTTP 代理使用,从而在不安装原生客户端的情况下实现零信任接入并降低对本机的影响。
随机文章随机推荐













