1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-08-09 08:35:41 +02:00

uv-{help,lock,pip,remove,run,sync,venv,version}: add pages (#16875)

Co-authored-by: Managor <42655600+Managor@users.noreply.github.com>
Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>
This commit is contained in:
Meinard Francisco 2025-06-18 16:23:49 +08:00 committed by GitHub
parent c2c38a688d
commit edbed8ce00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 232 additions and 0 deletions

20
pages/common/uv-help.md Normal file
View file

@ -0,0 +1,20 @@
# uv help
> Display detailed documentation for `uv` commands.
> More information: <https://docs.astral.sh/uv/reference/cli/#uv-help>.
- Display general help for `uv`:
`uv help`
- Display help for a specific command:
`uv help {{command}}`
- Display help for a subcommand:
`uv help {{command}} {{subcommand}}`
- Display help without using a pager:
`uv help --no-pager {{command}}`

32
pages/common/uv-lock.md Normal file
View file

@ -0,0 +1,32 @@
# uv lock
> Update the project's lockfile.
> More information: <https://docs.astral.sh/uv/reference/cli/#uv-lock>.
- Create or update the project's lockfile:
`uv lock`
- Check if the lockfile is up-to-date without updating it:
`uv lock --check`
- Assert that a lockfile exists without checking if it's current:
`uv lock --check-exists`
- Preview what would be locked without writing the lockfile:
`uv lock --dry-run`
- Lock a specific Python script instead of the current project:
`uv lock --script {{path/to/script.py}}`
- Upgrade all packages to their latest compatible versions:
`uv lock --upgrade`
- Upgrade only specific packages:
`uv lock --upgrade-package {{package1}} --upgrade-package {{package2}}`

36
pages/common/uv-pip.md Normal file
View file

@ -0,0 +1,36 @@
# uv pip
> Provides pip-like commands for installing, uninstalling, and managing packages.
> More information: <https://docs.astral.sh/uv/reference/cli/#uv-pip>.
- Install a package:
`uv pip install {{package}}`
- Install packages from a requirements file:
`uv pip install {{[-r|--requirements]}} {{requirements.txt}}`
- Install a package with a specific version:
`uv pip install {{package==1.2.3}}`
- Uninstall a package:
`uv pip uninstall {{package}}`
- Save installed packages to file:
`uv pip freeze > {{requirements.txt}}`
- List installed packages:
`uv pip list`
- Show information about an installed package:
`uv pip show {{package}}`
- Sync environment with a requirements file (install/uninstall to match exactly):
`uv pip sync {{requirements.txt}}`

28
pages/common/uv-remove.md Normal file
View file

@ -0,0 +1,28 @@
# uv remove
> Remove dependencies from the project's `pyproject.toml` file.
> More information: <https://docs.astral.sh/uv/reference/cli/#uv-remove>.
- Remove a dependency from the project:
`uv remove {{package}}`
- Remove multiple dependencies:
`uv remove {{package1}} {{package2}}`
- Remove a development dependency:
`uv remove --dev {{package}}`
- Remove a dependency from an optional dependency group:
`uv remove --optional {{extra_name}} {{package}}`
- Remove a dependency from a specific dependency group:
`uv remove --group {{group_name}} {{package}}`
- Remove without syncing the virtual environment:
`uv remove --no-sync {{package}}`

28
pages/common/uv-run.md Normal file
View file

@ -0,0 +1,28 @@
# uv run
> Run a command or script in the project environment.
> More information: <https://docs.astral.sh/uv/reference/cli/#uv-run>.
- Run a Python script:
`uv run {{script.py}}`
- Run a Python module:
`uv run {{[-m|--module]}} {{module_name}}`
- Run a command with additional packages installed temporarily:
`uv run --with {{package}} {{command}}`
- Run a script with packages from a requirements file:
`uv run --with-requirements {{requirements.txt}} {{script.py}}`
- Run in an isolated environment (no project dependencies):
`uv run --isolated {{script.py}}`
- Run without syncing the environment first:
`uv run --no-sync {{command}}`

36
pages/common/uv-sync.md Normal file
View file

@ -0,0 +1,36 @@
# uv sync
> Update the project's environment to match the lockfile.
> More information: <https://docs.astral.sh/uv/reference/cli/#uv-sync>.
- Sync the project environment with the lockfile:
`uv sync`
- Sync and include all optional dependencies:
`uv sync --all-extras`
- Sync with specific optional dependencies:
`uv sync --extra {{extra_name}}`
- Sync only development dependencies:
`uv sync --only-dev`
- Sync excluding development dependencies:
`uv sync --no-dev`
- Sync specific dependency groups:
`uv sync --group {{group_name}}`
- Check if environment is already synchronized (no changes):
`uv sync --check`
- Preview what would be synced without making changes:
`uv sync --dry-run`

24
pages/common/uv-venv.md Normal file
View file

@ -0,0 +1,24 @@
# uv venv
> Create an isolated Python environment for installing packages.
> More information: <https://docs.astral.sh/uv/reference/cli/#uv-venv>.
- Create a virtual environment in the default location (`.venv`):
`uv venv`
- Create a virtual environment at a specific path:
`uv venv {{path/to/venv}}`
- Create using a specific Python version:
`uv venv --python {{3.12}}`
- Create with a custom prompt prefix:
`uv venv --prompt {{my_project}}`
- Create and allow overwriting existing environment:
`uv venv --allow-existing {{venv_name}}`

View file

@ -0,0 +1,28 @@
# uv version
> Read or update a project's version.
> More information: <https://docs.astral.sh/uv/reference/cli/#uv-version>.
- Display the current project version:
`uv version`
- Set the project version to a specific value:
`uv version {{1.2.3}}`
- Bump the project version using semantic versioning:
`uv version --bump {{major|minor|patch}}`
- Preview version changes without writing to `pyproject.toml`:
`uv version --bump {{patch}} --dry-run`
- Update version for a specific package in a workspace:
`uv version --package {{package_name}} {{1.2.3}}`
- Display version in JSON format:
`uv version --output-format json`