Skip to content

Commit

Permalink
VER: Release 0.23.0
Browse files Browse the repository at this point in the history
  • Loading branch information
threecgreen authored Oct 22, 2024
2 parents 832b63f + b7fa98a commit 20379b8
Show file tree
Hide file tree
Showing 22 changed files with 233 additions and 69 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
name: build - Python ${{ matrix.python-version }} (x86_64 ${{ matrix.os }})
runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
name: build - Python ${{ matrix.python-version }} (aarch64 linux)
runs-on: ubuntu-latest

Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
name: build - Python ${{ matrix.python-version }} (macOS)
runs-on: macos-latest

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: macos-latest
steps:
- name: Checkout repository
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: windows-latest
steps:
- name: Checkout repository
Expand Down Expand Up @@ -137,7 +137,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
target: [x86_64, aarch64]
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
target: [x86_64-unknown-linux-musl, aarch64-unknown-linux-musl]
runs-on: ubuntu-latest
steps:
Expand Down
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 0.23.0 - 2024-10-22

### Enhancements
- Added new `None` `Action` variant that will be gradually rolled out
to historical and live `GLBX.MDP3` data
- Added consistent escaping of non-printable and non-ASCII values when text encoding
`c_char` fields
- Implemented `Default` for `Action` and `Side`
- Added support for Python 3.13 to `databento_dbn`
- Implemented missing `Serialize` for (with `serde` feature enabled) for `Venue`,
`Dataset`, `Publisher`, `Compression`, `SType`, `Schema`, and `Encoding`

## 0.22.1 - 2024-10-08

### Enhancements
Expand All @@ -14,7 +26,7 @@
- Added Python type stubs for Record `__init__` methods

### Breaking changes
- Combine `_reserved3` and `_reserved4` fields in `CbboMsg`
- Combined `_reserved3` and `_reserved4` fields in `CbboMsg`
- Changed setters for `char` Record fields to accept a single-character strings
- Changed `rtype` and `length` to no longer be settable from Python. Users should
use the Record type `__init__` methods to initialize records
Expand Down
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ resolver = "2"
[workspace.package]
authors = ["Databento <[email protected]>"]
edition = "2021"
version = "0.22.1"
documentation = "https://docs.databento.com"
version = "0.23.0"
documentation = "https://databento.com/docs"
repository = "https://github.com/databento/dbn"
license = "Apache-2.0"

Expand Down
4 changes: 2 additions & 2 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "databento-dbn"
version = "0.22.1"
version = "0.23.0"
description = "Python bindings for encoding and decoding Databento Binary Encoding (DBN)"
authors = ["Databento <[email protected]>"]
license = "Apache-2.0"
Expand All @@ -17,7 +17,7 @@ build-backend = "maturin"

[project]
name = "databento-dbn"
version = "0.22.1"
version = "0.23.0"
authors = [
{ name = "Databento", email = "[email protected]" }
]
Expand Down
4 changes: 3 additions & 1 deletion python/python/databento_dbn/_lib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ class Action(Enum):
A new order was added.
CLEAR
Reset the book; clear all orders for an instrument.
NONE
Has no effect on the book, but may carry `flags` or other information.
"""

MODIFY: str
Expand All @@ -98,6 +99,7 @@ class Action(Enum):
CANCEL: str
ADD: str
CLEAR: str
NONE: str

@classmethod
def from_str(cls, value: str) -> Action: ...
Expand Down
2 changes: 1 addition & 1 deletion rust/dbn-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ name = "dbn"
path = "src/main.rs"

[dependencies]
dbn = { path = "../dbn", version = "=0.22.1", default-features = false }
dbn = { path = "../dbn", version = "=0.23.0", default-features = false }

anyhow = { workspace = true }
clap = { version = "4.5", features = ["derive", "wrap_help"] }
Expand Down
2 changes: 1 addition & 1 deletion rust/dbn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ serde = ["dep:serde", "time/parsing", "time/serde"]
trivial_copy = []

[dependencies]
dbn-macros = { version = "=0.22.1", path = "../dbn-macros" }
dbn-macros = { version = "=0.23.0", path = "../dbn-macros" }

async-compression = { version = "0.4.11", features = ["tokio", "zstd"], optional = true }
csv = { workspace = true }
Expand Down
13 changes: 9 additions & 4 deletions rust/dbn/src/decode/dbn/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,16 +656,18 @@ mod tests {
dbn::{AsyncEncoder, AsyncRecordEncoder},
DbnEncodable,
},
rtype, CbboMsg, Cmbp1Msg, Error, ErrorMsg, ImbalanceMsg, InstrumentDefMsg, MboMsg,
Mbp10Msg, Mbp1Msg, OhlcvMsg, RecordHeader, Result, Schema, StatMsg, StatusMsg, TbboMsg,
TradeMsg, WithTsOut,
rtype, Bbo1SMsg, CbboMsg, Cmbp1Msg, Error, ErrorMsg, ImbalanceMsg, InstrumentDefMsg,
MboMsg, Mbp10Msg, Mbp1Msg, OhlcvMsg, RecordHeader, Result, Schema, StatMsg, StatusMsg,
TbboMsg, TradeMsg, WithTsOut,
};

#[rstest]
#[case::mbo(Schema::Mbo, MboMsg::default())]
#[case::trades(Schema::Trades, TradeMsg::default())]
#[case::cmbp1(Schema::Cmbp1, Cmbp1Msg::default_for_schema(Schema::Cmbp1))]
#[case::cbbo(Schema::Cbbo1S, CbboMsg::default_for_schema(Schema::Cbbo1S))]
#[case::cbbo1s(Schema::Cbbo1S, CbboMsg::default_for_schema(Schema::Cbbo1S))]
#[case::bbo1s(Schema::Bbo1S, Bbo1SMsg::default_for_schema(Schema::Bbo1S))]
#[case::bbo1m(Schema::Bbo1M, Bbo1SMsg::default_for_schema(Schema::Bbo1M))]
#[case::tbbo(Schema::Tbbo, TbboMsg::default())]
#[case::mbp1(Schema::Mbp1, Mbp1Msg::default())]
#[case::mbp10(Schema::Mbp10, Mbp10Msg::default())]
Expand Down Expand Up @@ -711,6 +713,9 @@ mod tests {
#[case::mbo(Schema::Mbo, MboMsg::default())]
#[case::trades(Schema::Trades, TradeMsg::default())]
#[case::cmbp1(Schema::Cmbp1, Cmbp1Msg::default_for_schema(Schema::Cmbp1))]
#[case::cbbo1s(Schema::Cbbo1S, CbboMsg::default_for_schema(Schema::Cbbo1S))]
#[case::bbo1s(Schema::Bbo1S, Bbo1SMsg::default_for_schema(Schema::Bbo1S))]
#[case::bbo1m(Schema::Bbo1M, Bbo1SMsg::default_for_schema(Schema::Bbo1M))]
#[case::tbbo(Schema::Tbbo, TbboMsg::default())]
#[case::mbp1(Schema::Mbp1, Mbp1Msg::default())]
#[case::mbp10(Schema::Mbp10, Mbp10Msg::default())]
Expand Down
48 changes: 45 additions & 3 deletions rust/dbn/src/decode/dbn/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,9 +684,9 @@ mod tests {
encode::{
dbn::Encoder, DbnEncodable, DbnRecordEncoder, DynWriter, EncodeDbn, EncodeRecord,
},
rtype, Cmbp1Msg, Compression, Error, ErrorMsg, ImbalanceMsg, InstrumentDefMsg, MboMsg,
Mbp10Msg, Mbp1Msg, MetadataBuilder, OhlcvMsg, RecordHeader, Result, StatMsg, StatusMsg,
TbboMsg, TradeMsg, WithTsOut, SYMBOL_CSTR_LEN,
rtype, Bbo1MMsg, Bbo1SMsg, Cbbo1SMsg, Cmbp1Msg, Compression, Error, ErrorMsg, ImbalanceMsg,
InstrumentDefMsg, MboMsg, Mbp10Msg, Mbp1Msg, MetadataBuilder, OhlcvMsg, RecordHeader,
Result, StatMsg, StatusMsg, TbboMsg, TradeMsg, WithTsOut, SYMBOL_CSTR_LEN,
};

#[test]
Expand Down Expand Up @@ -820,6 +820,30 @@ mod tests {
#[case::zstd_statistics_v1(1, Schema::Statistics, Compression::ZStd, StatMsg::default())]
#[case::uncompressed_mbo_v2(2, Schema::Mbo, Compression::None, MboMsg::default())]
#[case::uncompressed_trades_v2(2, Schema::Trades, Compression::None, TradeMsg::default())]
#[case::uncompressed_cmbp1_v2(
2,
Schema::Cmbp1,
Compression::None,
Cmbp1Msg::default_for_schema(Schema::Cmbp1)
)]
#[case::uncompressed_cbbo1s_v2(
2,
Schema::Cbbo1S,
Compression::None,
Cbbo1SMsg::default_for_schema(Schema::Cbbo1S)
)]
#[case::uncompressed_bbo1s_v2(
2,
Schema::Bbo1S,
Compression::None,
Bbo1SMsg::default_for_schema(Schema::Bbo1S)
)]
#[case::uncompressed_bbo1m_v2(
2,
Schema::Bbo1M,
Compression::None,
Bbo1MMsg::default_for_schema(Schema::Bbo1M)
)]
#[case::uncompressed_tbbo_v2(2, Schema::Tbbo, Compression::None, TbboMsg::default())]
#[case::uncompressed_mbp1_v2(2, Schema::Mbp1, Compression::None, Mbp1Msg::default())]
#[case::uncompressed_mbp10_v2(2, Schema::Mbp10, Compression::None, Mbp10Msg::default())]
Expand Down Expand Up @@ -876,6 +900,24 @@ mod tests {
Compression::ZStd,
Cmbp1Msg::default_for_schema(Schema::Cmbp1)
)]
#[case::zstd_cbbo1s_v2(
2,
Schema::Cbbo1S,
Compression::ZStd,
Cbbo1SMsg::default_for_schema(Schema::Cbbo1S)
)]
#[case::zstd_bbo1s_v2(
2,
Schema::Bbo1S,
Compression::ZStd,
Bbo1SMsg::default_for_schema(Schema::Bbo1S)
)]
#[case::zstd_bbo1m_v2(
2,
Schema::Bbo1M,
Compression::ZStd,
Bbo1MMsg::default_for_schema(Schema::Bbo1M)
)]
#[case::zstd_mbp10_v2(2, Schema::Mbp10, Compression::ZStd, Mbp10Msg::default())]
#[case::zstd_ohlcv1d_v2(
2,
Expand Down
25 changes: 19 additions & 6 deletions rust/dbn/src/encode/csv/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,27 +210,40 @@ pub fn write_ts_field<W: io::Write, const PRETTY_TS: bool>(
}

pub fn write_c_char_field<W: io::Write>(csv_writer: &mut Writer<W>, c: c_char) -> csv::Result<()> {
// Handle NUL byte
// Handle NUL byte as empty
if c == 0 {
csv_writer.write_field([])
} else {
csv_writer.write_field([c as u8])
let mut buf = [0; 4];
let mut size = 0;
for byte in std::ascii::escape_default(c as u8) {
buf[size] = byte;
size += 1;
}
csv_writer.write_field(&buf[..size])
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_write_char_nul() {
use rstest::*;

#[rstest]
#[case::nul(0, "")]
#[case::max(0xFF, "\\xff")]
#[case::reg(b'C', "C")]
#[case::tab(b'\t', "\\t")]
#[case::newline(b'\n', "\\n")]
fn test_write_c_char_field(#[case] c: u8, #[case] exp: &str) {
let mut buffer = Vec::new();
let mut writer = csv::WriterBuilder::new().from_writer(&mut buffer);
write_c_char_field(&mut writer, 0).unwrap();
write_c_char_field(&mut writer, c as c_char).unwrap();
writer.write_field("a").unwrap();
writer.flush().unwrap();
drop(writer);
let s = std::str::from_utf8(buffer.as_slice()).unwrap();
assert_eq!(s, ",a");
assert_eq!(s, format!("{exp},a"));
}
}
Loading

0 comments on commit 20379b8

Please sign in to comment.