beancount-format 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.
Files changed (44) hide show
  1. {beancount_format-0.1.15 → beancount_format-0.1.17}/Cargo.lock +32 -35
  2. {beancount_format-0.1.15 → beancount_format-0.1.17}/Cargo.toml +3 -2
  3. {beancount_format-0.1.15 → beancount_format-0.1.17}/PKG-INFO +10 -2
  4. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/Cargo.toml +0 -1
  5. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/src/format.rs +1 -4
  6. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format_cases.rs +3 -3
  7. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter-cli/Cargo.toml +1 -1
  8. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter-py/Cargo.toml +1 -1
  9. {beancount_format-0.1.15 → beancount_format-0.1.17}/pyproject.toml +1 -1
  10. {beancount_format-0.1.15 → beancount_format-0.1.17}/python/README.md +9 -1
  11. {beancount_format-0.1.15 → beancount_format-0.1.17}/LICENSE +0 -0
  12. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/src/configuration/configuration.rs +0 -0
  13. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/src/configuration/mod.rs +0 -0
  14. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/src/configuration/new_line_kind.rs +0 -0
  15. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/src/lib.rs +0 -0
  16. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/src/parse.rs +0 -0
  17. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/applies_configured_crlf_newlines.config.json +0 -0
  18. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/applies_configured_crlf_newlines.expected.bean +0 -0
  19. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/applies_configured_crlf_newlines.input.bean +0 -0
  20. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/caps_blank_lines_between_directives.expected.bean +0 -0
  21. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/caps_blank_lines_between_directives.input.bean +0 -0
  22. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/formats_all_directives.config.json +0 -0
  23. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/formats_all_directives.expected.bean +0 -0
  24. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/formats_all_directives.input.bean +0 -0
  25. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/formats_transaction_preserves_postings.expected.bean +0 -0
  26. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/formats_transaction_preserves_postings.input.bean +0 -0
  27. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/formats_without_changes_returns_none.expected.bean +0 -0
  28. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/formats_without_changes_returns_none.input.bean +0 -0
  29. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/normalizes_tabs_and_trailing_spaces.expected.bean +0 -0
  30. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/normalizes_tabs_and_trailing_spaces.input.bean +0 -0
  31. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/preserve-meta.expected.bean +0 -0
  32. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/preserve-meta.input.bean +0 -0
  33. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/preserve_comments.expected.bean +0 -0
  34. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/preserve_comments.input.bean +0 -0
  35. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/preserve_file_path_header.expected.bean +0 -0
  36. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/preserve_file_path_header.input.bean +0 -0
  37. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/support_input_without_eol.expected.bean +0 -0
  38. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter/tests/format-and-check/support_input_without_eol.input.bean +0 -0
  39. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter-cli/src/lib.rs +0 -0
  40. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter-cli/src/main.rs +0 -0
  41. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter-cli/tests/cli_e2e.rs +0 -0
  42. {beancount_format-0.1.15 → beancount_format-0.1.17}/crates/beancount-formatter-py/src/lib.rs +0 -0
  43. {beancount_format-0.1.15 → beancount_format-0.1.17}/python/src/beancount_format/__init__.py +0 -0
  44. {beancount_format-0.1.15 → beancount_format-0.1.17}/python/src/beancount_format/beancount_format.pyi +0 -0
@@ -128,11 +128,10 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
128
128
 
129
129
  [[package]]
130
130
  name = "beancount-formatter"
131
- version = "0.1.15"
131
+ version = "0.1.17"
132
132
  dependencies = [
133
133
  "anyhow",
134
134
  "beancount-parser",
135
- "ropey",
136
135
  "serde",
137
136
  "serde_json",
138
137
  "similar",
@@ -141,7 +140,7 @@ dependencies = [
141
140
 
142
141
  [[package]]
143
142
  name = "beancount-formatter-cli"
144
- version = "0.1.15"
143
+ version = "0.1.17"
145
144
  dependencies = [
146
145
  "anyhow",
147
146
  "assert_cmd",
@@ -155,7 +154,7 @@ dependencies = [
155
154
 
156
155
  [[package]]
157
156
  name = "beancount-formatter-py"
158
- version = "0.1.15"
157
+ version = "0.1.17"
159
158
  dependencies = [
160
159
  "beancount-formatter",
161
160
  "beancount-formatter-cli",
@@ -279,9 +278,9 @@ checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
279
278
 
280
279
  [[package]]
281
280
  name = "cc"
282
- version = "1.2.54"
281
+ version = "1.2.55"
283
282
  source = "registry+https://github.com/rust-lang/crates.io-index"
284
- checksum = "6354c81bbfd62d9cfa9cb3c773c2b7b2a3a482d569de977fd0e961f6e7c00583"
283
+ checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29"
285
284
  dependencies = [
286
285
  "find-msvc-tools",
287
286
  "shlex",
@@ -310,9 +309,9 @@ dependencies = [
310
309
 
311
310
  [[package]]
312
311
  name = "clap"
313
- version = "4.5.54"
312
+ version = "4.5.56"
314
313
  source = "registry+https://github.com/rust-lang/crates.io-index"
315
- checksum = "c6e6ff9dcd79cff5cd969a17a545d79e84ab086e444102a591e288a8aa3ce394"
314
+ checksum = "a75ca66430e33a14957acc24c5077b503e7d374151b2b4b3a10c83b4ceb4be0e"
316
315
  dependencies = [
317
316
  "clap_builder",
318
317
  "clap_derive",
@@ -320,9 +319,9 @@ dependencies = [
320
319
 
321
320
  [[package]]
322
321
  name = "clap_builder"
323
- version = "4.5.54"
322
+ version = "4.5.56"
324
323
  source = "registry+https://github.com/rust-lang/crates.io-index"
325
- checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00"
324
+ checksum = "793207c7fa6300a0608d1080b858e5fdbe713cdc1c8db9fb17777d8a13e63df0"
326
325
  dependencies = [
327
326
  "anstream",
328
327
  "anstyle",
@@ -332,9 +331,9 @@ dependencies = [
332
331
 
333
332
  [[package]]
334
333
  name = "clap_derive"
335
- version = "4.5.49"
334
+ version = "4.5.55"
336
335
  source = "registry+https://github.com/rust-lang/crates.io-index"
337
- checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671"
336
+ checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5"
338
337
  dependencies = [
339
338
  "heck",
340
339
  "proc-macro2",
@@ -385,17 +384,6 @@ version = "0.4.0"
385
384
  source = "registry+https://github.com/rust-lang/crates.io-index"
386
385
  checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8"
387
386
 
388
- [[package]]
389
- name = "dlmalloc"
390
- version = "0.2.12"
391
- source = "registry+https://github.com/rust-lang/crates.io-index"
392
- checksum = "6738d2e996274e499bc7b0d693c858b7720b9cd2543a0643a3087e6cb0a4fa16"
393
- dependencies = [
394
- "cfg-if",
395
- "libc",
396
- "windows-sys",
397
- ]
398
-
399
387
  [[package]]
400
388
  name = "doc-comment"
401
389
  version = "0.3.4"
@@ -420,11 +408,10 @@ dependencies = [
420
408
 
421
409
  [[package]]
422
410
  name = "dprint-plugin-beancount"
423
- version = "0.1.15"
411
+ version = "0.1.17"
424
412
  dependencies = [
425
413
  "anyhow",
426
414
  "beancount-formatter",
427
- "dlmalloc",
428
415
  "dprint-core",
429
416
  "serde_json",
430
417
  ]
@@ -453,9 +440,9 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
453
440
 
454
441
  [[package]]
455
442
  name = "find-msvc-tools"
456
- version = "0.1.8"
443
+ version = "0.1.9"
457
444
  source = "registry+https://github.com/rust-lang/crates.io-index"
458
- checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db"
445
+ checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
459
446
 
460
447
  [[package]]
461
448
  name = "float-cmp"
@@ -788,6 +775,7 @@ version = "0.27.2"
788
775
  source = "registry+https://github.com/rust-lang/crates.io-index"
789
776
  checksum = "b455933107de8642b4487ed26d912c2d899dec6114884214a0b3bb3be9261ea6"
790
777
  dependencies = [
778
+ "python3-dll-a",
791
779
  "target-lexicon",
792
780
  ]
793
781
 
@@ -826,6 +814,15 @@ dependencies = [
826
814
  "syn 2.0.114",
827
815
  ]
828
816
 
817
+ [[package]]
818
+ name = "python3-dll-a"
819
+ version = "0.2.14"
820
+ source = "registry+https://github.com/rust-lang/crates.io-index"
821
+ checksum = "d381ef313ae70b4da5f95f8a4de773c6aa5cd28f73adec4b4a31df70b66780d8"
822
+ dependencies = [
823
+ "cc",
824
+ ]
825
+
829
826
  [[package]]
830
827
  name = "quote"
831
828
  version = "1.0.44"
@@ -1278,9 +1275,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
1278
1275
 
1279
1276
  [[package]]
1280
1277
  name = "uuid"
1281
- version = "1.19.0"
1278
+ version = "1.20.0"
1282
1279
  source = "registry+https://github.com/rust-lang/crates.io-index"
1283
- checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a"
1280
+ checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f"
1284
1281
  dependencies = [
1285
1282
  "js-sys",
1286
1283
  "wasm-bindgen",
@@ -1421,18 +1418,18 @@ dependencies = [
1421
1418
 
1422
1419
  [[package]]
1423
1420
  name = "zerocopy"
1424
- version = "0.8.33"
1421
+ version = "0.8.37"
1425
1422
  source = "registry+https://github.com/rust-lang/crates.io-index"
1426
- checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd"
1423
+ checksum = "7456cf00f0685ad319c5b1693f291a650eaf345e941d082fc4e03df8a03996ac"
1427
1424
  dependencies = [
1428
1425
  "zerocopy-derive",
1429
1426
  ]
1430
1427
 
1431
1428
  [[package]]
1432
1429
  name = "zerocopy-derive"
1433
- version = "0.8.33"
1430
+ version = "0.8.37"
1434
1431
  source = "registry+https://github.com/rust-lang/crates.io-index"
1435
- checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1"
1432
+ checksum = "1328722bbf2115db7e19d69ebcc15e795719e2d66b60827c6a69a117365e37a0"
1436
1433
  dependencies = [
1437
1434
  "proc-macro2",
1438
1435
  "quote",
@@ -1441,6 +1438,6 @@ dependencies = [
1441
1438
 
1442
1439
  [[package]]
1443
1440
  name = "zmij"
1444
- version = "1.0.16"
1441
+ version = "1.0.17"
1445
1442
  source = "registry+https://github.com/rust-lang/crates.io-index"
1446
- checksum = "dfcd145825aace48cff44a8844de64bf75feec3080e0aa5cdbde72961ae51a65"
1443
+ checksum = "02aae0f83f69aafc94776e879363e9771d7ecbffe2c7fbb6c14c5e00dfe88439"
@@ -3,7 +3,7 @@ members = ["crates/*"]
3
3
  resolver = "3"
4
4
 
5
5
  [workspace.package]
6
- version = "0.1.15"
6
+ version = "0.1.17"
7
7
  authors = ["Trim21 <trim21.me@gmail.com>"]
8
8
  edition = "2024"
9
9
  homepage = "https://github.com/trim21/beancount-format"
@@ -17,7 +17,8 @@ beancount-formatter = { path = "./crates/beancount-formatter/" }
17
17
  serde = { version = "1.0.228", features = ["derive"] }
18
18
 
19
19
  [patch.crates-io]
20
- tree-sitter-language = { path = "./patches/tree-sitter-language-0.1.6/" }
20
+ tree-sitter-language = { path = "./patches/tree-sitter-language/" }
21
+ # tree-sitter-language = { git = 'https://github.com/tree-sitter/tree-sitter.git', rev = '88a54754966cc8156d557b531a7b8a808a1768a5' }
21
22
 
22
23
  [profile.release]
23
24
  opt-level = 3
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beancount-format
3
- Version: 0.1.15
3
+ Version: 0.1.17
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python
6
6
  Classifier: Programming Language :: Python :: 3
@@ -15,7 +15,7 @@ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
15
15
 
16
16
  # beancount-format
17
17
 
18
- Python package wrapping the Rust `dprint-plugin-beancount` formatter.
18
+ beancount formatter.
19
19
 
20
20
  ## Install
21
21
 
@@ -25,6 +25,14 @@ pip install beancount-format
25
25
 
26
26
  ## Usage
27
27
 
28
+ ### as CLI
29
+
30
+ ```bash
31
+ beancount-format ./
32
+ ```
33
+
34
+ ### as library
35
+
28
36
  ```python
29
37
  from bean_format import format_text
30
38
 
@@ -11,7 +11,6 @@ description = "Core beancount formatter logic."
11
11
  [dependencies]
12
12
  anyhow = { workspace = true }
13
13
  beancount-parser = { git = "https://github.com/trim21/beancount.git", rev = "8b4e3311258194fe3127862dd4132028e97cc01d" }
14
- ropey = '1.6.1'
15
14
  serde = { workspace = true }
16
15
  # beancount-parser = { path = "../../../beancount/beancount/" }
17
16
  # beancount-parser = { path = "../../../beancount/beancount/crates/beancount-parser/" }
@@ -445,10 +445,7 @@ fn format_content(path: Option<&str>, content: &str, formatting_config: &Configu
445
445
  let path = path.unwrap_or("<memory>");
446
446
 
447
447
  if content.trim().is_empty() {
448
- return Ok(match formatting_config.new_line {
449
- NewLineKind::LF => "\n".to_string(),
450
- NewLineKind::CRLF => "\r\n".to_string(),
451
- });
448
+ return Ok(String::new());
452
449
  }
453
450
 
454
451
  // The parser expects a trailing newline; append one if it's missing.
@@ -156,12 +156,12 @@ fn format_empty_file_is_single_line() {
156
156
  ..Default::default()
157
157
  };
158
158
  let formatted_lf = format(Some("empty.bean"), "\n\n\t ", &config).expect("format failed");
159
- assert_eq!(formatted_lf, "\n");
159
+ assert_eq!(formatted_lf, "");
160
160
 
161
161
  let config = Configuration {
162
- new_line: NewLineKind::CRLF,
162
+ new_line: NewLineKind::LF,
163
163
  ..Default::default()
164
164
  };
165
165
  let formatted_crlf = format(Some("empty.bean"), " \r\n\r\n", &config).expect("format failed");
166
- assert_eq!(formatted_crlf, "\r\n");
166
+ assert_eq!(formatted_crlf, "");
167
167
  }
@@ -12,7 +12,7 @@ description = "CLI for the beancount formatter."
12
12
  [dependencies]
13
13
  anyhow = { workspace = true }
14
14
  beancount-formatter = { workspace = true }
15
- clap = { version = "4.5.54", features = ["derive"] }
15
+ clap = { version = "4.5.55", features = ["derive"] }
16
16
  serde = { workspace = true }
17
17
  toml = "0.9.11"
18
18
 
@@ -15,4 +15,4 @@ crate-type = ["cdylib"]
15
15
  [dependencies]
16
16
  beancount-formatter = { workspace = true }
17
17
  beancount-formatter-cli = { path = "../beancount-formatter-cli/" }
18
- pyo3 = { version = "0.27.2", features = ["abi3", "abi3-py310", "extension-module"] }
18
+ pyo3 = { version = "0.27.2", features = ["abi3", "abi3-py310", "generate-import-lib"] }
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "beancount-format"
7
- version = "0.1.15"
7
+ version = "0.1.17"
8
8
  description = "Beancount formatter powered by dprint-plugin-beancount"
9
9
  authors = [{ name = "trim21", email = "trim21.me@gmail.com" }]
10
10
  license = { file = "LICENSE" }
@@ -1,6 +1,6 @@
1
1
  # beancount-format
2
2
 
3
- Python package wrapping the Rust `dprint-plugin-beancount` formatter.
3
+ beancount formatter.
4
4
 
5
5
  ## Install
6
6
 
@@ -10,6 +10,14 @@ pip install beancount-format
10
10
 
11
11
  ## Usage
12
12
 
13
+ ### as CLI
14
+
15
+ ```bash
16
+ beancount-format ./
17
+ ```
18
+
19
+ ### as library
20
+
13
21
  ```python
14
22
  from bean_format import format_text
15
23