Skip to content

fix(toolkit): usage on windows #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions projects/fal/src/fal/toolkit/utils/download_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import shutil
import subprocess
from functools import lru_cache
from pathlib import Path
from pathlib import Path, PurePath
from tempfile import TemporaryDirectory
from urllib.parse import urlparse
from urllib.request import Request, urlopen

from fal.toolkit.mainify import mainify

FAL_PERSISTENT_DIR = Path("/data")
FAL_PERSISTENT_DIR = PurePath("/data")
FAL_REPOSITORY_DIR = FAL_PERSISTENT_DIR / ".fal" / "repos"
FAL_MODEL_WEIGHTS_DIR = FAL_PERSISTENT_DIR / ".fal" / "model_weights"

Expand Down Expand Up @@ -148,7 +148,7 @@ def download_file(

# If target_dir is not an absolute path, use "/data" as the relative directory
if not target_dir_path.is_absolute():
target_dir_path = FAL_PERSISTENT_DIR / target_dir_path
target_dir_path = FAL_PERSISTENT_DIR / target_dir_path # type: ignore[assignment]

target_path = target_dir_path.resolve() / file_name

Expand Down Expand Up @@ -338,10 +338,10 @@ def clone_repository(
Returns:
A Path object representing the full path to the cloned Git repository.
"""
target_dir = target_dir or FAL_REPOSITORY_DIR
target_dir = target_dir or FAL_REPOSITORY_DIR # type: ignore[assignment]
repo_name = repo_name or Path(https_url).stem

local_repo_path = Path(target_dir) / repo_name
local_repo_path = Path(target_dir) / repo_name # type: ignore[arg-type]

if local_repo_path.exists():
local_repo_commit_hash = _get_git_revision_hash(local_repo_path)
Expand Down