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

Add pip_extra_args #3081

Merged
merged 2 commits into from
Jan 25, 2025
Merged

Add pip_extra_args #3081

merged 2 commits into from
Jan 25, 2025

Conversation

amitani
Copy link
Contributor

@amitani amitani commented Jan 23, 2025

Tracking issue

Related to flyteorg/flyte#6119

Why are the changes needed?

We have a few path dependencies in pyproject.toml and poetry.lock, and only want to install packages from external sources, which requires adding --no-directory to poetry 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 for ImageSpec, and appended when running poetry install, uv sync and pip 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

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

#3025

Docs link

Summary by Bito

Added new pip_extra_args parameter to ImageSpec class for enhanced package installation flexibility, enabling custom pip installation arguments for path dependencies in poetry projects. Enhanced test suite implementation to validate pip_extra_args parameter, including test cases for --no-install-package flag and path dependency handling with --no-directory option. Tests ensure proper integration with both poetry and pip installation workflows.

Unit tests added: True

Estimated effort to review (1-5, lower is better): 1

Copy link

welcome bot commented Jan 23, 2025

Thank you for opening this pull request! 🙌

These tips will help get your PR across the finish line:

  • Most of the repos have a PR template; if not, fill it out to the best of your knowledge.
  • Sign off your commits (Reference: DCO Guide).

@flyte-bot
Copy link
Contributor

flyte-bot commented Jan 23, 2025

Code Review Agent Run #bf76cd

Actionable Suggestions - 1
  • flytekit/image_spec/image_spec.py - 1
    • Missing class attribute for docstring · Line 51-51
Review Details
  • Files reviewed - 2 · Commit Range: 2569f80..2569f80
    • flytekit/image_spec/default_builder.py
    • flytekit/image_spec/image_spec.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

AI Code Review powered by Bito Logo

@flyte-bot
Copy link
Contributor

flyte-bot commented Jan 23, 2025

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted
Feature Improvement - Enhanced Package Installation Configuration

default_builder.py - Added support for pip_extra_args in python package installation

image_spec.py - Added pip_extra_args parameter to ImageSpec class

test_default_builder.py - Added test cases for pip_extra_args functionality

Copy link
Member

@thomasjpfan thomasjpfan left a 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 Show resolved Hide resolved
@flyte-bot
Copy link
Contributor

flyte-bot commented Jan 23, 2025

Code Review Agent Run #110b04

Actionable Suggestions - 1
  • flytekit/image_spec/default_builder.py - 1
    • Potential issue with pip_extra_args handling · Line 220-220
Review Details
  • Files reviewed - 2 · Commit Range: 4281029..4281029
    • flytekit/image_spec/default_builder.py
    • flytekit/image_spec/image_spec.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

AI Code Review powered by Bito Logo

wild-endeavor
wild-endeavor previously approved these changes Jan 24, 2025
Signed-off-by: amitani <[email protected]>
@flyte-bot
Copy link
Contributor

flyte-bot commented Jan 24, 2025

Code Review Agent Run #581024

Actionable Suggestions - 0
Additional Suggestions - 1
  • flytekit/image_spec/image_spec.py - 1
    • Consider validating pip extra args input · Line 86-86
Review Details
  • Files reviewed - 2 · Commit Range: 31a8f47..31a8f47
    • flytekit/image_spec/default_builder.py
    • flytekit/image_spec/image_spec.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

AI Code Review powered by Bito Logo

Copy link

codecov bot commented Jan 24, 2025

Codecov Report

Attention: Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 79.66%. Comparing base (06db981) to head (31a8f47).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
flytekit/image_spec/default_builder.py 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3081      +/-   ##
==========================================
+ Coverage   74.82%   79.66%   +4.83%     
==========================================
  Files         202      202              
  Lines       21446    21461      +15     
  Branches     2763     2766       +3     
==========================================
+ Hits        16048    17097    +1049     
+ Misses       4626     3595    -1031     
+ Partials      772      769       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: amitani <[email protected]>
@flyte-bot
Copy link
Contributor

flyte-bot commented Jan 24, 2025

Code Review Agent Run #c147c6

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 31a8f47..70d4f36
    • tests/flytekit/unit/core/image_spec/test_default_builder.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

AI Code Review powered by Bito Logo

@wild-endeavor wild-endeavor merged commit 5be0a6c into flyteorg:master Jan 25, 2025
103 of 106 checks passed
Copy link

welcome bot commented Jan 25, 2025

Congrats on merging your first pull request! 🎉

@amitani amitani deleted the pip_extra_args branch January 26, 2025 22:02
ChihTsungLu pushed a commit to ChihTsungLu/flytekit that referenced this pull request Jan 27, 2025
Signed-off-by: amitani <[email protected]>
Signed-off-by: lu00122 <[email protected]>
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.

4 participants