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

Custom installation options present in the pyproject.toml #11887

Open
hongbo-miao opened this issue Mar 1, 2025 · 4 comments
Open

Custom installation options present in the pyproject.toml #11887

hongbo-miao opened this issue Mar 1, 2025 · 4 comments
Labels
enhancement New feature or improvement to existing functionality

Comments

@hongbo-miao
Copy link

hongbo-miao commented Mar 1, 2025

Summary

I have some projects that need install by following certain steps

uv sync --extra=build
uv sync --extra=build --extra=compile

base on https://docs.astral.sh/uv/concepts/projects/config/#build-isolation

Currently Renovate cannot upgrade dependencies for these projects.

I originally asked at renovatebot/renovate#33811

This would need uv side to support to let Renovate know what is proper steps to install. It would be great to support a field so that Renovate knows how to install, thanks! ☺️

@hongbo-miao hongbo-miao added the enhancement New feature or improvement to existing functionality label Mar 1, 2025
@nathanjmcdougall
Copy link
Contributor

Related: https://peps.python.org/pep-0771/

As a workaround for now, you could duplicate the extra information in a dependency group, and set the dependency to install by default:
https://docs.astral.sh/uv/concepts/projects/dependencies/#default-groups

@hongbo-miao
Copy link
Author

hongbo-miao commented Mar 2, 2025

Thanks @nathanjmcdougall . In my case, the installation order is also important. For example,

[project]
name = "mineru"
version = "1.0.0"
requires-python = "~=3.12.0"

[project.optional-dependencies]
build = [
  "setuptools",
  "torch",
]
compile = [
  "detectron2",
  "magic-pdf[full]==1.1.0",
]
paddlepaddle-gpu = [
  "paddlepaddle-gpu==3.0.0b2",
]

[dependency-groups]
dev = [
  "poethepoet==0.32.2",
  "pytest-cov==6.0.0",
  "pytest==8.3.4",
]

[tool.uv]
package = false
prerelease = "allow"
no-build-isolation-package = ["detectron2"]

[tool.uv.sources]
detectron2 = { git = "https://github.com/facebookresearch/detectron2.git", branch = "main" }
paddlepaddle-gpu = { index = "paddlepaddle-gpu" }

[[tool.uv.index]]
name = "paddlepaddle-gpu"
url = "https://www.paddlepaddle.org.cn/packages/stable/cu118"
explicit = true

[tool.poe.tasks]
dev = "python src/main.py"
test = "pytest --verbose --verbose"
test-coverage = "pytest --cov=. --cov-report=xml"

I have to install based on order

uv sync --extra=build
uv sync --extra=build --extra=compile
uv sync --extra=build --extra=compile --extra=paddlepaddle-gpu
uv sync --extra=build --extra=compile --extra=paddlepaddle-gpu --dev

I wrote the reason why have to install like this at here if you are curious about why.

I assume you are referring to project.optional-dependencies:

Image

which I do not think can help installing based on certain order. 😔

@nathanjmcdougall
Copy link
Contributor

nathanjmcdougall commented Mar 2, 2025

Ah I understand the issue now. An issue is the no-build-isolation workaround for detectron2 which current requires multiple steps per
https://docs.astral.sh/uv/concepts/projects/config/#build-isolation
(see #2252 for other examples).

So you want some declarative configuration which renovate could use to know the correct sequence of uv commands to run. You're right, my suggestion won't help with that.

@hongbo-miao
Copy link
Author

hongbo-miao commented Mar 2, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants