Add Python Dependency Deck
Tracking issue
Why are the changes needed?
In Python Dependency Deck, the version of the Python package currently being used can be displayed, which can make debugging easier.
What changes were proposed in this pull request?
- Add a class
PythonDependencyDeckto deck.py - Add a method
add_decktoFlyteContextclass
How was this patch tested?
Setup process
import flytekit
from flytekit import task, workflow, ImageSpec
flytekit_version = "git+https://github.com/jasonlai1218/flytekit.git@add-py-deps-deck#commit=b5f49b4070621ba87224c9d223a6f7d710084673"
deck_plugin_version = "git+https://github.com/jasonlai1218/flytekit.git@add-py-deps-deck#commit=b5f49b4070621ba87224c9d223a6f7d710084673#subdirectory=plugins/flytekit-deck-standard"
image_spec = ImageSpec(
packages=[flytekit_version, deck_plugin_version],
apt_packages=["git"],
registry="jasonlai1218",
env={"FLYTE_SDK_LOGGING_LEVEL": "20"},
)
@task(container_image=image_spec, enable_deck=True)
def python_dependency_deck() -> None:
ctx = flytekit.FlyteContextManager.current_context()
ctx.add_deck(PythonDependencyDeck())
@workflow
def wf() -> None:
python_dependency_deck()
if __name__ == "__main__":
wf()
Screenshots
Check all the applicable boxes
- [ ] I updated the documentation accordingly.
- [x] All new and existing tests passed.
- [x] All commits are signed-off.
Related PRs
https://github.com/flyteorg/flyteconsole/pull/852
Docs link
Codecov Report
Attention: Patch coverage is 90.32258% with 3 lines in your changes are missing coverage. Please review.
Project coverage is 82.68%. Comparing base (
55f0b19) to head (814a952).
| Files | Patch % | Lines |
|---|---|---|
| flytekit/deck/renderer.py | 85.00% | 3 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #2264 +/- ##
==========================================
- Coverage 83.50% 82.68% -0.83%
==========================================
Files 324 305 -19
Lines 24754 24063 -691
Branches 3734 3523 -211
==========================================
- Hits 20672 19896 -776
- Misses 3452 3542 +90
+ Partials 630 625 -5
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
From https://github.com/flyteorg/flytekit/pull/2264#discussion_r1524000584, I think it'll be more useful to show pip freeze directly and do not table formatting. For me, the use case is to copy out the requirements.txt, so I can recreate the environment. If the requirements were rendered as a table, it'll be harder to recreate the environment.