-
Notifications
You must be signed in to change notification settings - Fork 305
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
Add pip_extra_args #3081
base: master
Are you sure you want to change the base?
Add pip_extra_args #3081
Conversation
Thank you for opening this pull request! 🙌 These tips will help get your PR across the finish line:
|
Code Review Agent Run #bf76cdActionable Suggestions - 1
Review Details
|
Changelist by BitoThis pull request implements the following key changes.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update a list to make sure that the new argument is used?
flytekit/image_spec/image_spec.py
Outdated
@@ -82,6 +83,7 @@ class ImageSpec: | |||
platform: str = "linux/amd64" | |||
pip_index: Optional[str] = None | |||
pip_extra_index_url: Optional[List[str]] = None | |||
pip_extra_args: Optional[List[str]] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this a single string and not a list?
pip_extra_args: Optional[List[str]] = None | |
pip_extra_args: Optional[str] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the update to take a space-delimited string. Just curious, but what's the rationale behind this suggestion? pip_install_args
is joined with " "
later, so taking a list and extending the list seems more aligned with how it is implemented.
For example, when adding multiple command line arguments, it is done by extending the list of multiple elements, not a single element with multiple command line arguments concatenated with spaces.
pip_install_args.extend(["--locked", "--no-dev", "--no-install-project"]) |
(a separate topic but it may be worth using shlex
instead of " ".join
)
Signed-off-by: Akinori Mitani <akinori@artera.ai>
5a2c44f
to
4281029
Compare
Code Review Agent Run #110b04Actionable Suggestions - 1
Review Details
|
@@ -215,6 +215,9 @@ def prepare_python_install(image_spec: ImageSpec, tmp_dir: Path) -> str: | |||
if image_spec.pip_extra_index_url: | |||
extra_urls = [f"--extra-index-url {url}" for url in image_spec.pip_extra_index_url] | |||
pip_install_args.extend(extra_urls) | |||
|
|||
if image_spec.pip_extra_args: | |||
pip_install_args.append(image_spec.pip_extra_args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider checking if image_spec.pip_extra_args
is a list or a string. If it's a string, it should be split into individual arguments before appending to pip_install_args
.
Code suggestion
Check the AI-generated fix before applying
pip_install_args.append(image_spec.pip_extra_args) | |
if isinstance(image_spec.pip_extra_args, str): | |
pip_install_args.extend(image_spec.pip_extra_args.split()) | |
else: | |
pip_install_args.append(image_spec.pip_extra_args) |
Code Review Run #110b04
Is this a valid issue, or was it incorrectly flagged by the Agent?
- it was incorrectly flagged
Tracking issue
Related to flyteorg/flyte#6119
Why are the changes needed?
We have a few path dependencies in
pyproject.toml
andpoetry.lock
, and only want to install packages from external sources, which requires adding--no-directory
topoetry install
. This is a standard practice when installing dependencies without code.See
https://python-poetry.org/docs/faq/#poetry-busts-my-docker-cache-because-it-requires-me-to-copy-my-source-files-in-before-installing-3rd-party-dependencies
What changes were proposed in this pull request?
pip_extra_args
is a specifiable parameter forImageSpec
, and appended when runningpoetry install
,uv sync
andpip install
.How was this patch tested?
I tested locally with a poetry project with internal path dependency by running
pyflyte build
. Planning to add unit tests once the implementation get LGTM.Setup process
Screenshots
Check all the applicable boxes
Related PRs
#3025
Docs link
Summary by Bito
This pull request introduces a new feature by adding the pip_extra_args parameter to the ImageSpec class, enhancing package installation flexibility. Modifications are made to the image_spec module, specifically in default_builder.py and image_spec.py, to support this new parameter.Unit tests added: False
Estimated effort to review (1-5, lower is better): 1