Skip to content

Commit 94e52c0

Browse files
authored
VER: Release 0.38.0
2 parents d4fb19b + cc25cd8 commit 94e52c0

File tree

20 files changed

+1511
-823
lines changed

20 files changed

+1511
-823
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## 0.38.0 - TBD
4+
5+
### Breaking changes
6+
- Renamed `Compression::ZStd` to `Zstd` for consistency
7+
- Removed duplicated `flags` constants in `enums` module. Use the top-level `flags`
8+
constants instead
9+
- Renamed to `SCHEMA_COUNT` to `Schema::COUNT`
10+
11+
### Bug fixes
12+
- Relaxed requirement of `input_version` parameter to the Python `Transcoder` to only
13+
be required when transcoding to CSV without `Metadata`, where previously it was always
14+
required when transcoding data without `Metadata`
15+
- Added missing methods to Python for `StatUpdateAction` enum
16+
317
## 0.37.1 - 2025-07-15
418

519
### Bug fixes

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ resolver = "2"
1111
[workspace.package]
1212
authors = ["Databento <[email protected]>"]
1313
edition = "2021"
14-
version = "0.37.1"
14+
version = "0.38.0"
1515
documentation = "https://databento.com/docs"
1616
repository = "https://github.com/databento/dbn"
1717
license = "Apache-2.0"

c/src/text_serialization.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66

77
use dbn::{
88
encode::{csv, json, DbnEncodable, EncodeRecordRef},
9-
rtype, rtype_dispatch, RecordHeader, RecordRef, Schema,
9+
rtype_dispatch, RType, RecordHeader, RecordRef, Schema,
1010
};
1111

1212
use crate::cfile::CFileRef;
@@ -235,7 +235,7 @@ pub unsafe extern "C" fn schema_from_rtype(rtype: u8, res: *mut Schema) -> bool
235235
if res.is_null() {
236236
return false;
237237
}
238-
if let Some(schema) = rtype::try_into_schema(rtype) {
238+
if let Some(schema) = RType::try_into_schema(rtype) {
239239
*res = schema;
240240
true
241241
} else {

python/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "databento-dbn"
3-
version = "0.37.1"
3+
version = "0.38.0"
44
description = "Python bindings for encoding and decoding Databento Binary Encoding (DBN)"
55
authors = ["Databento <[email protected]>"]
66
license = "Apache-2.0"
@@ -17,7 +17,7 @@ build-backend = "maturin"
1717

1818
[project]
1919
name = "databento-dbn"
20-
version = "0.37.1"
20+
version = "0.38.0"
2121
authors = [
2222
{ name = "Databento", email = "[email protected]" }
2323
]

python/python/databento_dbn/_lib.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@ class Encoding(Enum):
455455
@classmethod
456456
def from_str(cls, value: str) -> Encoding: ...
457457
@classmethod
458+
def from_int(cls, value: int) -> Encoding: ...
459+
@classmethod
458460
def variants(cls) -> Iterable[Encoding]: ...
459461

460462
class Compression(Enum):
@@ -474,6 +476,8 @@ class Compression(Enum):
474476
@classmethod
475477
def from_str(cls, value: str) -> Compression: ...
476478
@classmethod
479+
def from_int(cls, value: int) -> Compression: ...
480+
@classmethod
477481
def variants(cls) -> Iterable[Compression]: ...
478482

479483
class SecurityUpdateAction(Enum):
@@ -909,8 +913,6 @@ class Metadata(SupportsBytes):
909913
version: int | None = None,
910914
) -> None: ...
911915
def __bytes__(self) -> bytes: ...
912-
def __eq__(self, other) -> bool: ...
913-
def __ne__(self, other) -> bool: ...
914916
@property
915917
def version(self) -> int:
916918
"""
@@ -1178,8 +1180,6 @@ class Record(SupportsBytes):
11781180
_timestamp_fields: ClassVar[list[str]]
11791181

11801182
def __bytes__(self) -> bytes: ...
1181-
def __eq__(self, other) -> bool: ...
1182-
def __ne__(self, other) -> bool: ...
11831183
@property
11841184
def hd(self) -> RecordHeader:
11851185
"""

python/src/transcoder.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -200,19 +200,15 @@ impl<const OUTPUT_ENC: u8> Inner<OUTPUT_ENC> {
200200
let mut output = DynWriter::new(BufWriter::new(file), compression)?;
201201
let map_symbols = map_symbols.unwrap_or(true);
202202
if !has_metadata {
203-
let Some(input_version) = input_version else {
204-
return Err(PyValueError::new_err(
205-
"must specify input_version when has_metadata=False",
206-
));
207-
};
208203
// if there's metadata, the header will be encoded when the metadata is processed
209204
Self::encode_header_if_csv(
210205
&mut output,
211206
pretty_px,
212207
pretty_ts,
213208
ts_out,
214209
map_symbols,
215-
upgrade_policy.output_version(input_version),
210+
upgrade_policy,
211+
input_version,
216212
schema,
217213
)?;
218214
}
@@ -324,10 +320,8 @@ impl<const OUTPUT_ENC: u8> Inner<OUTPUT_ENC> {
324320
self.use_pretty_ts,
325321
self.fsm.ts_out(),
326322
self.map_symbols,
327-
self.fsm
328-
.upgrade_policy()
329-
// Input version will be populated after decoding metadata
330-
.output_version(self.fsm.input_dbn_version().unwrap()),
323+
self.fsm.upgrade_policy(),
324+
self.fsm.input_dbn_version(),
331325
self.schema,
332326
)
333327
}
@@ -338,10 +332,17 @@ impl<const OUTPUT_ENC: u8> Inner<OUTPUT_ENC> {
338332
use_pretty_ts: bool,
339333
ts_out: bool,
340334
map_symbols: bool,
341-
output_version: u8,
335+
upgrade_policy: VersionUpgradePolicy,
336+
input_version: Option<u8>,
342337
schema: Option<Schema>,
343338
) -> PyResult<()> {
344339
if OUTPUT_ENC == Encoding::Csv as u8 {
340+
let Some(input_version) = input_version else {
341+
return Err(PyValueError::new_err(
342+
"must specify input_version when has_metadata=False",
343+
));
344+
};
345+
let output_version = upgrade_policy.output_version(input_version);
345346
let Some(schema) = schema else {
346347
return Err(PyValueError::new_err(
347348
"A schema must be specified when transcoding mixed schema DBN to CSV",

rust/dbn-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ name = "dbn"
1616
path = "src/main.rs"
1717

1818
[dependencies]
19-
dbn = { path = "../dbn", version = "=0.37.1", default-features = false }
19+
dbn = { path = "../dbn", version = "=0.38.0", default-features = false }
2020

2121
anyhow = { workspace = true }
2222
clap = { version = "4.5", features = ["derive", "wrap_help"] }

rust/dbn-cli/src/lib.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ impl Args {
222222
/// aren't already explicitly set.
223223
pub fn infer_encoding(args: &Args) -> anyhow::Result<(Encoding, Compression, u8)> {
224224
let compression = if args.zstd {
225-
Compression::ZStd
225+
Compression::Zstd
226226
} else {
227227
Compression::None
228228
};
@@ -234,19 +234,19 @@ pub fn infer_encoding(args: &Args) -> anyhow::Result<(Encoding, Compression, u8)
234234
OutputEncoding::Infer => {
235235
if let Some(output) = args.output.as_ref().map(|o| o.to_string_lossy()) {
236236
if output.ends_with(".dbn.zst") {
237-
Ok((Encoding::Dbn, Compression::ZStd, 0))
237+
Ok((Encoding::Dbn, Compression::Zstd, 0))
238238
} else if output.ends_with(".dbn") {
239239
Ok((Encoding::Dbn, Compression::None, 0))
240240
} else if output.ends_with(".csv.zst") {
241-
Ok((Encoding::Csv, Compression::ZStd, b','))
241+
Ok((Encoding::Csv, Compression::Zstd, b','))
242242
} else if output.ends_with(".csv") {
243243
Ok((Encoding::Csv, Compression::None, b','))
244244
} else if output.ends_with(".tsv.zst") || output.ends_with(".xls.zst") {
245-
Ok((Encoding::Csv, Compression::ZStd, b'\t'))
245+
Ok((Encoding::Csv, Compression::Zstd, b'\t'))
246246
} else if output.ends_with(".tsv") || output.ends_with(".xls") {
247247
Ok((Encoding::Csv, Compression::None, b'\t'))
248248
} else if output.ends_with(".json.zst") {
249-
Ok((Encoding::Json, Compression::ZStd, 0))
249+
Ok((Encoding::Json, Compression::Zstd, 0))
250250
} else if output.ends_with(".json") {
251251
Ok((Encoding::Json, Compression::None, 0))
252252
} else {
@@ -321,15 +321,15 @@ mod tests {
321321
b'\t'
322322
)]
323323
#[case(false, false, false, true, false, Encoding::Dbn, Compression::None, 0)]
324-
#[case(true, false, false, false, true, Encoding::Json, Compression::ZStd, 0)]
324+
#[case(true, false, false, false, true, Encoding::Json, Compression::Zstd, 0)]
325325
#[case(
326326
false,
327327
true,
328328
false,
329329
false,
330330
true,
331331
Encoding::Csv,
332-
Compression::ZStd,
332+
Compression::Zstd,
333333
b','
334334
)]
335335
#[case(
@@ -339,10 +339,10 @@ mod tests {
339339
false,
340340
true,
341341
Encoding::Csv,
342-
Compression::ZStd,
342+
Compression::Zstd,
343343
b'\t'
344344
)]
345-
#[case(false, false, false, true, true, Encoding::Dbn, Compression::ZStd, 0)]
345+
#[case(false, false, false, true, true, Encoding::Dbn, Compression::Zstd, 0)]
346346
fn test_infer_encoding_and_compression_explicit(
347347
#[case] json: bool,
348348
#[case] csv: bool,
@@ -370,11 +370,11 @@ mod tests {
370370
#[case("out.tsv", Encoding::Csv, Compression::None, b'\t')]
371371
#[case("out.xls", Encoding::Csv, Compression::None, b'\t')]
372372
#[case("out.dbn", Encoding::Dbn, Compression::None, 0)]
373-
#[case("out.json.zst", Encoding::Json, Compression::ZStd, 0)]
374-
#[case("out.csv.zst", Encoding::Csv, Compression::ZStd, b',')]
375-
#[case("out.tsv.zst", Encoding::Csv, Compression::ZStd, b'\t')]
376-
#[case("out.xls.zst", Encoding::Csv, Compression::ZStd, b'\t')]
377-
#[case("out.dbn.zst", Encoding::Dbn, Compression::ZStd, 0)]
373+
#[case("out.json.zst", Encoding::Json, Compression::Zstd, 0)]
374+
#[case("out.csv.zst", Encoding::Csv, Compression::Zstd, b',')]
375+
#[case("out.tsv.zst", Encoding::Csv, Compression::Zstd, b'\t')]
376+
#[case("out.xls.zst", Encoding::Csv, Compression::Zstd, b'\t')]
377+
#[case("out.dbn.zst", Encoding::Dbn, Compression::Zstd, 0)]
378378
fn test_infer_encoding_and_compression_inference(
379379
#[case] output: &str,
380380
#[case] exp_enc: Encoding,

rust/dbn/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ serde = ["dep:serde", "time/parsing", "time/serde"]
2525
trivial_copy = []
2626

2727
[dependencies]
28-
dbn-macros = { version = "=0.37.1", path = "../dbn-macros" }
28+
dbn-macros = { version = "=0.38.0", path = "../dbn-macros" }
2929

3030
async-compression = { version = "0.4.25", features = ["tokio", "zstd"], optional = true }
3131
csv = { workspace = true }

0 commit comments

Comments
 (0)