Expand the installation documentation (#1938)

This commit is contained in:
Zanie Blue 2025-12-16 09:19:35 -06:00 committed by GitHub
parent e52c16a93e
commit b657c361be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,16 @@
# Installing ty
## Adding ty to your project
## Running ty without installation
Use [uvx](https://docs.astral.sh/uv/guides/tools/) to quickly get started with ty:
```shell
uvx ty
```
## Installation methods
### Adding ty to your project
!!! tip
@ -20,7 +30,13 @@ Then, use `uv run` to invoke ty:
uv run ty
```
## Installing globally
To update ty, use `--upgrade-package`:
```shell
uv lock --upgrade-package ty
```
### Installing globally with uv
Install ty globally with uv:
@ -28,13 +44,27 @@ Install ty globally with uv:
uv tool install ty@latest
```
Or, pipx:
To update ty, use `uv tool upgrade`:
```shell
uv tool upgrade ty
```
### Installing globally with pipx
Install ty globally with pipx:
```shell
pipx install ty
```
## Installing with pip
To update ty, use `pipx upgrade`:
```shell
pipx upgrade ty
```
### Installing with pip
Install ty into your current Python environment with pip:
@ -45,3 +75,46 @@ pip install ty
## Adding ty to your editor
See the [editor integration](./editors.md) guide to add ty to your editor.
## Shell autocompletion
!!! tip
You can run `echo $SHELL` to help you determine your shell.
To enable shell autocompletion for ty commands, run one of the following:
=== "Bash"
```bash
echo 'eval "$(ty generate-shell-completion bash)"' >> ~/.bashrc
```
=== "Zsh"
```bash
echo 'eval "$(ty generate-shell-completion zsh)"' >> ~/.zshrc
```
=== "fish"
```bash
echo 'ty generate-shell-completion fish | source' > ~/.config/fish/completions/ty.fish
```
=== "Elvish"
```bash
echo 'eval (ty generate-shell-completion elvish | slurp)' >> ~/.elvish/rc.elv
```
=== "PowerShell / pwsh"
```powershell
if (!(Test-Path -Path $PROFILE)) {
New-Item -ItemType File -Path $PROFILE -Force
}
Add-Content -Path $PROFILE -Value '(& ty generate-shell-completion powershell) | Out-String | Invoke-Expression'
```
Then restart the shell or source the shell config file.