Skip to content

How to build a project wheel with pinned dependencies? #312

Answered by DavidVujic
diogobaeder asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @diogobaeder! I think that one way to accomplish this is to opt-out of the uv workspaces feature (if you use that) and have separate uv.lock files that are updated individually.

Another option is to export the project-specific deps before building the wheel. I think that you can do something like this:

# running from the folder of a project.

# export the dependecies
uv export --no-emit-project --output-file requirements.txt

#build the distribution (wheel/sdist)
uv build --out-dir ./dist

When installing the wheel (example from a Dockerfile):

# Install with no deps. Removed other useful standard pip install flags in this example
RUN pip install --no-deps the-built-wheel-from-before.whl

#

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by DavidVujic
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@diogobaeder
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #310 on December 09, 2024 04:54.