Skip to content

Commit 0adc58d

Browse files
committed
🐛 fix project directory definition
1 parent 1bfd516 commit 0adc58d

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

merle/functions.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -660,10 +660,13 @@ def prepare_deployment_files(
660660
model_cache_dir = get_model_cache_dir(cache_dir, model_name, stage)
661661
model_cache_dir.mkdir(parents=True, exist_ok=True)
662662

663-
# Get project root and template directory
664-
project_root = Path(__file__).parent.parent
663+
# Get template directory from installed package
665664
template_dir = Path(__file__).parent / "templates"
666665

666+
# Get consuming project root from current working directory
667+
# (where the CLI is being run, not the installed package location)
668+
consuming_project_root = Path.cwd()
669+
667670
# Prepare replacements
668671
region = aws_region or REGION
669672
tags_dict = tags or {}
@@ -714,20 +717,24 @@ def prepare_deployment_files(
714717
context_window_size=context_window_size,
715718
)
716719

717-
# Copy pyproject.toml
718-
pyproject_src = project_root / "pyproject.toml"
720+
# Copy pyproject.toml from consuming project (where CLI is run)
721+
pyproject_src = consuming_project_root / "pyproject.toml"
719722
if pyproject_src.exists():
720723
shutil.copy2(pyproject_src, model_cache_dir / "pyproject.toml")
721-
logger.info("Copied pyproject.toml to model cache directory")
724+
logger.info(f"Copied pyproject.toml from consuming project: {consuming_project_root}")
725+
else:
726+
logger.warning(f"pyproject.toml not found in consuming project: {consuming_project_root}")
722727

723-
# Copy uv.lock if it exists
724-
uv_lock_src = project_root / "uv.lock"
728+
# Copy uv.lock from consuming project if it exists
729+
uv_lock_src = consuming_project_root / "uv.lock"
725730
if uv_lock_src.exists():
726731
shutil.copy2(uv_lock_src, model_cache_dir / "uv.lock")
727-
logger.info("Copied uv.lock to model cache directory")
732+
logger.info(f"Copied uv.lock from consuming project: {consuming_project_root}")
733+
else:
734+
logger.debug(f"uv.lock not found in consuming project: {consuming_project_root}")
728735

729-
# Copy merle/ directory
730-
merle_src = project_root / "merle"
736+
# Copy merle/ directory from installed package location
737+
merle_src = Path(__file__).parent
731738
merle_dst = model_cache_dir / "merle"
732739

733740
if merle_dst.exists():
@@ -738,7 +745,7 @@ def prepare_deployment_files(
738745
merle_dst,
739746
ignore=shutil.ignore_patterns("__pycache__", "*.pyc", "*.pyo", ".pytest_cache", "templates"),
740747
)
741-
logger.info("Copied merle/ directory to model cache directory")
748+
logger.info(f"Copied merle/ package from installed location: {merle_src}")
742749

743750
# Update configuration
744751
update_model_config(

0 commit comments

Comments
 (0)