-
Notifications
You must be signed in to change notification settings - Fork 301
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
feat: add source code
deck
#2038
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add `pygments` to the list of plugin requirements in `setup.py` - Add `pygments` import in `renderer.py` Signed-off-by: jason.lai <[email protected]>
- Add CSS styling to the rendered HTML code in `renderer.py` - Update the `to_html` method to include the CSS styling in the returned HTML Signed-off-by: jason.lai <[email protected]>
- Add a new class `CustomColorfulStyle` that extends `ColorfulStyle` from `pygments.styles.colorful` - Remove the styling for `Generic.Error` in `CustomColorfulStyle` - Comment out the line that initializes `formatter` with the `HtmlFormatter` class and instead initialize it with `CustomColorfulStyle` - Update the `to_html` method to use the updated `formatter` Signed-off-by: jason.lai <[email protected]>
- Remove `CustomColorfulStyle` class - Update `to_html` method to use default `HtmlFormatter` style and fix css color code Signed-off-by: jason.lai <[email protected]>
…nvolve updating the codebase's configuration files (`renderer.py` and `setup.py`) and do not fix a bug or add a new feature.: update code style and dependencies - Update the `to_html` method in `renderer.py` to use double quotes for the `HtmlFormatter` style parameter - Rearrange the order of the `plugin_requires` list in `setup.py` Signed-off-by: jason.lai <[email protected]>
- Modify the `to_html` method in `renderer.py` to include a docstring explaining its functionality - Update the `css` variable in the `to_html` method to use a separate method `_get_css` in `renderer.py` - Add a new static method `_get_css` in `renderer.py` to extract CSS from the provided `HtmlFormatter` instance and replace a specific color code - Add a new test method `test_get_css` in `test_renderer.py` to test the `_get_css` method in `renderer.py` Signed-off-by: jason.lai <[email protected]>
jasonlai1218
requested review from
wild-endeavor,
kumare3,
eapolinario,
pingsutw and
cosmicBboy
as code owners
December 11, 2023 08:58
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2038 +/- ##
===========================================
- Coverage 85.98% 64.87% -21.12%
===========================================
Files 308 308
Lines 22946 22965 +19
Branches 3468 3468
===========================================
- Hits 19731 14898 -4833
- Misses 2615 7653 +5038
+ Partials 600 414 -186 ☔ View full report in Codecov by Sentry. |
pingsutw
reviewed
Dec 13, 2023
plugins/flytekit-deck-standard/flytekitplugins/deck/renderer.py
Outdated
Show resolved
Hide resolved
- Remove unused imports and code from `renderer.py` - Refactor `_get_css` method to be a static method of `SourceCodeRenderer` - Add a test for `SourceCodeRenderer.to_html` method in `test_renderer.py` - Update assertions in `test_source_code_renderer` to check the result of `renderer.to_html` method Signed-off-by: jason.lai <[email protected]>
pingsutw
previously approved these changes
Dec 13, 2023
- Remove the import of `pytest` - Add the import of `tempfile` - Remove the import of `pandas` - Add the import of `markdown` - Remove the import of `ImageRenderer` - Change the order of imports Signed-off-by: jason.lai <[email protected]>
pingsutw
approved these changes
Dec 14, 2023
RRap0so
pushed a commit
to RRap0so/flytekit
that referenced
this pull request
Dec 15, 2023
* chore: add pygments as a plugin requirement and import in renderer - Add `pygments` to the list of plugin requirements in `setup.py` - Add `pygments` import in `renderer.py` Signed-off-by: jason.lai <[email protected]> * style: improve HTML rendering with CSS styling - Add CSS styling to the rendered HTML code in `renderer.py` - Update the `to_html` method to include the CSS styling in the returned HTML Signed-off-by: jason.lai <[email protected]> * feat: refactor HTML formatting to use custom styling - Add a new class `CustomColorfulStyle` that extends `ColorfulStyle` from `pygments.styles.colorful` - Remove the styling for `Generic.Error` in `CustomColorfulStyle` - Comment out the line that initializes `formatter` with the `HtmlFormatter` class and instead initialize it with `CustomColorfulStyle` - Update the `to_html` method to use the updated `formatter` Signed-off-by: jason.lai <[email protected]> * refactor: refactor code for better HTML formatting - Remove `CustomColorfulStyle` class - Update `to_html` method to use default `HtmlFormatter` style and fix css color code Signed-off-by: jason.lai <[email protected]> * The label that best describes this change is "chore". These changes involve updating the codebase's configuration files (`renderer.py` and `setup.py`) and do not fix a bug or add a new feature.: update code style and dependencies - Update the `to_html` method in `renderer.py` to use double quotes for the `HtmlFormatter` style parameter - Rearrange the order of the `plugin_requires` list in `setup.py` Signed-off-by: jason.lai <[email protected]> * feat: refactor `renderer.py` to improve documentation and CSS extraction - Modify the `to_html` method in `renderer.py` to include a docstring explaining its functionality - Update the `css` variable in the `to_html` method to use a separate method `_get_css` in `renderer.py` - Add a new static method `_get_css` in `renderer.py` to extract CSS from the provided `HtmlFormatter` instance and replace a specific color code - Add a new test method `test_get_css` in `test_renderer.py` to test the `_get_css` method in `renderer.py` Signed-off-by: jason.lai <[email protected]> * refactor: refactor SourceCodeRenderer and update test assertions - Remove unused imports and code from `renderer.py` - Refactor `_get_css` method to be a static method of `SourceCodeRenderer` - Add a test for `SourceCodeRenderer.to_html` method in `test_renderer.py` - Update assertions in `test_source_code_renderer` to check the result of `renderer.to_html` method Signed-off-by: jason.lai <[email protected]> * chore: reorganize imports in files for better readability - Remove the import of `pytest` - Add the import of `tempfile` - Remove the import of `pandas` - Add the import of `markdown` - Remove the import of `ImageRenderer` - Change the order of imports Signed-off-by: jason.lai <[email protected]> --------- Signed-off-by: jason.lai <[email protected]> Signed-off-by: Rafael Raposo <[email protected]>
Nice feature @jasonlai1218 :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tracking issue
Why are the changes needed?
Because Data Engineers sometimes open the console (UI) with stakeholders to discuss business logic in the data pipeline, at this time, in addition to the expression of data graphics, they can also present source code to discuss program architecture design if necessary.
This is the idea from @pingsutw, I also agree with this idea very much, so I implemented this function.
What changes were proposed in this pull request?
pygments
to the list of plugin requirements insetup.py
pygments
import inrenderer.py
renderer.py
to_html
method to include the CSS styling in the returned HTML_get_css
inrenderer.py
to extract CSS from the providedHtmlFormatter
instance and replace a specific color codeHow was this patch tested?
test_get_css
intest_renderer.py
to test the_get_css
method inrenderer.py
Setup process
FLYTE_SDK_LOGGING_LEVEL=20 pyflyte run deck.py wf
Screenshots
Check all the applicable boxes
Related PRs
flytesnacks: flyteorg/flytesnacks#1319
Docs link