forked from flyteorg/flytekit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cookie cutter initial template (flyteorg#738)
* Add cookiecutter to requirements and pyflyte init Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Invoke cookiecutter with the overridden configuration. Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Comment the use of directory in the call to cookiecutter. Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Use the original repo and do not clobber existing files+directories Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Add example sub-command Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * make requirements Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Fix test_dataclass_transformer test Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Constrain mashmallow-jsonschema temporarily Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Add --template flag and project-name argument to command Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Revert changes to dataclass transformer tests Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Constrain marshmallow-jsonschema in dev-requirements Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Revert "Constrain marshmallow-jsonschema in dev-requirements" This reverts commit bf7f22d. * Fix typo in Makefile Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Fix regeneration of spark2 requirements file Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Use click for prompts Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Changes default workflow name to `my_wf` Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Remove the two inputs from simple-example Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Add more descriptive help for the template flag Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Set cookiecutter in setup.py Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> * Default top level directory to flyte (as opposed to myapp) Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> Co-authored-by: Eduardo Apolinario <eapolinario@users.noreply.github.com> Signed-off-by: Robert Everson <reverson@lyft.com>
- Loading branch information
1 parent
fe89f96
commit b5a2689
Showing
10 changed files
with
219 additions
and
41 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import click | ||
from cookiecutter.main import cookiecutter | ||
|
||
|
||
@click.command("init") | ||
@click.option( | ||
"--template", | ||
default="simple-example", | ||
help="cookiecutter template folder name to be used in the repo - https://github.com/flyteorg/flytekit-python-template.git", | ||
) | ||
@click.argument("project-name") | ||
def init(template, project_name): | ||
""" | ||
Create flyte-ready projects. | ||
""" | ||
config = { | ||
"project_name": project_name, | ||
"app": "flyte", | ||
"workflow": "my_wf", | ||
} | ||
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, | ||
) | ||
|
||
click.echo( | ||
f"Visit the {project_name} directory and follow the next steps in the Getting started guide (https://docs.flyte.org/en/latest/getting_started.html) to proceed." | ||
) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
.[all-spark2.4] | ||
-c requirements.in | ||
-r requirements.in |
Oops, something went wrong.