Skip to content

Commit

Permalink
docs: refactor project structure and improve user experience
Browse files Browse the repository at this point in the history
- Change the title of the deck from `Python Dependencies` to `Dependencies`
- Update the error message in case of a subprocess error in fetching installed packages
- Add a heading `Python Dependencies` above the table output in the HTML

Signed-off-by: jason.lai <[email protected]>
  • Loading branch information
jasonlai1218 committed Apr 3, 2024
1 parent 0f5a455 commit ef47b14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion flytekit/core/python_function_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def _write_decks(self, native_inputs, native_outputs_as_map, ctx, new_user_param
renderer = SourceCodeRenderer()
source_code_deck.append(renderer.to_html(source_code))

python_dependencies_deck = Deck("Python Dependencies")
python_dependencies_deck = Deck("Dependencies")
renderer = PythonDependencyRenderer()
python_dependencies_deck.append(renderer.to_html())

Expand Down
6 changes: 3 additions & 3 deletions flytekit/deck/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class PythonDependencyRenderer:
PythonDependencyDeck is a deck that contains information about packages installed via pip.
"""

def __init__(self, title: str = "Python Dependencies"):
def __init__(self, title: str = "Dependencies"):
self._title = title

def to_html(self) -> str:
Expand All @@ -115,7 +115,7 @@ def to_html(self) -> str:
)
except subprocess.CalledProcessError as e:
logger.error(f"Error occurred while fetching installed packages: {e}")
return ""
return "Error occurred while fetching installed packages."

table = (
"<table>\n<tr>\n<th style='text-align:left;'>Name</th>\n<th style='text-align:left;'>Version</th>\n</tr>\n"
Expand Down Expand Up @@ -150,7 +150,7 @@ def to_html(self) -> str:
<button onclick="copyTable()">
<span>Copy table as requirements.txt</span>
</button>
<br><br><br>
<h3>Python Dependencies</h3>
{table}
Expand Down

0 comments on commit ef47b14

Please sign in to comment.