Skip to content

feat: execute uv lock before packing#420

Merged
cristipufu merged 1 commit intomainfrom
feat/execute_uv_lock
Jul 1, 2025
Merged

feat: execute uv lock before packing#420
cristipufu merged 1 commit intomainfrom
feat/execute_uv_lock

Conversation

@cristipufu
Copy link
Copy Markdown
Member

@cristipufu cristipufu commented Jun 30, 2025

Summary

This PR enhances the packaging process to automatically detect uv projects and ensure uv.lock files are up-to-date and included in packages. This provides significant runtime performance improvements for uv-based projects.

You can opt-out by using uipath pack --nolock.

🚀 Faster Runtime Startup

When packages include an up-to-date uv.lock file, the serverless runtime environment will use uv sync --locked which:

  • Skips dependency resolution entirely
  • Uses pre-resolved dependency versions from the lock file
  • Significantly reduces startup time by avoiding the expensive resolution phase

📦 Better Package Consistency

  • Lock files capture the exact dependency tree at build time
  • Ensures deterministic installs with exact versions
  • Eliminates "works on my machine" issues caused by dependency version drift
  • Provides reproducible builds across different environments

Development Package

  • Add this package as a dependency in your pyproject.toml:
[project]
dependencies = [
  # Exact version:
  "uipath==2.0.73.dev1004200501",

  # Any version from PR
  "uipath>=2.0.73.dev1004200000,<2.0.73.dev1004210000"
]

[[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
explicit = true

[tool.uv.sources]
uipath = { index = "testpypi" }

@cristipufu cristipufu requested a review from Copilot June 30, 2025 13:37
@cristipufu cristipufu self-assigned this Jun 30, 2025
@cristipufu cristipufu added the build:dev Create a dev build from the pr label Jun 30, 2025

This comment was marked as outdated.

@cristipufu cristipufu force-pushed the feat/execute_uv_lock branch from 24978f6 to 2a0b86f Compare June 30, 2025 13:57
@cristipufu cristipufu force-pushed the feat/execute_uv_lock branch 3 times, most recently from 7523a13 to d7ced81 Compare July 1, 2025 10:29
@cristipufu cristipufu requested a review from Copilot July 1, 2025 10:29
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the packaging process for uv-based projects by automatically detecting uv projects and ensuring the uv.lock file is updated and included in the package for improved runtime performance.

  • Introduces helper functions to check uv command availability, determine uv projects, and run uv lock.
  • Extends the packaging function to conditionally include the uv.lock file based on a new --nolock flag.
  • Updates the project version in pyproject.toml to reflect new changes.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/uipath/_cli/cli_pack.py Adds uv command checks, uv.lock update functions, and a new --nolock option for packaging
pyproject.toml Updates project version to 2.0.73
Comments suppressed due to low confidence (1)

src/uipath/_cli/cli_pack.py:66

  • It appears that 'console' is used for logging warnings, but there is no visible import or definition for it in this file. Ensure that 'console' is imported or defined to avoid potential runtime NameErrors.
        )

Comment thread src/uipath/_cli/cli_pack.py Outdated
def is_uv_available():
"""Check if uv command is available in the system."""
try:
subprocess.run(["uv", "--version"], capture_output=True, check=True)
Copy link

Copilot AI Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a timeout parameter to the subprocess.run calls (e.g., in is_uv_available and run_uv_lock) to prevent potential hangs if the 'uv' command is unresponsive.

Copilot uses AI. Check for mistakes.
@cristipufu cristipufu force-pushed the feat/execute_uv_lock branch from d7ced81 to 2def747 Compare July 1, 2025 10:32
@cristipufu cristipufu force-pushed the feat/execute_uv_lock branch from 2def747 to 4c050f6 Compare July 1, 2025 10:53
@cristipufu cristipufu merged commit 55de34c into main Jul 1, 2025
16 checks passed
@cristipufu cristipufu deleted the feat/execute_uv_lock branch July 1, 2025 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build:dev Create a dev build from the pr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants