inferencesh 0.1.15__tar.gz → 0.1.17__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.2
2
2
  Name: inferencesh
3
- Version: 0.1.15
3
+ Version: 0.1.17
4
4
  Summary: inference.sh Python SDK
5
5
  Author: Inference Shell Inc.
6
6
  Author-email: "Inference Shell Inc." <hello@inference.sh>
@@ -39,7 +39,7 @@ file = File(path="/path/to/file.png")
39
39
  # File with explicit metadata
40
40
  file = File(
41
41
  path="/path/to/file.png",
42
- mime_type="image/png",
42
+ content_type="image/png",
43
43
  filename="custom_name.png",
44
44
  size=1024 # in bytes
45
45
  )
@@ -51,7 +51,7 @@ file = File.from_path("/path/to/file.png")
51
51
  exists = file.exists()
52
52
 
53
53
  # Access file metadata
54
- print(file.mime_type) # automatically detected if not specified
54
+ print(file.content_type) # automatically detected if not specified
55
55
  print(file.size) # file size in bytes
56
56
  print(file.filename) # basename of the file
57
57
 
@@ -21,7 +21,7 @@ file = File(path="/path/to/file.png")
21
21
  # File with explicit metadata
22
22
  file = File(
23
23
  path="/path/to/file.png",
24
- mime_type="image/png",
24
+ content_type="image/png",
25
25
  filename="custom_name.png",
26
26
  size=1024 # in bytes
27
27
  )
@@ -33,7 +33,7 @@ file = File.from_path("/path/to/file.png")
33
33
  exists = file.exists()
34
34
 
35
35
  # Access file metadata
36
- print(file.mime_type) # automatically detected if not specified
36
+ print(file.content_type) # automatically detected if not specified
37
37
  print(file.size) # file size in bytes
38
38
  print(file.filename) # basename of the file
39
39
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "inferencesh"
7
- version = "0.1.15"
7
+ version = "0.1.17"
8
8
  description = "inference.sh Python SDK"
9
9
  authors = [
10
10
  {name = "Inference Shell Inc.", email = "hello@inference.sh"},
@@ -1,5 +1,5 @@
1
1
  from typing import Optional, Union, ClassVar
2
- from pydantic import BaseModel, ConfigDict
2
+ from pydantic import BaseModel, ConfigDict, PrivateAttr
3
3
  import mimetypes
4
4
  import os
5
5
  import urllib.request
@@ -103,7 +103,7 @@ class File(BaseModel):
103
103
  """A class representing a file in the inference.sh ecosystem."""
104
104
  uri: str # Original location (URL or file path)
105
105
  path: Optional[str] = None # Resolved local file path
106
- mime_type: Optional[str] = None # MIME type of the file
106
+ content_type: Optional[str] = None # MIME type of the file
107
107
  size: Optional[int] = None # File size in bytes
108
108
  filename: Optional[str] = None # Original filename if available
109
109
  _tmp_path: Optional[str] = PrivateAttr(default=None) # Internal storage for temporary file path
@@ -177,8 +177,8 @@ class File(BaseModel):
177
177
  def _populate_metadata(self) -> None:
178
178
  """Populate file metadata from the path if it exists."""
179
179
  if os.path.exists(self.path):
180
- if not self.mime_type:
181
- self.mime_type = self._guess_mime_type()
180
+ if not self.content_type:
181
+ self.content_type = self._guess_content_type()
182
182
  if not self.size:
183
183
  self.size = self._get_file_size()
184
184
  if not self.filename:
@@ -189,7 +189,7 @@ class File(BaseModel):
189
189
  """Create a File instance from a file path."""
190
190
  return cls(uri=str(path))
191
191
 
192
- def _guess_mime_type(self) -> Optional[str]:
192
+ def _guess_content_type(self) -> Optional[str]:
193
193
  """Guess the MIME type of the file."""
194
194
  return mimetypes.guess_type(self.path)[0]
195
195
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: inferencesh
3
- Version: 0.1.15
3
+ Version: 0.1.17
4
4
  Summary: inference.sh Python SDK
5
5
  Author: Inference Shell Inc.
6
6
  Author-email: "Inference Shell Inc." <hello@inference.sh>
@@ -39,7 +39,7 @@ file = File(path="/path/to/file.png")
39
39
  # File with explicit metadata
40
40
  file = File(
41
41
  path="/path/to/file.png",
42
- mime_type="image/png",
42
+ content_type="image/png",
43
43
  filename="custom_name.png",
44
44
  size=1024 # in bytes
45
45
  )
@@ -51,7 +51,7 @@ file = File.from_path("/path/to/file.png")
51
51
  exists = file.exists()
52
52
 
53
53
  # Access file metadata
54
- print(file.mime_type) # automatically detected if not specified
54
+ print(file.content_type) # automatically detected if not specified
55
55
  print(file.size) # file size in bytes
56
56
  print(file.filename) # basename of the file
57
57
 
@@ -10,7 +10,7 @@ def test_file_creation():
10
10
  file = File(path="test.txt")
11
11
  assert file.exists()
12
12
  assert file.size > 0
13
- assert file.mime_type is not None
13
+ assert file.content_type is not None
14
14
  assert file.filename == "test.txt"
15
15
 
16
16
  os.remove("test.txt")
File without changes
File without changes
File without changes