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

Cookie cutter initial template #738

Merged
merged 23 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
fd5dea3
Add cookiecutter to requirements and pyflyte init
eapolinario Oct 28, 2021
79da424
Invoke cookiecutter with the overridden configuration.
eapolinario Oct 28, 2021
38b0d88
Comment the use of directory in the call to cookiecutter.
eapolinario Oct 28, 2021
688f214
Use the original repo and do not clobber existing files+directories
eapolinario Nov 4, 2021
d2130cc
Add example sub-command
eapolinario Nov 4, 2021
79e9c1d
make requirements
eapolinario Nov 4, 2021
ab4c987
Merge remote-tracking branch 'origin' into cookie-cutter-initial-temp…
eapolinario Nov 5, 2021
94f22cf
Fix test_dataclass_transformer test
eapolinario Nov 5, 2021
b441cf6
Constrain mashmallow-jsonschema temporarily
eapolinario Nov 5, 2021
e1a6a4d
Add --template flag and project-name argument to command
eapolinario Nov 5, 2021
e5ad645
Revert changes to dataclass transformer tests
eapolinario Nov 5, 2021
bf7f22d
Constrain marshmallow-jsonschema in dev-requirements
eapolinario Nov 5, 2021
25832e2
Revert "Constrain marshmallow-jsonschema in dev-requirements"
eapolinario Nov 5, 2021
25aa23c
Fix typo in Makefile
eapolinario Nov 5, 2021
f547ed9
Fix regeneration of spark2 requirements file
eapolinario Nov 5, 2021
3f91dca
Use click for prompts
eapolinario Nov 5, 2021
e8ea83a
Merge remote-tracking branch 'origin' into cookie-cutter-initial-temp…
eapolinario Nov 5, 2021
b725095
Changes default workflow name to `my_wf`
eapolinario Nov 5, 2021
f492bb5
Remove the two inputs from simple-example
eapolinario Nov 5, 2021
b0fd8b4
Add more descriptive help for the template flag
eapolinario Nov 5, 2021
0420410
Merge remote-tracking branch 'origin' into cookie-cutter-initial-temp…
eapolinario Nov 8, 2021
3efecec
Set cookiecutter in setup.py
eapolinario Nov 8, 2021
bf60412
Default top level directory to flyte (as opposed to myapp)
eapolinario Nov 9, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ lint: ## Run linters
mypy flytekit/core || true
mypy flytekit/types || true
mypy tests/flytekit/unit/core || true
# Exclude setup.py to fix erorr: Duplicate module named "setup"
# Exclude setup.py to fix error: Duplicate module named "setup"
mypy plugins --exclude setup.py || true
pre-commit run --all-files

Expand Down
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ natsort==8.0.0
# flytekit
nodeenv==1.6.0
# via pre-commit
numpy==1.21.3
numpy==1.21.4
# via
# -c requirements.txt
# pandas
Expand Down
4 changes: 2 additions & 2 deletions doc-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jmespath==0.10.0
# via
# boto3
# botocore
jsonschema==4.2.0
jsonschema==4.2.1
# via nbformat
jupyter-client==7.0.6
# via
Expand Down Expand Up @@ -190,7 +190,7 @@ nest-asyncio==1.5.1
# via
# jupyter-client
# nbclient
numpy==1.21.3
numpy==1.21.4
# via
# flytekit
# pandas
Expand Down
36 changes: 36 additions & 0 deletions flytekit/clis/sdk_in_container/init.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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": "myapp",
"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.")
eapolinario marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions flytekit/clis/sdk_in_container/pyflyte.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from flytekit.clis.sdk_in_container.constants import CTX_PACKAGES
from flytekit.clis.sdk_in_container.fast_register import fast_register
from flytekit.clis.sdk_in_container.init import init
from flytekit.clis.sdk_in_container.launch_plan import launch_plans
from flytekit.clis.sdk_in_container.local_cache import local_cache
from flytekit.clis.sdk_in_container.package import package
Expand Down Expand Up @@ -112,6 +113,7 @@ def update_configuration_file(config_file_path):
main.add_command(launch_plans)
main.add_command(package)
main.add_command(local_cache)
main.add_command(init)

if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion requirements-spark2.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.[all-spark2.4]
-c requirements.in
-r requirements.in
35 changes: 29 additions & 6 deletions requirements-spark2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@
#
-e file:.#egg=flytekit
# via
# -c requirements.in
# -r requirements-spark2.in
# -r requirements.in
ansiwrap==0.8.4
# via papermill
arrow==1.2.1
# via jinja2-time
attrs==20.3.0
# via
# -c requirements.in
# -r requirements.in
# jsonschema
backcall==0.2.0
# via ipython
bcrypt==3.2.0
# via paramiko
binaryornot==0.4.4
# via cookiecutter
black==21.10b0
# via papermill
bleach==4.1.0
Expand All @@ -35,18 +39,23 @@ cffi==1.15.0
# bcrypt
# cryptography
# pynacl
chardet==4.0.0
# via binaryornot
charset-normalizer==2.0.7
# via requests
checksumdir==1.2.0
# via flytekit
click==7.1.2
# via
# black
# cookiecutter
# flytekit
# hmsclient
# papermill
cloudpickle==2.0.0
# via flytekit
cookiecutter==1.7.3
# via -r requirements.in
croniter==1.0.15
# via flytekit
cryptography==35.0.0
Expand Down Expand Up @@ -105,14 +114,19 @@ jeepney==0.7.1
# keyring
# secretstorage
jinja2==3.0.2
# via nbconvert
# via
# cookiecutter
# jinja2-time
# nbconvert
jinja2-time==0.2.0
# via cookiecutter
jmespath==0.10.0
# via
# boto3
# botocore
jsonschema==3.2.0
# via
# -c requirements.in
# -r requirements.in
# nbformat
jupyter-client==7.0.6
# via
Expand Down Expand Up @@ -165,7 +179,7 @@ nest-asyncio==1.5.1
# via
# jupyter-client
# nbclient
numpy==1.21.3
numpy==1.21.4
# via
# flytekit
# pandas
Expand All @@ -192,6 +206,8 @@ pickleshare==0.7.5
# via ipython
platformdirs==2.4.0
# via black
poyo==0.5.0
# via cookiecutter
prompt-toolkit==3.0.22
# via ipython
protobuf==3.19.1
Expand Down Expand Up @@ -227,13 +243,16 @@ pyspark==3.2.0
# via flytekit
python-dateutil==2.8.1
# via
# arrow
# botocore
# croniter
# flytekit
# jupyter-client
# pandas
python-json-logger==2.0.2
# via flytekit
python-slugify==5.0.2
# via cookiecutter
pytimeparse==1.1.8
# via flytekit
pytz==2018.4
Expand All @@ -242,7 +261,7 @@ pytz==2018.4
# pandas
pyyaml==5.4.1
# via
# -c requirements.in
# -r requirements.in
# papermill
pyzmq==22.3.0
# via jupyter-client
Expand All @@ -252,6 +271,7 @@ regex==2021.11.2
# docker-image-py
requests==2.26.0
# via
# cookiecutter
# flytekit
# papermill
# responses
Expand All @@ -273,6 +293,7 @@ six==1.16.0
# via
# bcrypt
# bleach
# cookiecutter
# flytekit
# grpcio
# jsonschema
Expand All @@ -290,6 +311,8 @@ tenacity==8.0.1
# via papermill
testpath==0.5.0
# via nbconvert
text-unidecode==1.3
# via python-slugify
textwrap3==0.9.2
# via ansiwrap
thrift==0.15.0
Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.[all]
-e file:.#egg=flytekit
cookiecutter
eapolinario marked this conversation as resolved.
Show resolved Hide resolved
attrs<21
# We need to restrict constrain the versions of both jsonschema and pyyaml because of docker-compose (which is
# used to run integration tests) pins those 2 libraries. We are in the process of removing docker-compose in
Expand Down
27 changes: 25 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# via -r requirements.in
ansiwrap==0.8.4
# via papermill
arrow==1.2.1
# via jinja2-time
attrs==20.3.0
# via
# -r requirements.in
Expand All @@ -16,6 +18,8 @@ backcall==0.2.0
# via ipython
bcrypt==3.2.0
# via paramiko
binaryornot==0.4.4
# via cookiecutter
black==21.10b0
# via papermill
bleach==4.1.0
Expand All @@ -33,18 +37,23 @@ cffi==1.15.0
# bcrypt
# cryptography
# pynacl
chardet==4.0.0
# via binaryornot
charset-normalizer==2.0.7
# via requests
checksumdir==1.2.0
# via flytekit
click==7.1.2
# via
# black
# cookiecutter
# flytekit
# hmsclient
# papermill
cloudpickle==2.0.0
# via flytekit
cookiecutter==1.7.3
# via -r requirements.in
croniter==1.0.15
# via flytekit
cryptography==35.0.0
Expand Down Expand Up @@ -103,7 +112,12 @@ jeepney==0.7.1
# keyring
# secretstorage
jinja2==3.0.2
# via nbconvert
# via
# cookiecutter
# jinja2-time
# nbconvert
jinja2-time==0.2.0
# via cookiecutter
jmespath==0.10.0
# via
# boto3
Expand Down Expand Up @@ -163,7 +177,7 @@ nest-asyncio==1.5.1
# via
# jupyter-client
# nbclient
numpy==1.21.3
numpy==1.21.4
# via
# flytekit
# pandas
Expand All @@ -190,6 +204,8 @@ pickleshare==0.7.5
# via ipython
platformdirs==2.4.0
# via black
poyo==0.5.0
# via cookiecutter
prompt-toolkit==3.0.22
# via ipython
protobuf==3.19.1
Expand Down Expand Up @@ -225,13 +241,16 @@ pyspark==3.2.0
# via flytekit
python-dateutil==2.8.1
# via
# arrow
# botocore
# croniter
# flytekit
# jupyter-client
# pandas
python-json-logger==2.0.2
# via flytekit
python-slugify==5.0.2
# via cookiecutter
pytimeparse==1.1.8
# via flytekit
pytz==2018.4
Expand All @@ -250,6 +269,7 @@ regex==2021.11.2
# docker-image-py
requests==2.26.0
# via
# cookiecutter
# flytekit
# papermill
# responses
Expand All @@ -271,6 +291,7 @@ six==1.16.0
# via
# bcrypt
# bleach
# cookiecutter
# flytekit
# grpcio
# jsonschema
Expand All @@ -288,6 +309,8 @@ tenacity==8.0.1
# via papermill
testpath==0.5.0
# via nbconvert
text-unidecode==1.3
# via python-slugify
textwrap3==0.9.2
# via ansiwrap
thrift==0.15.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ mypy-extensions==0.4.3
# via typing-inspect
natsort==8.0.0
# via flytekit
numpy==1.21.3
numpy==1.21.4
# via
# matplotlib
# opencv-python
Expand Down