Skip to content

Add uv package manager support#2

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/add-uv-package-manager-support
Draft

Add uv package manager support#2
Copilot wants to merge 6 commits intomainfrom
copilot/add-uv-package-manager-support

Conversation

Copy link

Copilot AI commented Dec 6, 2025

Plan: Add uv package manager support

  • Update constants.lua to add uv to PACKAGE_MANAGERS
  • Update config.lua to detect uv.lock file and set package manager accordingly
  • Update config.lua to add autocommand patterns for uv-managed projects (not needed - uv uses pyproject.toml)
  • Update install.lua to add uv-specific install commands
  • Update update.lua to add uv-specific update commands
  • Update delete.lua to add uv-specific delete/remove commands
  • Update change-version.lua to add uv-specific version change commands
  • Update show.lua to add uv-specific command for listing outdated packages
  • Update parser.lua to handle UV pyproject.toml format with dependencies arrays
  • Fix get_dependency_name_from_line.lua to recognize UV array format for virtual text display
  • Fix parser to prevent duplicate entries in dependencies
  • Improve parser flag management for better code clarity and robustness
  • Update README.md documentation to mention uv support
  • Fix indentation issues in show.lua to match codebase style
  • Run security checks (codeql - not applicable for Lua)
  • Complete implementation with minimal changes

Summary

Successfully added complete support for the 'uv' package manager to pybumper.nvim. The plugin now:

  • Automatically detects uv projects via uv.lock file
  • Supports all operations: install, update, delete, change-version, show outdated
  • Parses UV's pyproject.toml format with:
    • dependencies = ["package==version", ...] arrays
    • [dependency-groups] for dev dependencies
    • [project.optional-dependencies] for optional dependencies
  • Displays virtual text correctly for UV dependencies in array format
  • Prevents duplicate dependencies during parsing with explicit flag management
  • Maintains backward compatibility with poetry
  • Uses consistent coding style and minimal changes
  • Updated documentation to reflect new capabilities

All changes follow the existing code patterns and maintain the same level of error handling as the original poetry implementation.

Original prompt

Add support for the 'uv' package manager in this Neovim plugin. Ensure the code can detect and use 'uv' as a package manager option where appropriate, similar to how other package managers (such as pip, pipenv, poetry, etc.) are integrated. Update documentation, configuration, and any relevant tests to reflect the new support for 'uv'.

This pull request was created as a result of the following prompt from Copilot chat.

Add support for the 'uv' package manager in this Neovim plugin. Ensure the code can detect and use 'uv' as a package manager option where appropriate, similar to how other package managers (such as pip, pipenv, poetry, etc.) are integrated. Update documentation, configuration, and any relevant tests to reflect the new support for 'uv'.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 6, 2025 13:30
Co-authored-by: mgierada <23472449+mgierada@users.noreply.github.com>
Co-authored-by: mgierada <23472449+mgierada@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for 'uv' package manager in Neovim plugin Add uv package manager support Dec 6, 2025
Copilot AI requested a review from mgierada December 6, 2025 13:38
@mgierada
Copy link
Owner

mgierada commented Dec 8, 2025

@copilot the valid pyproject.toml for uv could look like that

  "albumentations==2.0.5",
  "boto3==1.34.75",
  "httpx==0.28.1",
  "mlflow==2.20",
  "numpy==1.26.4",
  "opencv-python==4.10.0.84",
  "prometheus-client==0.22.1",
  "pydantic==2.10.6",
  "pynvml==11.5.0",
  "pytest-asyncio==0.26.0",
  "torch==2.6.0",
  "torchvision==0.21.0",
  "tqdm==4.66.1",
  "transformers[sentencepiece]==4.36.2",
  "typer==0.17.4",
  "ultralytics==8.3.80",
]

[dependency-groups]
dev = ["ruff==0.12.7", "ty==0.0.1a17"]

[project.optional-dependencies]
data = [
  "darwin-py==3.1.0",
  "pandas-stubs==2.3.2.250827",
]

Please make sure we can parse those. Currently we cannot

Co-authored-by: mgierada <23472449+mgierada@users.noreply.github.com>
Copy link
Author

Copilot AI commented Dec 8, 2025

@copilot the valid pyproject.toml for uv could look like that

...

Added UV pyproject.toml parser support in commit 5dcbde5. The parser now handles:

  • dependencies = [...] arrays with package==version format
  • [dependency-groups] dev dependencies
  • [project.optional-dependencies] for optional dependencies

The parser automatically detects the package manager format and parses accordingly.

@mgierada
Copy link
Owner

@copilot The virtual text display is not working for uv. Also, I noticed that state.dependencies.installed is populated 2 or more times -- entires are duplicated

Co-authored-by: mgierada <23472449+mgierada@users.noreply.github.com>
Copy link
Author

Copilot AI commented Dec 11, 2025

@copilot The virtual text display is not working for uv. Also, I noticed that state.dependencies.installed is populated 2 or more times -- entires are duplicated

Fixed both issues in commit abd38b7:

  1. Virtual text now works for UV: Updated get_dependency_name_from_line.lua to recognize UV's array format ("package==version") in addition to Poetry's format (name = "version")

  2. Duplicate dependencies fixed: Refactored the UV parser to properly handle the transition between single-line and multi-line arrays, preventing the same dependencies from being parsed multiple times. The logic now clearly separates:

    • Single-line arrays (parsed immediately and flags reset)
    • Multi-line arrays (accumulated and parsed on closing bracket)
    • Optional dependency arrays (handled separately)

Co-authored-by: mgierada <23472449+mgierada@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants