inferencesh 0.2.0__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of inferencesh might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: inferencesh
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: inference.sh Python SDK
5
5
  Author: Inference Shell Inc.
6
6
  Author-email: "Inference Shell Inc." <hello@inference.sh>
@@ -13,6 +13,7 @@ Requires-Python: >=3.7
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
15
  Requires-Dist: pydantic>=2.0.0
16
+ Requires-Dist: tqdm>=4.67.0
16
17
  Provides-Extra: test
17
18
  Requires-Dist: pytest>=7.0.0; extra == "test"
18
19
  Requires-Dist: pytest-cov>=4.0.0; extra == "test"
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "inferencesh"
7
- version = "0.2.0"
7
+ version = "0.2.2"
8
8
  description = "inference.sh Python SDK"
9
9
  authors = [
10
10
  {name = "Inference Shell Inc.", email = "hello@inference.sh"},
@@ -18,6 +18,7 @@ classifiers = [
18
18
  ]
19
19
  dependencies = [
20
20
  "pydantic>=2.0.0",
21
+ "tqdm>=4.67.0",
21
22
  ]
22
23
 
23
24
  [project.urls]
@@ -15,6 +15,7 @@ from enum import Enum
15
15
  import shutil
16
16
  from pathlib import Path
17
17
  import hashlib
18
+ from tqdm import tqdm
18
19
 
19
20
 
20
21
  # inspired by https://github.com/pydantic/pydantic/issues/7580
@@ -125,7 +126,6 @@ class File(BaseModel):
125
126
  @model_validator(mode='before')
126
127
  @classmethod
127
128
  def convert_str_to_file(cls, values):
128
- print(f"check_uri_or_path input: {values}")
129
129
  if isinstance(values, str): # Only accept strings
130
130
  return {"uri": values}
131
131
  elif isinstance(values, dict):
@@ -176,11 +176,22 @@ class File(BaseModel):
176
176
  }
177
177
  req = urllib.request.Request(original_url, headers=headers)
178
178
 
179
- # Download the file
179
+ # Download the file with progress bar
180
180
  print(f"Downloading URL: {original_url} to {self._tmp_path}")
181
181
  try:
182
- with urllib.request.urlopen(req) as response, open(self._tmp_path, 'wb') as out_file:
183
- out_file.write(response.read())
182
+ with urllib.request.urlopen(req) as response:
183
+ total_size = int(response.headers.get('content-length', 0))
184
+ block_size = 1024 # 1 Kibibyte
185
+
186
+ with tqdm(total=total_size, unit='iB', unit_scale=True) as pbar:
187
+ with open(self._tmp_path, 'wb') as out_file:
188
+ while True:
189
+ buffer = response.read(block_size)
190
+ if not buffer:
191
+ break
192
+ out_file.write(buffer)
193
+ pbar.update(len(buffer))
194
+
184
195
  self.path = self._tmp_path
185
196
  except (urllib.error.URLError, urllib.error.HTTPError) as e:
186
197
  raise RuntimeError(f"Failed to download URL {original_url}: {str(e)}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: inferencesh
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: inference.sh Python SDK
5
5
  Author: Inference Shell Inc.
6
6
  Author-email: "Inference Shell Inc." <hello@inference.sh>
@@ -13,6 +13,7 @@ Requires-Python: >=3.7
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
15
  Requires-Dist: pydantic>=2.0.0
16
+ Requires-Dist: tqdm>=4.67.0
16
17
  Provides-Extra: test
17
18
  Requires-Dist: pytest>=7.0.0; extra == "test"
18
19
  Requires-Dist: pytest-cov>=4.0.0; extra == "test"
@@ -1,4 +1,5 @@
1
1
  pydantic>=2.0.0
2
+ tqdm>=4.67.0
2
3
 
3
4
  [test]
4
5
  pytest>=7.0.0
File without changes
File without changes
File without changes
File without changes