Skip to content

Commit

Permalink
Bump version to 0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
b-g committed Sep 9, 2024
1 parent 3a1f7bc commit 0f27eed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "zoomaker"
version = "0.8.1"
version = "0.9.0"
description = "Zoomaker - Friendly house keeping for your AI model zoo and related resources."
authors = ["Benedikt Groß"]
readme = "README.md"
Expand Down
18 changes: 9 additions & 9 deletions zoomaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def install(self):
else:
repo.remotes.origin.pull()
print(f"\tgit pull latest: {repo.head.object.hexsha}")

# Download
else:
filename = self._slugify(os.path.basename(src))
Expand Down Expand Up @@ -151,20 +151,20 @@ def _download_file(self, src, install_to, name, bearer_token = None):
headers['Authorization'] = f'Bearer {bearer_token}'
response = requests.get(src, stream=True, allow_redirects=True, headers=headers)
response.raise_for_status()

# Get the filename from the Content-Disposition header
content_disposition = response.headers.get('Content-Disposition')
if content_disposition:
filename = re.findall("filename=(.+)", content_disposition)[0].strip('"')
else:
filename = name

# Sanitize the filename
filename = self._slugify(filename)

# Construct the full path for the file
file_path = os.path.join(install_to, filename)

# Download the file with progress bar
total_size = int(response.headers.get('content-length', 0))
with open(file_path, 'wb') as file, tqdm(
Expand All @@ -177,10 +177,10 @@ def _download_file(self, src, install_to, name, bearer_token = None):
for data in response.iter_content(chunk_size=1024):
size = file.write(data)
progress_bar.update(size)

print(f"\t Downloaded: {file_path}")
print(f"\t Size: {self._get_file_size(file_path)}")

return file_path
except requests.exceptions.RequestException as e:
print(f"\t ❌ Error downloading file: {e}")
Expand Down Expand Up @@ -214,7 +214,7 @@ def main():
parser = argparse.ArgumentParser(description="Install models, git repos and run scripts defined in the zoo.yaml file.")
parser.add_argument("command", nargs="?", choices=["install", "run"], help="The command to execute.")
parser.add_argument("script", nargs="?", help="The script name to execute.")
parser.add_argument("-v", "--version", action="version", help="The current version of the zoomaker.", version="0.8.0")
parser.add_argument("-v", "--version", action="version", help="The current version of the zoomaker.", version="0.9.0")
args = parser.parse_args()

if args.command == "install":
Expand All @@ -225,4 +225,4 @@ def main():
parser.print_help()

if __name__ == "__main__":
main()
main()

0 comments on commit 0f27eed

Please sign in to comment.