Skip to content

Commit b483ba3

Browse files
authored
VER: Release 0.33.0
2 parents 1d39f44 + 27cf17e commit b483ba3

File tree

30 files changed

+483
-104
lines changed

30 files changed

+483
-104
lines changed

CHANGELOG.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Changelog
22

3+
## 0.33.0 - 2025-04-22
4+
5+
### Enhancements
6+
- Added `SystemCode` and `ErrorCode` enums to indicate types of system and error
7+
messages
8+
- Added `code()` methods to `SystemMsg` and `ErrorMsg` to retrieve the enum value if
9+
one exists and equivalent properties in Python
10+
- Converting a `v1::SystemMsg` to a `v2::SystemMsg` now sets to `code` to the heartbeat
11+
value
12+
- Added `ASSET_CSTR_LEN` constants for the size of `asset` field in `InstrumentDefMsg`
13+
in different DBN versions
14+
- Added `encode_record_with_sym()` method to `AsyncJsonEncoder` which encodes a record
15+
along with its text symbol to match the sync encoder
16+
17+
### Breaking changes
18+
- Added `code` parameter to `SystemCode::new()` and `ErrorMsg::new()`
19+
- Updated the `rtype_dispatch` and `schema_dispatch` macro invocations to look more like
20+
function invocation
21+
- Increased the size of `asset` field in `v3::InstrumentDefMsg` from 7 to 11. The
22+
`InstrumentDefMsgV3` message size remains 520 bytes.
23+
324
## 0.32.0 - 2025-04-14
425

526
### Enhancements
@@ -8,10 +29,6 @@
829
- Refactored the `schema_dispatch` macro to be more flexible: it supports `ts_out`
930
dispatching and async functions and methods
1031

11-
### Breaking changes
12-
- Updated the `rtype_dispatch` and `schema_dispatch` macro invocations to look more like
13-
function invocation
14-
1532
### Deprecations
1633
- Deprecated macros `rtype_async_dispatch`, `rtype_ts_out_dispatch`,
1734
`rtype_dispatch_with_ts_out`, `rtype_ts_out_async_dispatch`,

Cargo.lock

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

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ resolver = "2"
1111
[workspace.package]
1212
authors = ["Databento <[email protected]>"]
1313
edition = "2021"
14-
version = "0.32.0"
14+
version = "0.33.0"
1515
documentation = "https://databento.com/docs"
1616
repository = "https://github.com/databento/dbn"
1717
license = "Apache-2.0"
1818

1919
[workspace.dependencies]
20-
anyhow = "1.0.97"
20+
anyhow = "1.0.98"
2121
csv = "1.3"
22-
pyo3 = "0.24.1"
23-
pyo3-build-config = "0.24.1"
22+
pyo3 = "0.24.2"
23+
pyo3-build-config = "0.24.2"
2424
rstest = "0.25.0"
2525
serde = { version = "1.0", features = ["derive"] }
2626
time = "0.3.41"

c/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ crate-type = ["staticlib"]
1616
[dependencies]
1717
anyhow = { workspace = true }
1818
dbn = { path = "../rust/dbn", features = [] }
19-
libc = "0.2.171"
19+
libc = "0.2.172"
2020

2121
[build-dependencies]
2222
cbindgen = { version = "0.28.0", default-features = false }

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.32.0"
3+
version = "0.33.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.32.0"
20+
version = "0.33.0"
2121
authors = [
2222
{ name = "Databento", email = "[email protected]" }
2323
]

python/python/databento_dbn/_lib.pyi

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,60 @@ class VersionUpgradePolicy(Enum):
822822
AS_IS: int
823823
UPGRADE_TO_V2: int
824824

825+
class ErrorCode(Enum):
826+
"""
827+
An error code from the live subscription gateway.
828+
829+
AUTH_FAILED
830+
The authentication step failed.
831+
API_KEY_DEACTIVATED
832+
The user account or API key were deactivated.
833+
CONNECTION_LIMIT_EXCEEDED
834+
The user has exceeded their open connection limit
835+
SYMBOL_RESOLUTION_FAILED
836+
One or more symbols failed to resolve.
837+
INVALID_SUBSCRIPTION
838+
There was an issue with a subscription request (other than symbol resolution).
839+
INTERNAL_ERROR
840+
An error occurred in the gateway.
841+
842+
"""
843+
844+
AUTH_FAILED: int
845+
API_KEY_DEACTIVATED: int
846+
CONNECTION_LIMIT_EXCEEDED: int
847+
SYMBOL_RESOLUTION_FAILED: int
848+
INVALID_SUBSCRIPTION: int
849+
INTERNAL_ERROR: int
850+
851+
@classmethod
852+
def variants(cls) -> Iterable[ErrorCode]: ...
853+
854+
class SystemCode(Enum):
855+
"""
856+
A `SystemMsg` code indicating the type of message from the live subscription
857+
gateway.
858+
859+
HEARTBEAT
860+
A message sent in the absence of other records to indicate the connection
861+
remains open.
862+
SUBSCRIPTION_ACK
863+
An acknowledgement of a subscription request.
864+
SLOW_READER_WARNING
865+
The gateway has detected this session is falling behind real-time.
866+
REPLAY_COMPLETED
867+
Indicates a replay subscription has caught up with real-time data.
868+
869+
"""
870+
871+
HEARTBEAT: int
872+
SUBSCRIPTION_ACK: int
873+
SLOW_READER_WARNING: int
874+
REPLAY_COMPLETED: int
875+
876+
@classmethod
877+
def variants(cls) -> Iterable[ErrorCode]: ...
878+
825879
class Metadata(SupportsBytes):
826880
"""
827881
Information about the data contained in a DBN file or stream. DBN requires
@@ -5937,6 +5991,19 @@ class ErrorMsg(ErrorMsgV1):
59375991
An error message from the Databento Live Subscription Gateway (LSG).
59385992
"""
59395993

5994+
def __init__(
5995+
self, ts_event: int, err: str, is_last: bool = True, code: ErrorCode | None = None
5996+
) -> None: ...
5997+
@property
5998+
def code(self) -> ErrorCode | None:
5999+
"""
6000+
The error code, if any.
6001+
6002+
Returns
6003+
-------
6004+
ErrorCode | None
6005+
"""
6006+
59406007
@property
59416008
def is_last(self) -> int:
59426009
"""
@@ -6087,14 +6154,15 @@ class SystemMsg(SystemMsgV1):
60876154
60886155
"""
60896156

6157+
def __init__(self, ts_event: int, msg: str, code: SystemCode | None = None) -> None: ...
60906158
@property
6091-
def code(self) -> int:
6159+
def code(self) -> SystemCode | None:
60926160
"""
6093-
Type of system message, currently unused.
6161+
Type of system message, if any.
60946162
60956163
Returns
60966164
-------
6097-
int
6165+
SystemCode | None
60986166
"""
60996167

61006168
class SystemMsgV1(Record):

python/src/dbn_decoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ mod tests {
164164
let metadata_pos = encoder.get_ref().len();
165165
assert!(matches!(target.decode(), Ok(recs) if recs.len() == 1));
166166
assert!(target.has_decoded_metadata);
167-
let rec = ErrorMsg::new(1680708278000000000, "Python", true);
167+
let rec = ErrorMsg::new(1680708278000000000, None, "Python", true);
168168
encoder.encode_record(&rec).unwrap();
169169
assert!(target.buffer.get_ref().is_empty());
170170
let record_pos = encoder.get_ref().len();
@@ -204,7 +204,7 @@ mod tests {
204204
let metadata_pos = encoder.get_ref().len();
205205
assert!(matches!(decoder.decode(), Ok(recs) if recs.len() == 1));
206206
assert!(decoder.has_decoded_metadata);
207-
let rec1 = ErrorMsg::new(1680708278000000000, "Python", true);
207+
let rec1 = ErrorMsg::new(1680708278000000000, None, "Python", true);
208208
let rec2 = OhlcvMsg {
209209
hd: RecordHeader::new::<OhlcvMsg>(rtype::OHLCV_1S, 1, 1, 1681228173000000000),
210210
open: 100,

python/src/encode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ fn py_to_rs_io_err(e: PyErr) -> io::Error {
131131

132132
match e_as_object.call_method(intern!(py, "__str__"), (), None) {
133133
Ok(repr) => match repr.extract::<String>() {
134-
Ok(s) => io::Error::new(io::ErrorKind::Other, s),
135-
Err(_e) => io::Error::new(io::ErrorKind::Other, "An unknown error has occurred"),
134+
Ok(s) => io::Error::other(s),
135+
Err(_e) => io::Error::other("An unknown error has occurred"),
136136
},
137-
Err(_) => io::Error::new(io::ErrorKind::Other, "Err doesn't have __str__"),
137+
Err(_) => io::Error::other("Err doesn't have __str__"),
138138
}
139139
})
140140
}

0 commit comments

Comments
 (0)