Skip to content

Commit

Permalink
Add app template gitignore with patterns that packager will ignore fo…
Browse files Browse the repository at this point in the history
…r deployments
  • Loading branch information
zachgiordano committed Dec 12, 2023
1 parent afc7112 commit b231436
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 8 additions & 2 deletions griptape/cli/core/app_packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,17 @@ def get_deployment_source(self) -> str:

def _create_deployment_tmp_dir(self) -> str:
# Copy to new dir to ignore certain patterns
# TODO: Should more patterns be ignored?
ignore_patterns = []
if os.path.exists(os.path.join(self.app_directory, ".gitignore")):
with open(os.path.join(self.app_directory, ".gitignore"), "r") as file:
for line in file.readlines():
if line.endswith("\n"):
line = line[:-1]
ignore_patterns.append(line.strip())
return shutil.copytree(
self.app_directory,
os.path.join(self.app_directory, "zip_tmp"),
ignore=shutil.ignore_patterns(".venv*", "__pycache__*", "*.pyc"),
ignore=shutil.ignore_patterns(*ignore_patterns),
)

def _create_deployment_zip_file(self, tmp_dir: str) -> str:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
venv*
.venv*
__pycache__*
*.pyc

0 comments on commit b231436

Please sign in to comment.