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 Flyin Config for VSCode Extension #1989

Merged
merged 27 commits into from
Nov 30, 2023

Conversation

Future-Outlier
Copy link
Member

@Future-Outlier Future-Outlier commented Nov 22, 2023

Tracking issue

flyteorg/flyte#4284

Describe your changes

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

Why

  • First use case: provide users predefined configs with common extension set, so users don't have to specify url themselves.
  • Second use case: For users want to append the default extension list, provide add_extension method in VscodeConfig dataclass to append the extension list. Directly changing extension_remote_path will overwrite the list and not convenient.

What

  • Add Predefined Config, for example variables like : COPILOT_CONFIG, VIM_CONFIG, CODE_TOGETHER_CONFIG
  • Add Extension Variables, for example variables like : COPILOT_EXTENSION, VIM_EXTENSION, CODE_TOGETHER_EXTENSION
  • Add add_extensions function: a function to extend the list of extension_remote_path, you can use either str or List[str] as the input variable.

Tests

Written in the Setup Process.
You can refer to the flyin tests too, it will teach you how to setup your custom config.

Setup Process

FROM python:3.9-slim-buster
USER root
WORKDIR /root
ENV PYTHONPATH /root
RUN apt-get update && apt-get install build-essential -y
RUN apt-get install git -y

RUN pip install -U git+https://github.com/Future-Outlier/flytekit.git@f564bd5b3bc1ae813ef704cea8e28e4724591228#subdirectory=plugins/flytekit-flyin
docker build -t localhost:30000/flytekit:flyin-2023-1127-2215 -f DockerfileVscode .
docker push localhost:30000/flytekit:flyin-2023-1127-2215
from flytekit import ImageSpec, task, workflow
from flytekitplugins.flyin import (CODE_TOGETHER_EXTENSION, COPILOT_EXTENSION,
                                   VIM_EXTENSION, VscodeConfig, vscode, VIM_CONFIG, COPILOT_CONFIG, CODE_TOGETHER_CONFIG)

"""
vim_config = VIM_CONFIG
copilot_config = COPILOT_CONFIG
code_together_config = CODE_TOGETHER_CONFIG
"""


additional_extensions = [COPILOT_EXTENSION, VIM_EXTENSION, CODE_TOGETHER_EXTENSION]
config = VscodeConfig()
config.add_extensions(additional_extensions)


@task(
    container_image="localhost:30000/flytekit:flyin-2023-1127-2215",
)
@vscode(
    config=config,
)
def t(a: int, b: int) -> int:
    return a + b


@workflow
def wf(a: int = 5, b: int = 3) -> int:
    out = t(a=a, b=b)
    return out

Screenshots

image

Future Outlier added 3 commits November 22, 2023 16:00
Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
Future Outlier added 5 commits November 22, 2023 16:52
Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
Copy link

codecov bot commented Nov 22, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (ff7aadc) 86.14% compared to head (b33e1ba) 86.15%.
Report is 1 commits behind head on master.

Files Patch % Lines
...lyin/flytekitplugins/flyin/vscode_lib/decorator.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1989      +/-   ##
==========================================
+ Coverage   86.14%   86.15%   +0.01%     
==========================================
  Files         319      320       +1     
  Lines       23399    23439      +40     
  Branches     3457     3457              
==========================================
+ Hits        20157    20195      +38     
- Misses       2651     2652       +1     
- Partials      591      592       +1     

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

Future Outlier added 7 commits November 22, 2023 22:38
Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
@Future-Outlier Future-Outlier changed the title Add flyin Config for VSCode Extension Add Flyin Config for VSCode Extension Nov 26, 2023
Future Outlier added 2 commits November 27, 2023 21:58
…nto add-flyin-dockerfile-install

Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
@ByronHsu
Copy link
Collaborator

ByronHsu commented Nov 27, 2023

You misunderstand the purpose of this PR a bit. we should create predefined configs instead of adding extensions as constant.

The title of this PR should be changed to Add Predefined Flyin Config for easier use

The description can be changed to

Why?

We want to predefine flyin configs containing the most common extension set, so users don't have to provide the remote URL themselves. They can directly use our predefined configs. e.g.

from flytekitplugins.flyin import copilot_config

@vscode(
  config=conpilot_config
)

Users are also free to create the config themselves by appending extension

from flytekitplugins.flyin.predefined_config import VscodeConfig

c = VscodeConfig()
c.add_extension(...)

@vscode(
  config=c
)

What?

We have created three predefined configs

  • copilot_config
  • vim_config
  • code_together_config

Future Outlier added 4 commits November 28, 2023 12:30
Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
Future Outlier added 2 commits November 28, 2023 12:52
Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
Copy link
Collaborator

@ByronHsu ByronHsu left a comment

Choose a reason for hiding this comment

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

Code looks good, but have to make pr description clearer. My suggestion:

Why

  • First use case: provide users predefined configs with common extension set, so users don't have to specify url themselves.
  • Second use case: For users want to append the default extension list, provide add_extension method in VscodeConfig dataclass to append the extension list. Directly changing extension_remote_path will overwrite the list and not convenient.

What

  • Add Predefined Config, for example variables like : COPILOT_CONFIG, VIM_CONFIG, CODE_TOGETHER_CONFIG
  • Add Extension Variables: ...
  • Add add_extensions function: ...

VIM_EXTENSION = "https://open-vsx.org/api/vscodevim/vim/1.27.0/file/vscodevim.vim-1.27.0.vsix"
CODE_TOGETHER_EXTENSION = "https://openvsxorg.blob.core.windows.net/resources/genuitecllc/codetogether/2023.2.0/genuitecllc.codetogether-2023.2.0.vsix"

# VSCode config with extensions
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# VSCode config with extensions
# Predefined VSCode config with extensions

Copy link
Member Author

@Future-Outlier Future-Outlier Nov 28, 2023

Choose a reason for hiding this comment

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

Fixed it, thank you really really much!

@Future-Outlier Future-Outlier marked this pull request as draft November 28, 2023 06:50
@Future-Outlier Future-Outlier marked this pull request as ready for review November 28, 2023 15:30
Signed-off-by: Future Outlier <[email protected]>
ByronHsu
ByronHsu previously approved these changes Nov 29, 2023
@ByronHsu
Copy link
Collaborator

LGTM

Signed-off-by: Future Outlier <[email protected]>
Future Outlier added 2 commits November 30, 2023 16:13
Signed-off-by: Future Outlier <[email protected]>
Signed-off-by: Future Outlier <[email protected]>
@troychiu
Copy link
Member

LGTM. Thank you @Future-Outlier

@pingsutw pingsutw merged commit 7f56629 into flyteorg:master Nov 30, 2023
76 checks passed
RRap0so pushed a commit to RRap0so/flytekit that referenced this pull request Dec 15, 2023
Signed-off-by: Future Outlier <[email protected]>
Co-authored-by: Future Outlier <[email protected]>
Signed-off-by: Rafael Raposo <[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