@@ -15,8 +15,9 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
15
15
- [ Install the latest version] ( #install-the-latest-version )
16
16
- [ Install a specific version] ( #install-a-specific-version )
17
17
- [ Install a version by supplying a semver range or pep440 specifier] ( #install-a-version-by-supplying-a-semver-range-or-pep440-specifier )
18
- - [ Install a required-version] ( #install-a-required-version )
19
18
- [ Python version] ( #python-version )
19
+ - [ Activate environment] ( #activate-environment )
20
+ - [ Working directory] ( #working-directory )
20
21
- [ Validate checksum] ( #validate-checksum )
21
22
- [ Enable Caching] ( #enable-caching )
22
23
- [ Cache dependency glob] ( #cache-dependency-glob )
@@ -90,32 +91,9 @@ to install the latest version that satisfies the range.
90
91
version: ">=0.4.25,<0.5"
91
92
` ` `
92
93
93
- # ## Install a required-version
94
-
95
- You can specify a [required-version](https://docs.astral.sh/uv/reference/settings/#required-version)
96
- in either a `uv.toml` or `pyproject.toml` file :
97
-
98
- ` ` ` yaml
99
- - name: Install required-version defined in uv.toml
100
- uses: astral-sh/setup-uv@v5
101
- with:
102
- uv-file: "path/to/uv.toml"
103
- ` ` `
104
-
105
- ` ` ` yaml
106
- - name: Install required-version defined in pyproject.toml
107
- uses: astral-sh/setup-uv@v5
108
- with:
109
- pyproject-file: "path/to/pyproject.toml"
110
- ` ` `
111
-
112
94
# ## Python version
113
95
114
- You can use the input `python-version` to
115
-
116
- - set the environment variable `UV_PYTHON` for the rest of your workflow
117
- - create a new virtual environment with the specified python version
118
- - activate the virtual environment for the rest of your workflow
96
+ You can use the input `python-version` to set the environment variable `UV_PYTHON` for the rest of your workflow
119
97
120
98
This will override any python version specifications in `pyproject.toml` and `.python-version`
121
99
@@ -146,6 +124,34 @@ jobs:
146
124
run: uv run --frozen pytest
147
125
` ` `
148
126
127
+ # ## Activate environment
128
+
129
+ You can set `activate-environment` to `true` to automatically activate a venv.
130
+ This allows directly using it in later steps :
131
+
132
+ ` ` ` yaml
133
+ - name: Install the latest version of uv and activate the environment
134
+ uses: astral-sh/setup-uv@v5
135
+ with:
136
+ activate-environment: true
137
+ - run: uv pip install pip
138
+ ` ` `
139
+
140
+ # ## Working directory
141
+
142
+ You can set the working directory with the `working-directory` input.
143
+ This controls where we look for `pyproject.toml`, `uv.toml` and `.python-version` files
144
+ which are used to determine the version of uv and python to install.
145
+
146
+ It also controls where [the venv gets created](#activate-environment).
147
+
148
+ ` ` ` yaml
149
+ - name: Install uv based on the config files in the working-directory
150
+ uses: astral-sh/setup-uv@v5
151
+ with:
152
+ working-directory: my/subproject/dir
153
+ ` ` `
154
+
149
155
# ## Validate checksum
150
156
151
157
You can specify a checksum to validate the downloaded executable. Checksums up to the default version
@@ -383,7 +389,7 @@ This action downloads uv from the uv repo's official
383
389
[GitHub Actions Toolkit](https://github.com/actions/toolkit) to cache it as a tool to speed up
384
390
consecutive runs on self-hosted runners.
385
391
386
- The installed version of uv is then added to the runner PATH, enabling subsequent steps to invoke it
392
+ The installed version of uv is then added to the runner PATH, enabling later steps to invoke it
387
393
by name (`uv`).
388
394
389
395
# # FAQ
0 commit comments