Skip to content

Commit 3e0a941

Browse files
committed
REF: Align Python type stubs with reality
1 parent 8aba0f8 commit 3e0a941

File tree

4 files changed

+5273
-2228
lines changed

4 files changed

+5273
-2228
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
# Changelog
22

3+
## 0.46.0 - TBD
4+
5+
### Breaking changes
6+
- Added `DBNRecord` union type to Python which includes all record types
7+
- Removed `Record` class from Python type stubs to match code: the record classes don't
8+
share a base class. Use `DBNRecord` instead.
9+
- Removed `_DBNRecord` union type alias which only existed in typestub and wasn't
10+
importable. Use `DBNRecord | Metadata` instead
11+
312
## 0.45.0 - 2025-12-09
413

5-
#### Enhancements
14+
### Enhancements
615
- Added new venue, dataset, and publisher for Cboe Futures Exchange (`XCBF.PITCH`)
716
- Added support for Python 3.14 to `databento_dbn`
817

Lines changed: 29 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,34 @@
1-
import datetime as dt
2-
from collections.abc import Sequence
3-
from typing import Protocol
4-
from typing import TypedDict
1+
# ruff: noqa: F401, F405, UP007
2+
from typing import Union
3+
4+
from databento_dbn.metadata import MappingInterval
5+
from databento_dbn.metadata import MappingIntervalDict
6+
from databento_dbn.metadata import SymbolMapping
57

68
# Import native module
79
from ._lib import * # noqa: F403
810

911

10-
class MappingInterval(Protocol):
11-
"""
12-
Represents a symbol mapping over a start and end date range interval.
13-
14-
Parameters
15-
----------
16-
start_date : dt.date
17-
The start of the mapping period.
18-
end_date : dt.date
19-
The end of the mapping period.
20-
symbol : str
21-
The symbol value.
22-
23-
"""
24-
25-
start_date: dt.date
26-
end_date: dt.date
27-
symbol: str
28-
29-
30-
class MappingIntervalDict(TypedDict):
31-
"""
32-
Represents a symbol mapping over a start and end date range interval.
33-
34-
Parameters
35-
----------
36-
start_date : dt.date
37-
The start of the mapping period.
38-
end_date : dt.date
39-
The end of the mapping period.
40-
symbol : str
41-
The symbol value.
42-
43-
"""
44-
45-
start_date: dt.date
46-
end_date: dt.date
47-
symbol: str
48-
49-
50-
class SymbolMapping(Protocol):
51-
"""
52-
Represents the mappings for one native symbol.
53-
"""
54-
55-
raw_symbol: str
56-
intervals: Sequence[MappingInterval]
12+
DBNRecord = Union[
13+
MBOMsg,
14+
TradeMsg,
15+
MBP1Msg,
16+
MBP10Msg,
17+
BBOMsg,
18+
CMBP1Msg,
19+
CBBOMsg,
20+
OHLCVMsg,
21+
StatusMsg,
22+
InstrumentDefMsg,
23+
ImbalanceMsg,
24+
StatMsg,
25+
ErrorMsg,
26+
SymbolMappingMsg,
27+
SystemMsg,
28+
ErrorMsgV1,
29+
InstrumentDefMsgV1,
30+
StatMsgV1,
31+
SymbolMappingMsgV1,
32+
SystemMsgV1,
33+
InstrumentDefMsgV2,
34+
]

0 commit comments

Comments
 (0)