sideload 1.0.0__py3-none-any.whl → 1.2.0__py3-none-any.whl

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 sideload might be problematic. Click here for more details.

sideload/cli.py CHANGED
@@ -117,7 +117,7 @@ class SideloadClient:
117
117
  return self.manager.get_sideload_data(bin_id)
118
118
 
119
119
  def download_packages(
120
- self, package_names: List[str], output_dir: Path
120
+ self, package_names: List[str], output_dir: Path, debug: bool = False
121
121
  ) -> List[Path]:
122
122
  """Download all packages to a temporary directory"""
123
123
  downloaded_files = []
@@ -128,6 +128,7 @@ class SideloadClient:
128
128
  BarColumn(),
129
129
  TaskProgressColumn(),
130
130
  console=console,
131
+ disable=debug, # Disable progress bar in debug mode
131
132
  ) as progress:
132
133
  download_task = progress.add_task(
133
134
  "Downloading packages...", total=len(package_names)
@@ -142,18 +143,23 @@ class SideloadClient:
142
143
 
143
144
  # Download using pip to temporary directory
144
145
  try:
146
+ cmd = [
147
+ sys.executable,
148
+ "-m",
149
+ "pip",
150
+ "download",
151
+ "--no-deps",
152
+ "--dest",
153
+ str(output_dir),
154
+ package_name,
155
+ ]
156
+
157
+ if debug:
158
+ console.print(f"[dim]Running: {' '.join(cmd)}[/dim]")
159
+
145
160
  subprocess.run(
146
- [
147
- sys.executable,
148
- "-m",
149
- "pip",
150
- "download",
151
- "--no-deps",
152
- "--dest",
153
- str(output_dir),
154
- package_name,
155
- ],
156
- capture_output=True,
161
+ cmd,
162
+ capture_output=not debug,
157
163
  text=True,
158
164
  check=True,
159
165
  )
@@ -162,10 +168,13 @@ class SideloadClient:
162
168
  wheel_files = list(output_dir.glob(f"{package_name}*.whl"))
163
169
  if wheel_files:
164
170
  downloaded_files.append(wheel_files[0])
171
+ if debug:
172
+ console.print(f"[green]✓ Downloaded: {wheel_files[0].name}[/green]")
165
173
 
166
174
  except subprocess.CalledProcessError as e:
175
+ error_msg = e.stderr if hasattr(e, 'stderr') and e.stderr else str(e)
167
176
  console.print(
168
- f"❌ Failed to download {package_name}: {e.stderr}", style="red"
177
+ f"❌ Failed to download {package_name}: {error_msg}", style="red"
169
178
  )
170
179
  continue
171
180
 
@@ -178,19 +187,33 @@ class SideloadClient:
178
187
  return downloaded_files
179
188
 
180
189
  def extract_and_reassemble(
181
- self, wheel_files: List[Path], package_names: List[str], original_filename: str, output_path: Path, debug: bool = False
190
+ self, wheel_files: List[Path], package_names: List[str], original_filename: str, output_path: Path, debug: bool = False, work_dir: Path = None
182
191
  ):
183
192
  """Extract parts from wheel files and reassemble the original file"""
184
- with tempfile.TemporaryDirectory() as temp_dir:
185
- temp_path = Path(temp_dir)
193
+ # Use provided work directory or create a temporary one
194
+ use_temp = work_dir is None
195
+ if use_temp:
196
+ temp_dir_obj = tempfile.TemporaryDirectory()
197
+ temp_path = Path(temp_dir_obj.name)
198
+ else:
199
+ temp_dir_obj = None
200
+ temp_path = work_dir
201
+ temp_path.mkdir(parents=True, exist_ok=True)
202
+
203
+ try:
186
204
  part_files = []
187
205
 
206
+ if not use_temp:
207
+ console.print(f"[yellow]⚠️ Using work directory: {temp_path}[/yellow]")
208
+ console.print(f"[yellow] Files will be kept after extraction for debugging[/yellow]")
209
+
188
210
  with Progress(
189
211
  SpinnerColumn(),
190
212
  TextColumn("[progress.description]{task.description}"),
191
213
  BarColumn(),
192
214
  TaskProgressColumn(),
193
215
  console=console,
216
+ disable=debug, # Disable progress bar in debug mode
194
217
  ) as progress:
195
218
  extract_task = progress.add_task(
196
219
  "Extracting packages...", total=len(wheel_files)
@@ -204,6 +227,9 @@ class SideloadClient:
204
227
  completed=i,
205
228
  )
206
229
 
230
+ if debug:
231
+ console.print(f"\n[cyan]Extracting package {i + 1}/{len(wheel_files)}: {package_name}[/cyan]")
232
+
207
233
  # Extract wheel file (it's just a zip)
208
234
  import zipfile
209
235
 
@@ -261,6 +287,7 @@ class SideloadClient:
261
287
  BarColumn(),
262
288
  TaskProgressColumn(),
263
289
  console=console,
290
+ disable=debug, # Disable progress bar in debug mode
264
291
  ) as progress:
265
292
  reassemble_task = progress.add_task(
266
293
  "Reassembling file...", total=len(part_files)
@@ -274,6 +301,9 @@ class SideloadClient:
274
301
  completed=i,
275
302
  )
276
303
 
304
+ if debug:
305
+ console.print(f"[dim]Reading part {i + 1}/{len(part_files)}: {part_file.name} ({part_file.stat().st_size:,} bytes)[/dim]")
306
+
277
307
  with open(part_file, "rb") as part:
278
308
  output_file.write(part.read())
279
309
 
@@ -282,6 +312,10 @@ class SideloadClient:
282
312
  description="✅ Reassembly complete!",
283
313
  completed=len(part_files),
284
314
  )
315
+ finally:
316
+ # Clean up temporary directory if we created one
317
+ if use_temp and temp_dir_obj:
318
+ temp_dir_obj.cleanup()
285
319
 
286
320
 
287
321
  def display_header():
@@ -341,6 +375,11 @@ Examples:
341
375
  action="store_true",
342
376
  help="Enable debug logging",
343
377
  )
378
+ download_parser.add_argument(
379
+ "--work-dir",
380
+ type=Path,
381
+ help="Working directory for extraction (for debugging, defaults to temp directory)",
382
+ )
344
383
 
345
384
  args = parser.parse_args()
346
385
 
@@ -372,6 +411,15 @@ Examples:
372
411
  # Ensure output directory exists
373
412
  args.output.mkdir(parents=True, exist_ok=True)
374
413
 
414
+ # Show debug flags if enabled
415
+ if args.debug:
416
+ console.print("\n[bold cyan]Debug Mode Enabled[/bold cyan]")
417
+ console.print(f" [dim]URL:[/dim] {args.url}")
418
+ console.print(f" [dim]Output:[/dim] {args.output}")
419
+ console.print(f" [dim]Work Directory:[/dim] {args.work_dir or 'temp (auto-cleanup)'}")
420
+ console.print(f" [dim]Collection ID:[/dim] {collection_id}")
421
+ console.print()
422
+
375
423
  try:
376
424
  with SideloadClient(jsonbin_token, collection_id) as client:
377
425
  # Create the request
@@ -403,7 +451,7 @@ Examples:
403
451
 
404
452
  with tempfile.TemporaryDirectory() as temp_dir:
405
453
  temp_path = Path(temp_dir)
406
- wheel_files = client.download_packages(package_names, temp_path)
454
+ wheel_files = client.download_packages(package_names, temp_path, args.debug)
407
455
 
408
456
  if not wheel_files:
409
457
  console.print(
@@ -417,7 +465,7 @@ Examples:
417
465
  output_file = args.output / original_filename
418
466
 
419
467
  client.extract_and_reassemble(
420
- wheel_files, package_names, original_filename, output_file, args.debug
468
+ wheel_files, package_names, original_filename, output_file, args.debug, args.work_dir
421
469
  )
422
470
 
423
471
  # Success!
sideload/main.py CHANGED
@@ -11,7 +11,7 @@ from sideload.jsonbin_connector import JSONBinConnector
11
11
 
12
12
  JSONBIN_TOKEN = os.environ["JSONBIN_TOKEN"]
13
13
  PYPI_TOKEN = os.environ["PYPI_TOKEN"]
14
- MAX_PACKAGE_SIZE = 2 * 1024 * 1024 # 95 MB
14
+ MAX_PACKAGE_SIZE = 95 * 1024 * 1024 # 95 MB
15
15
 
16
16
  LAST_BINS: dict[str, str | None] = {}
17
17
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sideload
3
- Version: 1.0.0
3
+ Version: 1.2.0
4
4
  Summary: Download large files via PyPI packages
5
5
  Author: Sygmei
6
6
  Author-email: Sygmei <3835355+Sygmei@users.noreply.github.com>
@@ -1,11 +1,11 @@
1
1
  sideload/__init__.py,sha256=Y3rHLtR7n0sjLXrn-BEcrbIHx-9uE1tPZkooavo7xcA,222
2
- sideload/cli.py,sha256=V_pMrvBBLuFYFd1gM2AHYRUOUy8KO5lA9jkLnURP4ZU,16586
2
+ sideload/cli.py,sha256=JCedG4Xqz3AQ-24eerMW8ZdBpTx_sOZI1nfXDzOU9dE,18843
3
3
  sideload/jsonbin.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  sideload/jsonbin_connector.py,sha256=HtR1Pwnpm5jfYcmnvcug9HaKxFpsyJBXYYlLuzWPiTE,1680
5
5
  sideload/jsonbin_old.py,sha256=ve21WsV7Ay60moFfrR4lSM_JRZNqo4z5v69cNw0Iqo0,8411
6
- sideload/main.py,sha256=aCI3DvjNeCyEVqmp12g4HdZOCuHhTwCPK1hIKrUMeBQ,7599
6
+ sideload/main.py,sha256=EiZguc4-ug8RM6vXkZuXW_ps8jFWoAfeKBBNy7FX-F0,7600
7
7
  sideload/scripts/cleanup_pypi.py,sha256=CouuOhnbpSbrFc1KhlOeZAuajVVpGF9d4qwFpIKkEvY,5906
8
- sideload-1.0.0.dist-info/WHEEL,sha256=-neZj6nU9KAMg2CnCY6T3w8J53nx1kFGw_9HfoSzM60,79
9
- sideload-1.0.0.dist-info/entry_points.txt,sha256=7ULrIjaVhrxMhuddTeoPjeIrqmIvVc9cSU3lZU2_YqE,44
10
- sideload-1.0.0.dist-info/METADATA,sha256=jBo_E7jtnSr0XUTEKmQTqdcE0tyvFtvqp0Rc1ZGEdUM,4281
11
- sideload-1.0.0.dist-info/RECORD,,
8
+ sideload-1.2.0.dist-info/WHEEL,sha256=-neZj6nU9KAMg2CnCY6T3w8J53nx1kFGw_9HfoSzM60,79
9
+ sideload-1.2.0.dist-info/entry_points.txt,sha256=7ULrIjaVhrxMhuddTeoPjeIrqmIvVc9cSU3lZU2_YqE,44
10
+ sideload-1.2.0.dist-info/METADATA,sha256=OVl1VRCVXj0m3JeHtdEQ0bjX6LyEVf8R4_tKTATPBIw,4281
11
+ sideload-1.2.0.dist-info/RECORD,,