Skip to content

Commit

Permalink
Use shutil.move instead of Path.rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Koncopd committed Oct 2, 2024
1 parent 7ec32c6 commit 60732a6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lamin_cli/_load.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations
from typing import Tuple
from lamin_utils import logger
import shutil
from pathlib import Path


Expand Down Expand Up @@ -68,7 +69,7 @@ def script_to_notebook(
filepath_cache = transform._source_code_artifact.cache()
if not target_filename.endswith(transform._source_code_artifact.suffix):
target_filename += transform._source_code_artifact.suffix
filepath_cache.rename(target_filename)
shutil.move(filepath_cache, target_filename)
elif transform.source_code is not None:
if transform.key.endswith(".ipynb"):
script_to_notebook(transform, target_filename, bump_revision=True)
Expand All @@ -89,8 +90,8 @@ def script_to_notebook(
target_env_filename = (
".".join(target_filename.split(".")[:-1]) + "__requirements.txt"
)
filepath_env_cache.rename(target_env_filename)
logger.important(target_env_filename)
shutil.move(filepath_env_cache, target_env_filename)
logger.important(f"environment is here: {target_env_filename}")
else:
logger.warning("latest transform run with environment doesn't exist")
return target_filename
Expand Down

0 comments on commit 60732a6

Please sign in to comment.