ducpy 3.2.3__tar.gz → 3.3.0__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 (41) hide show
  1. {ducpy-3.2.3 → ducpy-3.3.0}/Cargo.lock +1 -1
  2. {ducpy-3.2.3 → ducpy-3.3.0}/PKG-INFO +1 -1
  3. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducpy/crate/Cargo.toml +1 -1
  4. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/build.rs +32 -10
  5. {ducpy-3.2.3 → ducpy-3.3.0}/pyproject.toml +3 -1
  6. ducpy-3.3.0/schema/duc.sql +847 -0
  7. ducpy-3.3.0/schema/migrations/3000000_to_3000001.sql +39 -0
  8. ducpy-3.3.0/schema/migrations/3000001_to_3000002.sql +39 -0
  9. ducpy-3.3.0/schema/migrations/3000002_to_3000003.sql +144 -0
  10. ducpy-3.3.0/schema/migrations/3000003_to_3000004.sql +20 -0
  11. ducpy-3.3.0/schema/search.sql +148 -0
  12. ducpy-3.3.0/schema/version_control.sql +144 -0
  13. {ducpy-3.2.3 → ducpy-3.3.0}/Cargo.toml +0 -0
  14. {ducpy-3.2.3 → ducpy-3.3.0}/LICENSE +0 -0
  15. {ducpy-3.2.3 → ducpy-3.3.0}/README.md +0 -0
  16. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducpy/crate/src/lib.rs +0 -0
  17. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/.gitignore +0 -0
  18. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/Cargo.toml +0 -0
  19. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/LICENSE +0 -0
  20. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/README.md +0 -0
  21. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/package.json +0 -0
  22. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/release.config.cjs +0 -0
  23. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/api/document.rs +0 -0
  24. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/api/meta.rs +0 -0
  25. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/api/mod.rs +0 -0
  26. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/api/version_control.rs +0 -0
  27. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/db/bootstrap.rs +0 -0
  28. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/db/mod.rs +0 -0
  29. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/db/native.rs +0 -0
  30. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/db/wasm.rs +0 -0
  31. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/lib.rs +0 -0
  32. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/parse.rs +0 -0
  33. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/serde_utils.rs +0 -0
  34. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/serialize.rs +0 -0
  35. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/src/types.rs +0 -0
  36. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/sst-env.d.ts +0 -0
  37. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/tests/.gitignore +0 -0
  38. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/tests/common/mod.rs +0 -0
  39. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/tests/parser_assets.rs +0 -0
  40. {ducpy-3.2.3 → ducpy-3.3.0}/packages/ducrs/tests/synthetic_roundtrip.rs +0 -0
  41. {ducpy-3.2.3 → ducpy-3.3.0}/src/ducpy_native/__init__.py +0 -0
@@ -412,7 +412,7 @@ dependencies = [
412
412
 
413
413
  [[package]]
414
414
  name = "ducpy-native"
415
- version = "3.2.3"
415
+ version = "3.3.0"
416
416
  dependencies = [
417
417
  "duc",
418
418
  "pyo3",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ducpy
3
- Version: 3.2.3
3
+ Version: 3.3.0
4
4
  Classifier: License :: OSI Approved :: MIT License
5
5
  Requires-Dist: nanoid>=2.0.0
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "ducpy-native"
3
- version = "3.2.3"
3
+ version = "3.3.0"
4
4
  edition = "2021"
5
5
  description = "Python native extension for the duc file format (used by ducpy)"
6
6
  publish = false
@@ -1,6 +1,6 @@
1
1
  use std::env;
2
2
  use std::fs;
3
- use std::path::PathBuf;
3
+ use std::path::{Path, PathBuf};
4
4
 
5
5
  /// Extract raw `PRAGMA user_version = <N>;` from `duc.sql`.
6
6
  fn schema_user_version_from_sql(sql: &str) -> u32 {
@@ -24,23 +24,45 @@ fn decode_user_version_to_semver(user_version: u32) -> String {
24
24
  format!("{major}.{minor}.{patch}")
25
25
  }
26
26
 
27
+ fn find_schema_dir(manifest_dir: &Path) -> Result<PathBuf, Box<dyn std::error::Error>> {
28
+ if let Ok(path) = env::var("DUC_SCHEMA_DIR") {
29
+ let candidate = PathBuf::from(path);
30
+ if candidate.join("duc.sql").is_file() {
31
+ return Ok(candidate);
32
+ }
33
+ }
34
+
35
+ for ancestor in manifest_dir.ancestors() {
36
+ for candidate in [
37
+ ancestor.join("schema"),
38
+ ancestor.join("packages").join("ducpy").join("schema"),
39
+ ] {
40
+ if candidate.join("duc.sql").is_file() {
41
+ return Ok(candidate);
42
+ }
43
+ }
44
+ }
45
+
46
+ Err(format!(
47
+ "Could not locate schema/duc.sql from {}. Set DUC_SCHEMA_DIR to a directory containing duc.sql.",
48
+ manifest_dir.display()
49
+ )
50
+ .into())
51
+ }
52
+
27
53
  fn main() -> Result<(), Box<dyn std::error::Error>> {
28
54
  let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?);
29
- let schema_dir = manifest_dir.join("..").join("..").join("schema");
55
+ let schema_dir = find_schema_dir(&manifest_dir)?;
30
56
  let out_dir = PathBuf::from(env::var("OUT_DIR")?);
57
+ println!("cargo:rerun-if-env-changed=DUC_SCHEMA_DIR");
31
58
 
32
59
  // Copy schema files into OUT_DIR so bootstrap.rs can include_str! them
33
60
  // even when the crate is built from an sdist in a temp directory.
34
61
  for name in ["duc.sql", "version_control.sql", "search.sql"] {
35
62
  let src = schema_dir.join(name);
36
63
  let dst = out_dir.join(name);
37
- match fs::read_to_string(&src) {
38
- Ok(contents) => fs::write(&dst, contents)?,
39
- Err(e) => {
40
- eprintln!("cargo:warning=Could not read {:?}: {e}. Writing empty stub.", src);
41
- fs::write(&dst, "")?;
42
- }
43
- }
64
+ let contents = fs::read_to_string(&src)?;
65
+ fs::write(&dst, contents)?;
44
66
  println!("cargo:rerun-if-changed={}", src.display());
45
67
  }
46
68
  // Scan schema/migrations/*.sql, parse (from, to) from filenames like
@@ -127,4 +149,4 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
127
149
  println!("cargo:rerun-if-changed=build.rs");
128
150
 
129
151
  Ok(())
130
- }
152
+ }
@@ -32,7 +32,9 @@ build-backend = "maturin"
32
32
  [tool.maturin]
33
33
  module-name = "ducpy_native"
34
34
  include = [
35
- { path = "LICENSE", format = "sdist" }
35
+ { path = "LICENSE", format = "sdist" },
36
+ { path = "schema/**/*", format = "sdist" },
37
+ { path = "schema/**/*", format = "wheel" }
36
38
  ]
37
39
  manifest-path = "packages/ducpy/crate/Cargo.toml"
38
40
  python-source = "src"