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 source code render documentation #1319

Merged
merged 5 commits into from
Dec 22, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions examples/development_lifecycle/development_lifecycle/decks.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,30 @@ def table_renderer() -> None:
)


# %% [markdown]
# :::{figure} https://raw.githubusercontent.com/flyteorg/static-resources/main/flytesnacks/user_guide/flyte_decks_source_code_renderer.png
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you create a PR to static resources? I can't find it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I thought this image file would be generated automatically, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it sounds like I need to manually create the file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# :alt: Source code renderer
# :class: with-shadow
# :::
# #### Source Code Renderer
# Converts a Source Code into HTML
# %%
import inspect

from flytekitplugins.deck.renderer import SourceCodeRenderer


@task(enable_deck=True)
def source_code_renderer() -> None:
file_path = inspect.getsourcefile(frame_renderer.__wrapped__)
with open(file_path, "r") as f:
source_code = f.read()
flytekit.Deck(
"Source Code Renderer",
SourceCodeRenderer().to_html(source_code),
)


# %% [markdown]
# :::{figure} https://raw.githubusercontent.com/flyteorg/static-resources/main/flytesnacks/user_guide/flyte_decks_table_renderer.png
# :alt: Table renderer
Expand Down
Loading