-
Notifications
You must be signed in to change notification settings - Fork 301
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 (#738)
* Add cookiecutter to requirements and pyflyte init Signed-off-by: Eduardo Apolinario <[email protected]> * Invoke cookiecutter with the overridden configuration. Signed-off-by: Eduardo Apolinario <[email protected]> * Comment the use of directory in the call to cookiecutter. Signed-off-by: Eduardo Apolinario <[email protected]> * Use the original repo and do not clobber existing files+directories Signed-off-by: Eduardo Apolinario <[email protected]> * Add example sub-command Signed-off-by: Eduardo Apolinario <[email protected]> * make requirements Signed-off-by: Eduardo Apolinario <[email protected]> * Fix test_dataclass_transformer test Signed-off-by: Eduardo Apolinario <[email protected]> * Constrain mashmallow-jsonschema temporarily Signed-off-by: Eduardo Apolinario <[email protected]> * Add --template flag and project-name argument to command Signed-off-by: Eduardo Apolinario <[email protected]> * Revert changes to dataclass transformer tests Signed-off-by: Eduardo Apolinario <[email protected]> * Constrain marshmallow-jsonschema in dev-requirements Signed-off-by: Eduardo Apolinario <[email protected]> * Revert "Constrain marshmallow-jsonschema in dev-requirements" This reverts commit bf7f22d. * Fix typo in Makefile Signed-off-by: Eduardo Apolinario <[email protected]> * Fix regeneration of spark2 requirements file Signed-off-by: Eduardo Apolinario <[email protected]> * Use click for prompts Signed-off-by: Eduardo Apolinario <[email protected]> * Changes default workflow name to `my_wf` Signed-off-by: Eduardo Apolinario <[email protected]> * Remove the two inputs from simple-example Signed-off-by: Eduardo Apolinario <[email protected]> * Add more descriptive help for the template flag Signed-off-by: Eduardo Apolinario <[email protected]> * Set cookiecutter in setup.py Signed-off-by: Eduardo Apolinario <[email protected]> * Default top level directory to flyte (as opposed to myapp) Signed-off-by: Eduardo Apolinario <[email protected]> Co-authored-by: Eduardo Apolinario <[email protected]>
- Loading branch information
1 parent
c4f33c6
commit d846ed5
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.