USE 213 - uv cli invocation #34
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose and background context
This PR updates how the CLI is invoked inside the Docker container.
A recent PR removed the following lines from the
cli.py:This approach was not ideal to begin with, but allowed invoking the CLI inside the Docker container with
python -m embeddings.cligiven it would default to this__main__behavior.Invoking the Docker container had no output, but was returning a valid zero exit code. This made this very easy to miss; I missed both during code review and working with the CLI locally (likely worth a test case of its own somehow, but out of scope here).
On a positive note, this provided an opportunity to refine how we call click CLI applications with
uv.Locally, we utilize a pattern like
uv run embeddings, relying onembeddingsbeing an available script in theuvvirtual environment courtesy of this block inpyproject.toml:Turns out, we can use this
embeddingsscript / callable in the Docker context as well. The key was addingPYTHONPATH=/appwhich ensures that the globally installed script/usr/local/bin/embeddingswill have a working directory of/appwhere theembeddingsmodule actually exists.How can a reviewer manually see the effects of these changes?
1- Build the docker image:
2- Note the updated entrypoint for the
Dockerfile:3- Run the docker container, relying on the entrypoint, and testing the loading of the model:
Output:
Includes new or updated dependencies?
YES
Changes expectations for external applications?
YES: Docker image has a valid entrypoint, unblocking some AWS Batch testing
What are the relevant tickets?
Code review