Skip to content

Commit

Permalink
Support single file upload and bug fix (#45)
Browse files Browse the repository at this point in the history
* Support upload single file

* update

* Reset dependencies version
  • Loading branch information
SeanHH86 authored Oct 9, 2024
1 parent 10ef3ac commit c752ed3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 28 deletions.
9 changes: 6 additions & 3 deletions pycsghub/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(
self.endpoint = endpoint
self.auto_create = auto_create
self.copy_files = copy_files
self.repo_url_prefix = self.repo_url_prefix()
self.repo_url_prefix = self.get_url_prefix()
self.namespace, self.name = model_id_to_group_owner_name(model_id=self.repo_id)
self.repo_dir = os.path.join(self.work_dir, self.name)

Expand Down Expand Up @@ -84,7 +84,7 @@ def upload(self) -> None:
def copy_repo_files(self):
from_path = ""
git_cmd_workdir = ""
if self.copy_files:
if self.copy_files or os.path.isfile(self.upload_path):
from_path = self.upload_path
git_cmd_workdir = self.repo_dir

Expand All @@ -96,7 +96,10 @@ def copy_repo_files(self):
elif os.path.isdir(item_path):
shutil.rmtree(item_path)

shutil.copytree(from_path, git_cmd_workdir, dirs_exist_ok=True)
if os.path.isfile(self.upload_path):
shutil.copyfile(self.upload_path, git_cmd_workdir)
else:
shutil.copytree(from_path, git_cmd_workdir, dirs_exist_ok=True)
else:
from_path = self.repo_dir
git_cmd_workdir = self.upload_path
Expand Down
50 changes: 25 additions & 25 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='csghub-sdk',
version='0.3.8',
version='0.3.9',
author="opencsg",
author_email="contact@opencsg.com",
long_description=long_description,
Expand All @@ -18,38 +18,38 @@
]
},
install_requires=[
"typer==0.12.3",
"attr==0.3.2",
"ConfigParser==7.0.0",
"contextlib2==21.6.0",
"cryptography==43.0.1",
"Cython==3.0.10",
"dl==0.1.0",
"docutils==0.21.2",
"HTMLParser==0.0.2",
"typer>=0.12.3",
"attr>=0.3.2",
"ConfigParser>=7.0.0",
"contextlib2>=21.6.0",
"cryptography>=43.0.1",
"Cython>=3.0.10",
"dl>=0.1.0",
"docutils>=0.21.2",
"HTMLParser>=0.0.2",
"huggingface_hub>=0.22.2",
"ipython==8.12.3",
"ipywidgets==8.1.2",
"keyring==25.2.1",
"lockfile==0.12.2",
"mock==5.1.0",
"Pillow==10.3.0",
"protobuf==5.27.0",
"ipython>=8.12.3",
"ipywidgets>=8.1.2",
"keyring>=25.2.1",
"lockfile>=0.12.2",
"mock>=5.1.0",
"Pillow>=10.3.0",
"protobuf>=5.27.0",
"pyOpenSSL>=24.1.0",
"railroad==0.5.0",
"Sphinx==7.3.7",
"thread==2.0.3",
"railroad>=0.5.0",
"Sphinx>=7.3.7",
"thread>=2.0.3",
"tornado>=6.4.1",
"tqdm==4.66.3",
"trove_classifiers==2024.5.22",
"truststore==0.9.1",
"urllib3_secure_extra==0.1.0",
"tqdm>=4.66.3",
"trove_classifiers>=2024.5.22",
"truststore>=0.9.1",
"urllib3_secure_extra>=0.1.0",
],
extras_require={
"train": [
"torch",
"transformers>=4.33.3",
"datasets==2.20.0"
"datasets>=2.20.0"
],
},
python_requires=">=3.10",
Expand Down

0 comments on commit c752ed3

Please sign in to comment.