slumber-python 5.2.0__tar.gz → 5.2.3__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 (67) hide show
  1. {slumber_python-5.2.0 → slumber_python-5.2.3}/Cargo.lock +12 -13
  2. {slumber_python-5.2.0 → slumber_python-5.2.3}/Cargo.toml +23 -11
  3. {slumber_python-5.2.0 → slumber_python-5.2.3}/PKG-INFO +1 -1
  4. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/template/src/lib.rs +16 -20
  5. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/util/Cargo.toml +5 -3
  6. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/util/src/lib.rs +74 -1
  7. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/util/src/test_util.rs +3 -3
  8. {slumber_python-5.2.0 → slumber_python-5.2.3}/README.md +0 -0
  9. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/config/Cargo.toml +0 -0
  10. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/config/src/cereal.rs +0 -0
  11. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/config/src/default.yml +0 -0
  12. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/config/src/default_old.yml +0 -0
  13. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/config/src/lib.rs +0 -0
  14. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/config/src/tui/cereal.rs +0 -0
  15. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/config/src/tui/input.rs +0 -0
  16. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/config/src/tui/mime.rs +0 -0
  17. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/config/src/tui/theme.rs +0 -0
  18. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/config/src/tui.rs +0 -0
  19. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/Cargo.toml +0 -0
  20. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/collection/cereal.rs +0 -0
  21. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/collection/models.rs +0 -0
  22. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/collection/recipe_tree.rs +0 -0
  23. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/collection/schema.rs +0 -0
  24. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/collection/value_template.rs +0 -0
  25. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/collection.rs +0 -0
  26. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/database/convert.rs +0 -0
  27. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/database/migrations.rs +0 -0
  28. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/database/tests.rs +0 -0
  29. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/database.rs +0 -0
  30. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/http/curl.rs +0 -0
  31. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/http/models.rs +0 -0
  32. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/http/tests.rs +0 -0
  33. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/http.rs +0 -0
  34. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/lib.rs +0 -0
  35. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/render/functions.rs +0 -0
  36. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/render/tests.rs +0 -0
  37. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/render/util.rs +0 -0
  38. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/render.rs +0 -0
  39. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/test_util.rs +0 -0
  40. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/util/json.rs +0 -0
  41. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/core/src/util.rs +0 -0
  42. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/macros/Cargo.toml +0 -0
  43. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/macros/src/lib.rs +0 -0
  44. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/python/Cargo.toml +0 -0
  45. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/python/README.md +0 -0
  46. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/python/dev.py +0 -0
  47. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/python/mise.toml +0 -0
  48. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/python/slumber.pyi +0 -0
  49. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/python/src/lib.rs +0 -0
  50. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/python/tests/slumber.yml +0 -0
  51. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/python/tests/test.py +0 -0
  52. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/python/uv.lock +0 -0
  53. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/template/Cargo.toml +0 -0
  54. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/template/proptest-regressions/parse.txt +0 -0
  55. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/template/src/cereal.rs +0 -0
  56. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/template/src/display.rs +0 -0
  57. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/template/src/error.rs +0 -0
  58. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/template/src/expression.rs +0 -0
  59. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/template/src/parse.rs +0 -0
  60. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/template/src/test_util.rs +0 -0
  61. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/template/src/tests.rs +0 -0
  62. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/template/src/value.rs +0 -0
  63. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/util/src/paths.rs +0 -0
  64. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/util/src/yaml/error.rs +0 -0
  65. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/util/src/yaml/resolve.rs +0 -0
  66. {slumber_python-5.2.0 → slumber_python-5.2.3}/crates/util/src/yaml.rs +0 -0
  67. {slumber_python-5.2.0 → slumber_python-5.2.3}/pyproject.toml +0 -0
@@ -809,7 +809,7 @@ dependencies = [
809
809
 
810
810
  [[package]]
811
811
  name = "doc_utils"
812
- version = "5.2.0"
812
+ version = "5.2.3"
813
813
  dependencies = [
814
814
  "anyhow",
815
815
  "clap",
@@ -3280,21 +3280,19 @@ checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589"
3280
3280
 
3281
3281
  [[package]]
3282
3282
  name = "slumber"
3283
- version = "5.2.0"
3283
+ version = "5.2.3"
3284
3284
  dependencies = [
3285
3285
  "anyhow",
3286
- "console-subscriber",
3287
3286
  "slumber_cli",
3288
3287
  "slumber_tui",
3289
3288
  "slumber_util",
3290
3289
  "tokio",
3291
3290
  "tracing",
3292
- "tracing-subscriber",
3293
3291
  ]
3294
3292
 
3295
3293
  [[package]]
3296
3294
  name = "slumber_cli"
3297
- version = "5.2.0"
3295
+ version = "5.2.3"
3298
3296
  dependencies = [
3299
3297
  "anyhow",
3300
3298
  "assert_cmd",
@@ -3329,7 +3327,7 @@ dependencies = [
3329
3327
 
3330
3328
  [[package]]
3331
3329
  name = "slumber_config"
3332
- version = "5.2.0"
3330
+ version = "5.2.3"
3333
3331
  dependencies = [
3334
3332
  "derive_more",
3335
3333
  "dirs",
@@ -3354,7 +3352,7 @@ dependencies = [
3354
3352
 
3355
3353
  [[package]]
3356
3354
  name = "slumber_core"
3357
- version = "5.2.0"
3355
+ version = "5.2.3"
3358
3356
  dependencies = [
3359
3357
  "async-trait",
3360
3358
  "base64 0.22.1",
@@ -3402,7 +3400,7 @@ dependencies = [
3402
3400
 
3403
3401
  [[package]]
3404
3402
  name = "slumber_import"
3405
- version = "5.2.0"
3403
+ version = "5.2.3"
3406
3404
  dependencies = [
3407
3405
  "anyhow",
3408
3406
  "base64 0.22.1",
@@ -3434,7 +3432,7 @@ dependencies = [
3434
3432
 
3435
3433
  [[package]]
3436
3434
  name = "slumber_macros"
3437
- version = "5.2.0"
3435
+ version = "5.2.3"
3438
3436
  dependencies = [
3439
3437
  "proc-macro2",
3440
3438
  "quote",
@@ -3443,7 +3441,7 @@ dependencies = [
3443
3441
 
3444
3442
  [[package]]
3445
3443
  name = "slumber_python"
3446
- version = "5.2.0"
3444
+ version = "5.2.3"
3447
3445
  dependencies = [
3448
3446
  "async-trait",
3449
3447
  "dialoguer",
@@ -3457,7 +3455,7 @@ dependencies = [
3457
3455
 
3458
3456
  [[package]]
3459
3457
  name = "slumber_template"
3460
- version = "5.2.0"
3458
+ version = "5.2.3"
3461
3459
  dependencies = [
3462
3460
  "bytes",
3463
3461
  "derive_more",
@@ -3484,7 +3482,7 @@ dependencies = [
3484
3482
 
3485
3483
  [[package]]
3486
3484
  name = "slumber_tui"
3487
- version = "5.2.0"
3485
+ version = "5.2.3"
3488
3486
  dependencies = [
3489
3487
  "anyhow",
3490
3488
  "async-trait",
@@ -3526,8 +3524,9 @@ dependencies = [
3526
3524
 
3527
3525
  [[package]]
3528
3526
  name = "slumber_util"
3529
- version = "5.2.0"
3527
+ version = "5.2.3"
3530
3528
  dependencies = [
3529
+ "console-subscriber",
3531
3530
  "derive_more",
3532
3531
  "dirs",
3533
3532
  "env-lock",
@@ -9,7 +9,7 @@ homepage = "https://slumber.lucaspickering.me"
9
9
  keywords = ["rest", "http", "terminal", "tui"]
10
10
  license = "MIT"
11
11
  repository = "https://github.com/LucasPickering/slumber"
12
- version = "5.2.0"
12
+ version = "5.2.3"
13
13
  # Keep in sync w/ rust-toolchain.toml
14
14
  rust-version = "1.90.0"
15
15
 
@@ -43,14 +43,14 @@ serde_json = {version = "1.0.120", default-features = false, features = ["preser
43
43
  serde_json_path = "0.7.1"
44
44
  serde_test = "1.0.176"
45
45
  serde_yaml = {version = "0.9.0", default-features = false}
46
- slumber_cli = {path = "./crates/cli", version = "5.2.0" }
47
- slumber_config = {path = "./crates/config", version = "5.2.0", default-features = false }
48
- slumber_core = {path = "./crates/core", version = "5.2.0" }
49
- slumber_import = {path = "./crates/import", version = "5.2.0" }
50
- slumber_macros = {path = "./crates/macros", version = "5.2.0" }
51
- slumber_template = {path = "./crates/template", version = "5.2.0" }
52
- slumber_tui = {path = "./crates/tui", version = "5.2.0" }
53
- slumber_util = {path = "./crates/util", version = "5.2.0" }
46
+ slumber_cli = {path = "./crates/cli", version = "5.2.3" }
47
+ slumber_config = {path = "./crates/config", version = "5.2.3", default-features = false }
48
+ slumber_core = {path = "./crates/core", version = "5.2.3" }
49
+ slumber_import = {path = "./crates/import", version = "5.2.3" }
50
+ slumber_macros = {path = "./crates/macros", version = "5.2.3" }
51
+ slumber_template = {path = "./crates/template", version = "5.2.3" }
52
+ slumber_tui = {path = "./crates/tui", version = "5.2.3" }
53
+ slumber_util = {path = "./crates/util", version = "5.2.3" }
54
54
  strum = {version = "0.27.0", default-features = false}
55
55
  syn = "2.0.101"
56
56
  terminput = "0.5.3"
@@ -58,7 +58,6 @@ thiserror = "2.0.12"
58
58
  tokio = {version = "1.39.2", default-features = false}
59
59
  tokio-util = "0.7.13"
60
60
  tracing = "0.1.40"
61
- tracing-subscriber = {version = "0.3.17", default-features = false, features = ["ansi", "fmt", "registry"]}
62
61
  url = "2.0.0"
63
62
  uuid = {version = "1.10.0", default-features = false}
64
63
  winnow = "0.7.0"
@@ -118,7 +117,20 @@ installers = ["shell", "powershell", "homebrew"]
118
117
  # A GitHub repo to push Homebrew formulas to
119
118
  tap = "LucasPickering/homebrew-tap"
120
119
  # Target platforms to build apps for (Rust target-triple syntax)
121
- targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
120
+ targets = [
121
+ "aarch64-apple-darwin",
122
+ "aarch64-unknown-linux-gnu",
123
+ "aarch64-unknown-linux-musl",
124
+ "aarch64-pc-windows-msvc",
125
+ "x86_64-apple-darwin",
126
+ "x86_64-unknown-linux-gnu",
127
+ "x86_64-unknown-linux-musl",
128
+ "x86_64-pc-windows-msvc",
129
+ "armv7-unknown-linux-gnueabi",
130
+ "armv7-unknown-linux-gnueabihf",
131
+ "armv7-unknown-linux-musleabi",
132
+ "armv7-unknown-linux-musleabihf",
133
+ ]
122
134
  # Publish jobs to run in CI
123
135
  publish-jobs = ["homebrew"]
124
136
  # Which actions to run on pull requests
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: slumber-python
3
- Version: 5.2.0
3
+ Version: 5.2.3
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -240,29 +240,25 @@ impl Template {
240
240
  Ctx: Context<V>,
241
241
  V: RenderValue,
242
242
  {
243
- {
244
- // Map over each parsed chunk, and render the expressions into
245
- // values. because raw text uses Arc and expressions
246
- // just contain metadata The raw text chunks will be
247
- // mapped 1:1. This clone is pretty cheap
248
- let futures = self.chunks.iter().map(|chunk| async move {
249
- match chunk {
250
- TemplateChunk::Raw(text) => {
251
- RenderedChunk::Raw(Arc::clone(text))
252
- }
253
- TemplateChunk::Expression(expression) => {
254
- match expression.render(context).await {
255
- Ok(value) => RenderedChunk::Dynamic(value),
256
- Err(error) => RenderedChunk::Error(error),
257
- }
243
+ // Map over each parsed chunk, and render the expressions into values.
244
+ // The raw text chunks will be mapped 1:1
245
+ let futures = self.chunks.iter().map(|chunk| async move {
246
+ match chunk {
247
+ TemplateChunk::Raw(text) => {
248
+ RenderedChunk::Raw(Arc::clone(text))
249
+ }
250
+ TemplateChunk::Expression(expression) => {
251
+ match expression.render(context).await {
252
+ Ok(value) => RenderedChunk::Dynamic(value),
253
+ Err(error) => RenderedChunk::Error(error),
258
254
  }
259
255
  }
260
- });
256
+ }
257
+ });
261
258
 
262
- // Concurrency!
263
- let chunks = future::join_all(futures).await;
264
- RenderedChunks(chunks)
265
- }
259
+ // Concurrency!
260
+ let chunks = future::join_all(futures).await;
261
+ RenderedChunks(chunks)
266
262
  }
267
263
  }
268
264
 
@@ -14,6 +14,7 @@ version = {workspace = true}
14
14
  tag = false
15
15
 
16
16
  [dependencies]
17
+ console-subscriber = {version = "0.5.0", default-features = false, optional = true}
17
18
  derive_more = {workspace = true, features = ["deref", "display", "from"]}
18
19
  dirs = {workspace = true}
19
20
  indexmap = {workspace = true}
@@ -25,7 +26,7 @@ serde = {workspace = true}
25
26
  serde_yaml = {workspace = true}
26
27
  thiserror = {workspace = true}
27
28
  tracing = {workspace = true}
28
- tracing-subscriber = {workspace = true, optional = true}
29
+ tracing-subscriber = {version = "0.3.17", default-features = false, features = ["ansi", "fmt", "registry"]}
29
30
  uuid = {workspace = true, features = ["v4"]}
30
31
  winnow = {workspace = true}
31
32
 
@@ -34,11 +35,12 @@ env-lock = {workspace = true}
34
35
  pretty_assertions = {workspace = true}
35
36
  rstest = {workspace = true}
36
37
  serde = {workspace = true, features = ["derive"]}
37
- tracing-subscriber = {workspace = true}
38
38
  uuid = {workspace = true, features = ["v4"]}
39
39
 
40
40
  [features]
41
- test = ["dep:rstest", "dep:tracing-subscriber"]
41
+ test = ["dep:rstest"]
42
+ # Enable tokio-console tracing
43
+ tokio_tracing = ["dep:console-subscriber"]
42
44
 
43
45
  [lints]
44
46
  workspace = true
@@ -22,11 +22,16 @@ use serde::{
22
22
  use std::{
23
23
  error::Error,
24
24
  fmt::{self, Debug, Display},
25
+ fs::{File, OpenOptions},
26
+ io,
25
27
  ops::Deref,
26
28
  str::FromStr,
27
29
  time::Duration,
28
30
  };
29
- use tracing::error;
31
+ use tracing::{error, level_filters::LevelFilter};
32
+ use tracing_subscriber::{
33
+ Layer, fmt::format::FmtSpan, layer::SubscriberExt, util::SubscriberInitExt,
34
+ };
30
35
  use winnow::{
31
36
  ModalResult, Parser,
32
37
  ascii::digit1,
@@ -294,6 +299,74 @@ impl Display for DurationUnit {
294
299
  }
295
300
  }
296
301
 
302
+ /// Set up tracing to a log file, and optionally stderr as well. If there's
303
+ /// an error creating the log file, we'll skip that part. This means in the TUI
304
+ /// the error (and all other tracing) will never be visible, but that's a
305
+ /// problem for another day.
306
+ pub fn initialize_tracing(level_filter: LevelFilter, has_stderr: bool) {
307
+ /// Create a new log file in a temporary directory. Each file gets a unique
308
+ /// name so this won't clobber any old files.
309
+ fn initialize_log_file() -> io::Result<File> {
310
+ let path = paths::log_file();
311
+ paths::create_parent(&path)?;
312
+ let log_file = OpenOptions::new()
313
+ .create(true)
314
+ .truncate(true)
315
+ .write(true)
316
+ .open(path)?;
317
+ Ok(log_file)
318
+ }
319
+
320
+ // Failing to log shouldn't be a fatal crash, so just move on
321
+ let log_file = initialize_log_file().traced().ok();
322
+
323
+ let file_subscriber = log_file.map(|log_file| {
324
+ // Include PID
325
+ // https://github.com/tokio-rs/tracing/pull/2655
326
+ tracing_subscriber::fmt::layer()
327
+ .with_file(true)
328
+ .with_line_number(true)
329
+ .with_writer(log_file)
330
+ .with_target(false)
331
+ .with_ansi(false)
332
+ .with_span_events(FmtSpan::NONE)
333
+ // File output can't be lower than warn. There's no good reason to
334
+ // disable file output. If someone passes off/error, they probably
335
+ // just want to set the stderr level.
336
+ .with_filter(level_filter.max(LevelFilter::WARN))
337
+ });
338
+
339
+ // Enable console output for CLI. By default logging is off, but it can be
340
+ // turned up with the verbose flag
341
+ let stderr_subscriber = tracing_subscriber::fmt::layer()
342
+ .with_writer(io::stderr)
343
+ .with_target(false)
344
+ .with_span_events(FmtSpan::NONE)
345
+ .without_time()
346
+ // Disable stderr for TUI mode
347
+ .with_filter(if has_stderr {
348
+ level_filter
349
+ } else {
350
+ LevelFilter::OFF
351
+ });
352
+
353
+ #[cfg(feature = "tokio_tracing")]
354
+ {
355
+ tracing_subscriber::registry()
356
+ .with(file_subscriber)
357
+ .with(stderr_subscriber)
358
+ .with(console_subscriber::spawn())
359
+ .init();
360
+ }
361
+ #[cfg(not(feature = "tokio_tracing"))]
362
+ {
363
+ tracing_subscriber::registry()
364
+ .with(file_subscriber)
365
+ .with(stderr_subscriber)
366
+ .init();
367
+ }
368
+ }
369
+
297
370
  /// Serialize a list of tuples as a mapping
298
371
  ///
299
372
  /// This is used in a few spots where data is stored internally as `Vec<(K, V)>`
@@ -164,16 +164,16 @@ pub fn assert_result<TA, TE, E>(
164
164
  ///
165
165
  /// Call this in a test to enable logging.
166
166
  #[deprecated(note = "Debugging only; remove when done")]
167
- pub fn initialize_tracing() {
167
+ pub fn initialize_test_tracing() {
168
168
  #[expect(deprecated)]
169
- initialize_tracing_with(LevelFilter::TRACE);
169
+ initialize_test_tracing_with(LevelFilter::TRACE);
170
170
  }
171
171
 
172
172
  /// Enable tracing output with a specific level filter
173
173
  ///
174
174
  /// Call this in a test to enable logging.
175
175
  #[deprecated(note = "Debugging only; remove when done")]
176
- pub fn initialize_tracing_with(level: LevelFilter) {
176
+ pub fn initialize_test_tracing_with(level: LevelFilter) {
177
177
  let subscriber = tracing_subscriber::fmt::layer()
178
178
  .with_writer(io::stderr)
179
179
  .with_target(true)
File without changes