Skip to content

Commit

Permalink
Added new action project creation support
Browse files Browse the repository at this point in the history
  • Loading branch information
franalgaba committed Jan 7, 2024
1 parent 32fc89b commit 27d9bfe
Show file tree
Hide file tree
Showing 5 changed files with 220 additions and 3 deletions.
2 changes: 1 addition & 1 deletion giza/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os

__version__ = "0.7.0"
__version__ = "0.9.0"
# Until DNS is fixed
API_HOST = os.environ.get("GIZA_API_HOST", "https://api.gizatech.xyz")
10 changes: 10 additions & 0 deletions giza/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import typer.rich_utils
from rich.traceback import install

from giza.commands.actions import app as actions_app
from giza.commands.actions import new
from giza.commands.deployments import app as deployments_app
from giza.commands.deployments import deploy
from giza.commands.models import app as models_app
Expand Down Expand Up @@ -38,6 +40,14 @@
help="""🚀 Utilities for managing deployments""",
)

app.add_typer(
actions_app,
name="actions",
short_help="🎯 Utilities for managing actions",
help="""🎯 Utilities for managing actions""",
)


app.callback(
name="giza",
help="""
Expand Down
26 changes: 26 additions & 0 deletions giza/commands/actions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from pathlib import Path

import typer
from cookiecutter.main import cookiecutter
from slugify import slugify

from giza.utils import echo

app = typer.Typer()


@app.command()
def new(project_name: str = typer.Argument(...)):
"""
This command will create a new action by generating a Python project.
"""
echo(f"Creating a new Action project with name: {project_name} ✅ ")
cookiecutter(
"gh:gizatechxyz/actions-template",
no_input=True,
extra_context={
"project_name": project_name,
"project_slug": slugify(project_name, separator="_"),
},
)
echo(f"Action project created successfully at ./{project_name} ✅")
182 changes: 181 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "giza-cli"
version = "0.8.0"
version = "0.9.0"
description = "CLI for interacting with Giza"
authors = ["Gonzalo Mellizo-Soto <[email protected]>"]
readme = "README.md"
Expand All @@ -22,6 +22,7 @@ python-jose = {version = "^3.3.0", extras = ["cryptography"]}
email-validator = "^2.0.0.post2"
types-python-jose = "^3.3.4.8"
types-requests = "^2.31.0.2"
cookiecutter = "^2.5.0"

[tool.poetry.group.dev.dependencies]
pre-commit = "^3.3.3"
Expand Down

0 comments on commit 27d9bfe

Please sign in to comment.