Skip to content

Commit

Permalink
Fix pyproject
Browse files Browse the repository at this point in the history
  • Loading branch information
kaarthik108 committed Aug 22, 2023
1 parent e46e830 commit dcd0eae
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
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 = "snowdev"
version = "0.1.9"
version = "0.1.10"
description = "snowdev: DevOps toolkit for Snowflake, facilitating seamless deployment of UDFs, stored procedures, and Streamlit apps using Snowpark's capabilities right from your local environment."
authors = ["kaarthik <[email protected]>"]
readme = "README.md"
Expand All @@ -17,6 +17,7 @@ python = ">=3.10.0,<3.11.0"
pydantic = "1.10.9"
termcolor = "2.3.0"
"snowflake-snowpark-python" = { version = "1.5.1", extras = ["pandas"] }
snowflake-ml-python = "1.0.5"
pyyaml = "^6.0.1"
toml = "^0.10.2"
openai = "^0.27.8"
Expand Down
12 changes: 12 additions & 0 deletions snowdev/fillers/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[tool.poetry]
name = "snowdev_user"
version = "0.1.0"
description = "snow Developers User"
authors = ["Your Name <[email protected]>"]

[tool.poetry.dependencies]
python = ">=3.10.0,<3.11.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
25 changes: 21 additions & 4 deletions snowdev/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,33 +256,50 @@ def deploy_pipe(self, pipe_name):


def create_directory_structure():
# Directories
dirs_to_create = {
"src": ["sproc", "streamlit", "udf"],
"static": ["packages"],
}

# Initialize a flag to check if the structure already exists
structure_already_exists = True

for root_dir, sub_dirs in dirs_to_create.items():
if not os.path.exists(root_dir):
structure_already_exists = False
os.mkdir(root_dir)
for sub_dir in sub_dirs:
os.mkdir(os.path.join(root_dir, sub_dir))

files_to_create = [".env", ".gitignore", "pyproject.toml"]

if not os.path.exists(".env"):
structure_already_exists = False
with open(".env", "w") as f:
f.write("")

if not os.path.exists(".gitignore"):
structure_already_exists = False
with open(".gitignore", "w") as f:
f.write("*.pyc\n__pycache__/\n.env")

if not os.path.exists("pyproject.toml"):
with open("pyproject.toml", "w") as f:
f.write("")
structure_already_exists = False
template_path = SnowHelper.get_template_path("fillers/pyproject.toml")
try:
with open(template_path, "r") as template_file:
content = template_file.read()

with open("pyproject.toml", "w") as f:
f.write(content)
except FileNotFoundError:
print(colored(f"Error: Template {template_path} not found!", "red"))

if structure_already_exists:
print(colored("Project structure is already initialized!", "yellow"))
else:
print(colored("Project structure initialized!", "green"))

print("Project structure initialized!")


def parse_args():
Expand Down

0 comments on commit dcd0eae

Please sign in to comment.