Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use env variables in Github Actions docs #5411

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion docs/guides/integration/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,55 @@ steps:

## Using `uv pip`

If using the `uv pip` interface instead of the uv project interface, uv requires a virtual environment by default. To allow installing packages into the system environment, use the `--system` flag on all `uv` invocations or set the `UV_SYSTEM_PYTHON` variable, e.g.:
If using the `uv pip` interface instead of the uv project interface, uv requires a virtual environment by default. To allow installing packages into the system environment, use the `--system` flag on all `uv` invocations or set the `UV_SYSTEM_PYTHON` variable.

### Setting `UV_SYSTEM_PYTHON`

`UV_SYSTEM_PYTHON` variable can be defined in various scopes:

i. Workflow-wide Environment Variables

Set the variable for the entire workflow by defining it at the top level:

```yaml title="example.yml"
env:
UV_SYSTEM_PYTHON: 1

jobs: ...
```

ii. Job-specific Environment Variables

Set the variable for a specific job within the workflow:

```yaml title="example.yml"
jobs:
install_job:
env:
UV_SYSTEM_PYTHON: 1
...
```

Or using a shell command:
blueraft marked this conversation as resolved.
Show resolved Hide resolved

```yaml title="example.yml"
steps:
- name: Allow uv to use the system Python by default
run: echo "UV_SYSTEM_PYTHON=1" >> $GITHUB_ENV
```

iii. Step-specific Environment Variables

Set the variable for a specific step:

```yaml title="example.yml"
steps:
- name: Install requirements
run: uv pip install -r requirements.txt
env:
UV_SYSTEM_PYTHON: 1
```

Now, `uv pip` can modify the system environment without creating and activating a virtual environment.

```yaml title="example.yml"
Expand Down
Loading