-
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
Cookie cutter initial template #738
Changes from 15 commits
fd5dea3
79da424
38b0d88
688f214
d2130cc
79e9c1d
ab4c987
94f22cf
b441cf6
e1a6a4d
e5ad645
bf7f22d
25832e2
25aa23c
f547ed9
3f91dca
e8ea83a
b725095
f492bb5
b0fd8b4
0420410
3efecec
bf60412
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import click | ||
from cookiecutter.main import cookiecutter | ||
from cookiecutter.prompt import read_user_variable | ||
|
||
|
||
@click.command("init") | ||
@click.option("--template", default="simple-example", help="cookiecutter template to be used") | ||
@click.argument("project-name") | ||
def init(template, project_name): | ||
""" | ||
Create flyte-ready projects. | ||
""" | ||
click.echo( | ||
"What should we call your application? This serves as the top level package where your workflows will live." | ||
) | ||
app = read_user_variable("app", "myapp") | ||
click.echo("What should be the name of your example workflow?") | ||
workflow_name = read_user_variable("workflow", "workflow_example") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we just use click for consistency http://pallets-click.readthedocs.io/en/stable/prompts.html There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. using cookiecutter just for the templating feels less cluttered. Thanks for the suggestion! |
||
|
||
config = { | ||
"project_name": project_name, | ||
"app": app, | ||
"workflow": workflow_name, | ||
} | ||
cookiecutter( | ||
"https://github.com/flyteorg/flytekit-python-template.git", | ||
# TODO: remove this once we make the transition to cookie-cutter official. | ||
checkout="cookie-cutter", | ||
no_input=True, | ||
# We do not want to clobber existing files/directories. | ||
overwrite_if_exists=False, | ||
extra_context=config, | ||
# By specifying directory we can have multiple templates in the same repository, | ||
# as described in https://cookiecutter.readthedocs.io/en/1.7.2/advanced/directories.html. | ||
# The idea is to extend the number of templates, each in their own subdirectory, for example | ||
# a tensorflow-based example. | ||
directory=template, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
.[all-spark2.4] | ||
-c requirements.in | ||
-r requirements.in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also eventually I think the repo itself should be parameterizable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this idea of exposing the repo is interesting. So your expectation is that people will have their own private (or public forks) of the repo? In any case, if the need arises we can definitely go that way, but not in this PR, ok?