duckpack 0.2.1__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.
Files changed (34) hide show
  1. {duckpack-0.2.1 → duckpack-0.2.2}/Cargo.lock +1 -1
  2. {duckpack-0.2.1 → duckpack-0.2.2}/Cargo.toml +1 -1
  3. {duckpack-0.2.1 → duckpack-0.2.2}/PKG-INFO +1 -1
  4. {duckpack-0.2.1 → duckpack-0.2.2}/pyproject.toml +1 -1
  5. {duckpack-0.2.1 → duckpack-0.2.2}/src/engine.rs +45 -18
  6. {duckpack-0.2.1 → duckpack-0.2.2}/tests/test_python_api.py +1 -1
  7. {duckpack-0.2.1 → duckpack-0.2.2}/.cargo/config.toml +0 -0
  8. {duckpack-0.2.1 → duckpack-0.2.2}/.github/workflows/release.yml +0 -0
  9. {duckpack-0.2.1 → duckpack-0.2.2}/.gitignore +0 -0
  10. {duckpack-0.2.1 → duckpack-0.2.2}/LICENSE +0 -0
  11. {duckpack-0.2.1 → duckpack-0.2.2}/README.md +0 -0
  12. {duckpack-0.2.1 → duckpack-0.2.2}/duckpack_logo.png +0 -0
  13. {duckpack-0.2.1 → duckpack-0.2.2}/python/duckpack/__init__.py +0 -0
  14. {duckpack-0.2.1 → duckpack-0.2.2}/python/duckpack/__main__.py +0 -0
  15. {duckpack-0.2.1 → duckpack-0.2.2}/python/duckpack/_duckpack.pyi +0 -0
  16. {duckpack-0.2.1 → duckpack-0.2.2}/python/duckpack/cli.py +0 -0
  17. {duckpack-0.2.1 → duckpack-0.2.2}/python/duckpack/notebook.py +0 -0
  18. {duckpack-0.2.1 → duckpack-0.2.2}/python/duckpack/py.typed +0 -0
  19. {duckpack-0.2.1 → duckpack-0.2.2}/python/duckpack/runner.py +0 -0
  20. {duckpack-0.2.1 → duckpack-0.2.2}/python/duckpack/terminal.py +0 -0
  21. {duckpack-0.2.1 → duckpack-0.2.2}/scripts/scaffold_demo_project.sh +0 -0
  22. {duckpack-0.2.1 → duckpack-0.2.2}/src/catalog.rs +0 -0
  23. {duckpack-0.2.1 → duckpack-0.2.2}/src/diff.rs +0 -0
  24. {duckpack-0.2.1 → duckpack-0.2.2}/src/ide/editor.rs +0 -0
  25. {duckpack-0.2.1 → duckpack-0.2.2}/src/ide/explorer.rs +0 -0
  26. {duckpack-0.2.1 → duckpack-0.2.2}/src/ide/mod.rs +0 -0
  27. {duckpack-0.2.1 → duckpack-0.2.2}/src/ide/modals.rs +0 -0
  28. {duckpack-0.2.1 → duckpack-0.2.2}/src/lib.rs +0 -0
  29. {duckpack-0.2.1 → duckpack-0.2.2}/src/main.rs +0 -0
  30. {duckpack-0.2.1 → duckpack-0.2.2}/src/python.rs +0 -0
  31. {duckpack-0.2.1 → duckpack-0.2.2}/src/query.rs +0 -0
  32. {duckpack-0.2.1 → duckpack-0.2.2}/src/syntax.rs +0 -0
  33. {duckpack-0.2.1 → duckpack-0.2.2}/src/tui.rs +0 -0
  34. {duckpack-0.2.1 → duckpack-0.2.2}/tests/v2_compat_test.rs +0 -0
@@ -638,7 +638,7 @@ dependencies = [
638
638
 
639
639
  [[package]]
640
640
  name = "duckpack"
641
- version = "0.2.1"
641
+ version = "0.2.2"
642
642
  dependencies = [
643
643
  "anyhow",
644
644
  "arboard",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "duckpack"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  edition = "2024"
5
5
  readme = "README.md"
6
6
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: duckpack
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: 3
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "duckpack"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "Declarative schema management, interactive terminal IDE, and in-memory inspection for DuckDB"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Benjamen Terry", email = "benjamenjterry@gmail.com" }]
@@ -300,7 +300,7 @@ pub fn ensure_extension_loaded(conn: &Connection, ext_name: &str) -> Result<()>
300
300
  let info_filename = format!("{}.duckdb_extension.info", ext_name);
301
301
 
302
302
  let mut candidate_folders = Vec::new();
303
- if !hash_str.is_empty() {
303
+ if !hash_str.is_empty() && hash_str != "v2.0.0" {
304
304
  candidate_folders.push(base_ext_dir.join(hash_str).join(platform));
305
305
  }
306
306
  candidate_folders.push(base_ext_dir.join(&release_tag).join(platform));
@@ -311,8 +311,17 @@ pub fn ensure_extension_loaded(conn: &Connection, ext_name: &str) -> Result<()>
311
311
  for folder in &candidate_folders {
312
312
  let candidate_file = folder.join(&target_filename);
313
313
  if candidate_file.exists() {
314
- // If present in v2.0.0 or release folder, sync it to the dev hash directory as well
315
- if !hash_str.is_empty() {
314
+ // If a corrupted or 0-byte file exists from an interrupted download, purge it
315
+ if let Ok(meta) = candidate_file.metadata() {
316
+ if meta.len() < 512 {
317
+ let _ = fs::remove_file(&candidate_file);
318
+ let _ = fs::remove_file(folder.join(&info_filename));
319
+ continue;
320
+ }
321
+ }
322
+
323
+ // If present in v2.0.0 or release folder, sync it to the dev hash directory if distinct
324
+ if !hash_str.is_empty() && hash_str != "v2.0.0" {
316
325
  let dest_dir = base_ext_dir.join(hash_str).join(platform);
317
326
  if folder != &dest_dir {
318
327
  let _ = fs::create_dir_all(&dest_dir);
@@ -362,32 +371,45 @@ pub fn ensure_extension_loaded(conn: &Connection, ext_name: &str) -> Result<()>
362
371
  let install_res = conn
363
372
  .execute(&format!("FORCE INSTALL '{}';", cdn_url), [])
364
373
  .or_else(|_| conn.execute(&format!("INSTALL '{}';", cdn_url), []));
374
+
365
375
  if install_res.is_ok() {
366
- // Replicate the downloaded extension to the dev hash folder immediately before loading
376
+ // Verify if the extension file on disk was installed and is not 0 bytes
377
+ let mut valid_file_found = false;
367
378
  if let Ok(home) = std::env::var("HOME") {
368
379
  let base_ext_dir = PathBuf::from(&home).join(".duckdb").join("extensions");
369
380
  let target_filename = format!("{}.duckdb_extension", ext_name);
370
381
  let info_filename = format!("{}.duckdb_extension.info", ext_name);
371
382
 
372
- if !hash_str.is_empty() {
373
- let dest_dir = base_ext_dir.join(hash_str).join(platform);
374
- let _ = fs::create_dir_all(&dest_dir);
375
-
376
- for ver in &versions {
377
- let src_dir = base_ext_dir.join(ver).join(platform);
378
- let src_file = src_dir.join(&target_filename);
379
- if src_file.exists() {
380
- let _ = fs::copy(&src_file, dest_dir.join(&target_filename));
381
- let src_info = src_dir.join(&info_filename);
382
- if src_info.exists() {
383
- let _ = fs::copy(&src_info, dest_dir.join(&info_filename));
383
+ for ver in &versions {
384
+ let ext_file = base_ext_dir.join(ver).join(platform).join(&target_filename);
385
+ if ext_file.exists() {
386
+ if ext_file.metadata().map(|m| m.len()).unwrap_or(0) >= 512 {
387
+ valid_file_found = true;
388
+
389
+ // Only replicate if destination directory is distinct from source
390
+ if !hash_str.is_empty() && hash_str != "v2.0.0" && hash_str != ver.as_str() {
391
+ let dest_dir = base_ext_dir.join(hash_str).join(platform);
392
+ let _ = fs::create_dir_all(&dest_dir);
393
+ let _ = fs::copy(&ext_file, dest_dir.join(&target_filename));
394
+ let src_info = base_ext_dir.join(ver).join(platform).join(&info_filename);
395
+ if src_info.exists() {
396
+ let _ = fs::copy(&src_info, dest_dir.join(&info_filename));
397
+ }
384
398
  }
385
399
  break;
400
+ } else {
401
+ // File is corrupted or 0-byte (e.g. 404 response): delete it immediately
402
+ let _ = fs::remove_file(&ext_file);
403
+ let _ = fs::remove_file(base_ext_dir.join(ver).join(platform).join(&info_filename));
386
404
  }
387
405
  }
388
406
  }
389
407
  }
390
408
 
409
+ if !valid_file_found {
410
+ continue;
411
+ }
412
+
391
413
  // Load via standard name, then fallback to direct path
392
414
  let load_res = conn
393
415
  .execute(&format!("LOAD {};", ext_name), [])
@@ -397,13 +419,13 @@ pub fn ensure_extension_loaded(conn: &Connection, ext_name: &str) -> Result<()>
397
419
  let target_filename = format!("{}.duckdb_extension", ext_name);
398
420
 
399
421
  let mut paths = Vec::new();
400
- if !hash_str.is_empty() {
422
+ if !hash_str.is_empty() && hash_str != "v2.0.0" {
401
423
  paths.push(base_ext_dir.join(hash_str).join(platform).join(&target_filename));
402
424
  }
403
425
  paths.push(base_ext_dir.join("v2.0.0").join(platform).join(&target_filename));
404
426
 
405
427
  for p in &paths {
406
- if p.exists() {
428
+ if p.exists() && p.metadata().map(|m| m.len()).unwrap_or(0) >= 512 {
407
429
  let sql = format!("LOAD '{}';", p.to_string_lossy().replace('\'', "''"));
408
430
  if conn.execute(&sql, []).is_ok() {
409
431
  return Ok(0);
@@ -1671,6 +1693,11 @@ mod tests {
1671
1693
 
1672
1694
  #[test]
1673
1695
  fn test_load_quack_extension() {
1696
+ let test_home = std::env::current_dir().unwrap().join("target").join("test_home");
1697
+ let _ = std::fs::remove_dir_all(&test_home);
1698
+ std::fs::create_dir_all(&test_home).unwrap();
1699
+ unsafe { std::env::set_var("HOME", &test_home); }
1700
+
1674
1701
  let conn = open_duckdb_connection().unwrap();
1675
1702
  let res = load_quack_extension(&conn);
1676
1703
  if res.is_ok() {
@@ -4,7 +4,7 @@ import pytest
4
4
  import duckpack
5
5
 
6
6
  def test_duckpack_version_and_exports():
7
- assert duckpack.__version__ == "0.2.1"
7
+ assert duckpack.__version__ == "0.2.2"
8
8
  assert hasattr(duckpack, "explore")
9
9
  assert hasattr(duckpack, "apply")
10
10
  assert hasattr(duckpack, "diff")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes