Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
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
44 changes: 44 additions & 0 deletions 44 .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,49 @@ jobs:
PY
shell: bash

test-activate-environment-no-project:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Create incompatible pyproject.toml
run: |
cat > pyproject.toml <<'EOF'
[project]
name = "test-no-project"
version = "0.1.0"

[dependency-groups]
dev = [
"-e file:///${PROJECT_ROOT}/projects/pkg",
]
EOF
shell: bash
- name: Install latest version with no-project
id: setup-uv
uses: ./
with:
python-version: 3.13.1t
activate-environment: true
no-project: true
- name: Verify packages can be installed
run: uv pip install pip
shell: bash
- name: Verify output venv is set
run: |
if [ -z "$UV_VENV" ]; then
echo "output venv is not set"
exit 1
fi
if [ ! -d "$UV_VENV" ]; then
echo "output venv not point to a directory: $UV_VENV"
exit 1
fi
shell: bash
env:
UV_VENV: ${{ steps.setup-uv.outputs.venv }}

test-debian-unstable:
runs-on: ubuntu-latest
container: debian:unstable
Expand Down Expand Up @@ -1057,6 +1100,7 @@ jobs:
- test-python-version
- test-activate-environment
- test-activate-environment-custom-path
- test-activate-environment-no-project
- test-debian-unstable
- test-musl
- test-cache-key-os-version
Expand Down
3 changes: 3 additions & 0 deletions 3 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
# Custom path for the virtual environment when using activate-environment (default: .venv in the working directory)
venv-path: ""

# Pass --no-project when creating the venv with activate-environment.
no-project: "false"

# The directory to execute all commands in and look for files such as pyproject.toml
working-directory: ""

Expand Down
2 changes: 2 additions & 0 deletions 2 action-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ inputs:
type: boolean
venv-path:
type: string
no-project:
type: boolean
working-directory:
type: string
checksum:
Expand Down
3 changes: 3 additions & 0 deletions 3 action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ inputs:
venv-path:
description: "Custom path for the virtual environment when using activate-environment. Defaults to '.venv' in the working directory."
default: ""
no-project:
description: "Pass --no-project when creating the venv with activate-environment."
default: "false"
working-directory:
description: "The directory to execute all commands in and look for files such as pyproject.toml"
default: ${{ github.workspace }}
Expand Down
2 changes: 2 additions & 0 deletions 2 dist/save-cache/index.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions 10 dist/setup/index.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions 8 src/setup-uv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,17 @@ async function activateEnvironment(inputs: SetupInputs): Promise<void> {
}

core.info(`Creating and activating python venv at ${inputs.venvPath}...`);
await exec.exec("uv", [
const venvArgs = [
"venv",
inputs.venvPath,
"--directory",
inputs.workingDirectory,
"--clear",
]);
];
if (inputs.noProject) {
venvArgs.push("--no-project");
}
await exec.exec("uv", venvArgs);

let venvBinPath = `${inputs.venvPath}${path.sep}bin`;
if (process.platform === "win32") {
Expand Down
3 changes: 3 additions & 0 deletions 3 src/utils/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface SetupInputs {
versionFile: string;
pythonVersion: string;
activateEnvironment: boolean;
noProject: boolean;
venvPath: string;
checksum: string;
enableCache: boolean;
Expand Down Expand Up @@ -49,6 +50,7 @@ export function loadInputs(): SetupInputs {
const versionFile = getVersionFile(workingDirectory);
const pythonVersion = core.getInput("python-version");
const activateEnvironment = core.getBooleanInput("activate-environment");
const noProject = core.getBooleanInput("no-project");
const venvPath = getVenvPath(workingDirectory, activateEnvironment);
const checksum = core.getInput("checksum");
const enableCache = getEnableCache();
Expand Down Expand Up @@ -87,6 +89,7 @@ export function loadInputs(): SetupInputs {
ignoreEmptyWorkdir,
ignoreNothingToCache,
manifestFile,
noProject,
pruneCache,
pythonDir,
pythonVersion,
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.